]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20181019 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 22 Oct 2018 20:47:48 +0000 (16:47 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 22 Oct 2018 20:47:48 +0000 (16:47 -0400)
CHANGES
CWRU/CWRU.chlog
builtins/setattr.def
execute_cmd.c
lib/readline/histsearch.c
lib/readline/search.c
po/pt.po
subst.c
subst.h

diff --git a/CHANGES b/CHANGES
index bce097c405d3c0938e4b08dceb2adb8768ad569e..fb8e622a09f0ccb79af26b596ba19be0d3812052 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,66 @@
 This document details the changes between this version, bash-5.0-beta, and
 the previous version, bash-5.0-alpha.
 
+1. Changes to Bash
+
+a. Fixed a bug that could cause a seg fault while parsing a subshell command
+   inside a command substitution.
+
+b. Fixed several small memory leaks uncovered by coverity.
+
+c. Fixed a problem with command substitution inside an interactive shell that
+   could cause the parent to receive a SIGHUP.
+
+d. Fixed a problem with using `*' and `@' as subscripts when assigning values
+   to an associative array with assoc_expand_once enabled.
+
+e. Fixed a bug that could cause a huge memory allocation when completing a
+   word beginning with an invalid tilde expansion.
+
+f. Cleaned up some incompatiblities with bash-4.4 when expanding indexed array
+   subscripts used in arithmetic expansions when assoc_expand_once is enabled.
+
+g. The ${parameter@a} expansion will display attributes even if `parameter' is
+   unset.
+
+2. Changes to Readline
+
+a. Fixed a bug with adding multibyte characters to an incremental search string.
+
+b. Fixed a bug with redoing text insertions in vi mode.
+
+c. Fixed a bug with pasting text into an incremental search string if bracketed
+   paste mode is enabled. ESC cannot be one of the incremental search
+   terminator characters for this to work.
+
+3. New Features in Bash
+
+a. Associative and indexed arrays now allow subscripts consisting solely of
+   whitespace.
+
+b. `checkwinsize' is now enabled by default.
+
+c. The `localvar_unset' shopt option is now visible and documented.
+
+d. The `progcomp_alias' shopt option is now visible and documented.
+
+e. The signal name processing code now understands `SIGRTMIN+n' all the way
+   up to SIGRTMAX.
+
+f. There is a new `seq' loadable builtin.
+
+g. Trap execution now honors the (internal) max invocations of `eval', since
+   traps are supposed to be executed as if using `eval'.
+
+4. New Features in Readline
+
+a. Readline now allows application-defined keymap names; there is a new public
+   function, rl_set_keymap_name(), to do that.
+
+------------------------------------------------------------------------------
+This document details the changes between this version, bash-5.0-beta, and
+the previous version, bash-5.0-alpha.
+
 1.  Changes to Bash
 
 a. Fixed a bug that allowed subshells to "inherit" enclosing loops -- this
index 3a6d4832b2c5d8e1789f1e58b1b15d0039a711bf..930624435f0e52e8f5bd509b458fe940e46d3f4b 100644 (file)
@@ -4587,3 +4587,31 @@ arrayfunc.c
          array subscript -- we already figure out whether or not we are
 
 [bumped release status to beta2]
+
+                                  10/20
+                                  -----
+builtins/setattr.def
+       - set_or_show_attributes: after isolating NAME, make sure to restore
+         the "[+]=" in case we need the word later. Issue pointed out by
+         Grisha Levit <grishalevit@gmail.com>
+
+                                  10/21
+                                  -----
+lib/readline/search.c
+       - noninc_search_from_pos: if we are supposed to be searching for a
+         pattern (vi mode), make sure to pass S to _hs_history_patsearch,
+         since that has any leading `^' stripped
+
+lib/readline/histsearch.c
+       - _hs_history_patsearch: if the search isn't anchored, put a `*' at
+         the beginning to force fnmatch to match anywhere in the line (could
+         look at this later to make a change to history_search_internal that
+         would avoid the need to add the leading `*')
+
+subst.c
+       - parameter_brace_expand_rhs: treat a failure to assign a variable with
+         a ${param:=value} expansion as an expansion error, and, in a non-
+         interactive posix-mode shell, exit the shell
+       - param_expand: don't set W_SPLITSPACE for $* unless IFS is NULL;
+         consistent with other uses of W_SPLITSPACE
+
index 1e35afcacc57e5972ac8ba7c2d3fc6bda95de6dc..251bcacbcc32bd4ba1ee9d7a0db1cd8c899ea048 100644 (file)
@@ -277,6 +277,12 @@ set_or_show_attributes (list, attribute, nodefs)
            }
 
          set_var_attribute (name, attribute, undo);
+         if (assign)           /* restore word */
+           {
+             name[assign] = '=';
+             if (aflags & ASS_APPEND)
+               name[assign-1] = '+';
+           }
          list = list->next;
        }
     }
index 045863302242f2597bc64caf9d9e0af71524b398..4c2b15cd21c84bb579ff96b08700ebb0f321dfc7 100644 (file)
@@ -3473,9 +3473,31 @@ execute_case_command (case_command)
     }
 #endif
 
+#if 0  /* TAG: bash-5.1 */
+  /* Use the same expansions (POSIX leaves them unspecified) as the patterns
+     but dequote the resulting string, since the quotes are handled specially
+     below. */
+  if (posixly_correct)
+    {
+      wlist = expand_word_leave_quoted (case_command->word, 0);
+      if (wlist)
+       {
+         char *t;
+         t = string_list (wlist);
+         word = dequote_string (t);
+         free (t);
+       }
+      else
+        word = savestring ("");
+      dispose_words (wlist);
+    }
+  else
+#endif
+    {
   wlist = expand_word_unsplit (case_command->word, 0);
   word = wlist ? string_list (wlist) : savestring ("");
   dispose_words (wlist);
+    }
 
   retval = EXECUTION_SUCCESS;
   ignore_return = case_command->flags & CMD_IGNORE_RETURN;
index b6771fda232c54f1c8a68043f6d69d3ff208deed..7a426c96781429785f1b44ad3241da43e63df545 100644 (file)
@@ -199,7 +199,7 @@ int
 _hs_history_patsearch (const char *string, int direction, int flags)
 {
   char *pat;
-  size_t len;
+  size_t len, start;
   int ret, unescaped_backslash;
 
 #if defined (HAVE_FNMATCH)
@@ -216,12 +216,26 @@ _hs_history_patsearch (const char *string, int direction, int flags)
     }
   if (unescaped_backslash)
     return -1;
-  pat = (char *)xmalloc (len + 2);
+  pat = (char *)xmalloc (len + 3);
+  /* If the search string is not anchored, we'll be calling fnmatch (assuming
+     we have it). Prefix a `*' to the front of the search string so we search
+     anywhere in the line. */
+  if ((flags & ANCHORED_SEARCH) == 0 && string[0] != '*')
+    {
+      pat[0] = '*';
+      start = 1;
+      len++;
+    }
+  else
+    {
+      start = 0;
+    }
+
   /* Attempt to reduce the number of searches by tacking a `*' onto the end
      of a pattern that doesn't have one.  Assume a pattern that ends in a
      backslash contains an even number of trailing backslashes; we check
      above */
-  strcpy (pat, string);
+  strcpy (pat + start, string);
   if (pat[len - 1] != '*')
     {
       pat[len] = '*';          /* XXX */
index 649256114bdd556769d1756242900a51da8e30fd..c9c1f5d1dd331cba431ec891300ba3693f6e1c14 100644 (file)
@@ -135,7 +135,7 @@ noninc_search_from_pos (char *string, int pos, int dir, int flags, int *ncp)
          sflags |= ANCHORED_SEARCH;
          s++;
        }
-      ret = _hs_history_patsearch (string, dir, sflags);
+      ret = _hs_history_patsearch (s, dir, sflags);
     }
   else if (*string == '^')
     ret = history_search_prefix (string + 1, dir);
index 2678c9b7646b9d36b7ba7cf503eb51670c731393..244170b01eb998065935564179646e23a1aa69b2 100644 (file)
--- a/po/pt.po
+++ b/po/pt.po
@@ -12,10 +12,10 @@ msgstr ""
 "Last-Translator: Pedro Albuquerque <palbuquerque73@gmail.com>\n"
 "Language-Team: Portuguese <translation-team-pt@lists.sourceforge.net>\n"
 "Language: pt\n"
-"X-Bugs: Report translation errors to the Language-Team address.\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=2; plural=n !=1;\n"
 "X-Generator: Gtranslator 2.91.6\n"
 
@@ -542,7 +542,7 @@ msgstr "posição do histórico"
 #: builtins/history.def:264
 #, c-format
 msgid "%s: invalid timestamp"
-msgstr "%s: carimbo inválido"
+msgstr "%s: datação inválida"
 
 #: builtins/history.def:375
 #, c-format
@@ -4233,7 +4233,7 @@ msgstr ""
 "        EXPR1 -o EXPR2 Verdadeiro se EXPR1 OU EXPR2 forem verdadeiros.\n"
 "     \n"
 "        arg1 OP arg2    Testes aritméticos. OP é um de -eq, -ne,\n"
-"                           -lt, -le, -gt, ou -ge.\n"
+"                           -lt, -le, -gt, ou -ge.\n"
 "     \n"
 "     Operadores binários aritméticos devolvem verdadeiro se ARG1 for igual, não\n"
 "     igual, menor que, menor ou igual que, maior que ou maior ou igual que\n"
diff --git a/subst.c b/subst.c
index 34be5ff9d22d83111664bcb7ea814e3ab39793ca..267aaea73e7f946d539d6e96f41989adc8729efe 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -4276,6 +4276,21 @@ quote_list (list)
   return list;
 }
 
+WORD_DESC *
+dequote_word (word)
+     WORD_DESC *word;
+{
+  register char *s;
+
+  s = dequote_string (word->word);
+  if (QUOTED_NULL (word->word))
+    word->flags &= ~W_HASQUOTEDNULL;
+  free (word->word);
+  word->word = s;
+
+  return word;
+}
+
 /* De-quote quoted characters in each word in LIST. */
 WORD_LIST *
 dequote_list (list)
@@ -6821,6 +6836,7 @@ parameter_brace_expand_rhs (name, value, op, quoted, pflags, qdollaratp, hasdoll
   WORD_LIST *l;
   char *t, *t1, *temp, *vname;
   int l_hasdollat, sindex;
+  SHELL_VAR *v;
 
 /*itrace("parameter_brace_expand_rhs: %s:%s pflags = %d", name, value, pflags);*/
   /* If the entire expression is between double quotes, we want to treat
@@ -6950,10 +6966,26 @@ parameter_brace_expand_rhs (name, value, op, quoted, pflags, qdollaratp, hasdoll
     
 #if defined (ARRAY_VARS)
   if (valid_array_reference (vname, 0))
-    assign_array_element (vname, t1, 0);
+    v = assign_array_element (vname, t1, 0);
   else
 #endif /* ARRAY_VARS */
-  bind_variable (vname, t1, 0);
+  v = bind_variable (vname, t1, 0);
+
+  if (v == 0 || readonly_p (v) || noassign_p (v))      /* expansion error  */
+    {
+      if ((v == 0 || readonly_p (v)) && interactive_shell == 0 && posixly_correct)
+       {
+         last_command_exit_value = EXECUTION_FAILURE;
+         exp_jump_to_top_level (FORCE_EOF);
+       }
+      else
+       {
+         if (vname != name)
+           free (vname);
+         last_command_exit_value = EX_BADUSAGE;
+         exp_jump_to_top_level (DISCARD);
+       }
+    }
 
   stupidly_hack_special_variables (vname);
 
@@ -9244,7 +9276,11 @@ param_expand (string, sindex, quoted, expanded_something,
              temp = string_list_dollar_at (list, quoted, 0);
              /* Set W_SPLITSPACE to make sure the individual positional
                 parameters are split into separate arguments */
+#if 0
              if (quoted == 0 && (ifs_is_set == 0 || ifs_is_null))
+#else  /* change with bash-5.0 */
+             if (quoted == 0 && ifs_is_null)
+#endif
                tflag |= W_SPLITSPACE;
              /* If we're not quoted but we still don't want word splitting, make
                 we quote the IFS characters to protect them from splitting (e.g.,
diff --git a/subst.h b/subst.h
index 7530dc6e9f6563be6a9928b67d567f2d422c598b..34763222e7678baefe67d9652f8a0c8d1270bdfb 100644 (file)
--- a/subst.h
+++ b/subst.h
@@ -194,6 +194,8 @@ extern char *dequote_string __P((char *));
 /* De-quote CTLESC-escaped CTLESC or CTLNUL characters in STRING. */
 extern char *dequote_escapes __P((const char *));
 
+extern WORD_DESC *dequote_word __P((WORD_DESC *));
+
 /* De-quote quoted characters in each word in LIST. */
 extern WORD_LIST *dequote_list __P((WORD_LIST *));