]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20181114 snapshot
authorChet Ramey <chet.ramey@case.edu>
Wed, 14 Nov 2018 16:45:55 +0000 (11:45 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 14 Nov 2018 16:45:55 +0000 (11:45 -0500)
12 files changed:
CHANGES
CHANGES-5.0
CWRU/CWRU.chlog
NEWS
NEWS-5.0
aclocal.m4
configure
subst.c
tests/RUN-ONE-TEST
tests/array.right
tests/array22.sub
tests/posixexp1.sub

diff --git a/CHANGES b/CHANGES
index fb8e622a09f0ccb79af26b596ba19be0d3812052..4397bc42a2afcf6d1726544d84ff3cfc8a17582d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,5 @@
-This document details the changes between this version, bash-5.0-beta, and
-the previous version, bash-5.0-alpha.
+This document details the changes between this version, bash-5.0-beta2, and
+the previous version, bash-5.0-beta.
 
 1. Changes to Bash
 
@@ -23,6 +23,44 @@ f. Cleaned up some incompatiblities with bash-4.4 when expanding indexed array
 g. The ${parameter@a} expansion will display attributes even if `parameter' is
    unset.
 
+h. Fixed a bug that caused the output of `set' to cut off some variables before
+   printing the value.
+
+i. Treat a failure to assign a variable when using the ${x:=value} expansion
+   as an expansion error, so non-interactive posix-mode shells exit
+
+j. Fixed a problem when expanding $* in a context where word splitting is not
+   performed when IFS is NULL.
+
+k. Temp files used to store here documents are forced readable, no matter what
+   the user's umask says.
+
+l. Fixed a problem where an interrupted brace expansion could cause the shell
+   to attempt to free an invalid memory location.
+
+m. Make sure to check for any terminating signals after running a trap
+   handler; don't wait until the next time we process traps.
+
+n. Fixed a bug that caused "return" to act like a special builtin with respect
+   to variable assignments even when preceded by "command".
+
+o. POSIX-mode shells now return failure if the cd builtin fails due to the
+   absolute directory name being longer than PATH_MAX, instead of trying
+   again with a relative pathname.
+
+p. Fixed a problem with FUNCNAME occasionally being visible when not executing
+   a shell function.
+
+q. Fixed a problem with the expansions performed on the WORD in the case
+   command.
+
+r. Fixed a slight POSIX compatibility when removing "IFS whitespace" during
+   word splitting and the read builtin.
+
+s. Fixed a problem with expanding an array with subscript `*' when all the
+   elements expand to the empty string, and making sure the expansion honors
+   the `:' specifier.
+
 2. Changes to Readline
 
 a. Fixed a bug with adding multibyte characters to an incremental search string.
@@ -33,6 +71,9 @@ 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.
 
+d. Fixed a bug with anchored search patterns when performing searches in vi
+   mode.
+
 3. New Features in Bash
 
 a. Associative and indexed arrays now allow subscripts consisting solely of
@@ -52,11 +93,21 @@ 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'.
 
+h. The $_ variable doesn't change when the shell executes a command that forks.
+
+i. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
+   conforming applications aren't supposed to use them.
+
+j. POSIX mode now enables the `shift_verbose' option.
+
 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.
 
+b. The "Insert" keypad key, if available, now puts readline into overwrite
+   mode.
+
 ------------------------------------------------------------------------------
 This document details the changes between this version, bash-5.0-beta, and
 the previous version, bash-5.0-alpha.
index a1619a7429f4e4f527d3e264b0194eabe5dfe719..c6474703f54ea4d898b47b8c633d8d2d09504c32 100644 (file)
@@ -1,3 +1,114 @@
+This document details the changes between this version, bash-5.0-beta2, and
+the previous version, bash-5.0-beta.
+
+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.
+
+h. Fixed a bug that caused the output of `set' to cut off some variables before
+   printing the value.
+
+i. Treat a failure to assign a variable when using the ${x:=value} expansion
+   as an expansion error, so non-interactive posix-mode shells exit
+
+j. Fixed a problem when expanding $* in a context where word splitting is not
+   performed when IFS is NULL.
+
+k. Temp files used to store here documents are forced readable, no matter what
+   the user's umask says.
+
+l. Fixed a problem where an interrupted brace expansion could cause the shell
+   to attempt to free an invalid memory location.
+
+m. Make sure to check for any terminating signals after running a trap
+   handler; don't wait until the next time we process traps.
+
+n. Fixed a bug that caused "return" to act like a special builtin with respect
+   to variable assignments even when preceded by "command".
+
+o. POSIX-mode shells now return failure if the cd builtin fails due to the
+   absolute directory name being longer than PATH_MAX, instead of trying
+   again with a relative pathname.
+
+p. Fixed a problem with FUNCNAME occasionally being visible when not executing
+   a shell function.
+
+q. Fixed a problem with the expansions performed on the WORD in the case
+   command.
+
+r. Fixed a slight POSIX compatibility when removing "IFS whitespace" during
+   word splitting and the read builtin.
+
+s. Fixed a problem with expanding an array with subscript `*' when all the
+   elements expand to the empty string, and making sure the expansion honors
+   the `:' specifier.
+
+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.
+
+d. Fixed a bug with anchored search patterns when performing searches in vi
+   mode.
+
+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'.
+
+h. The $_ variable doesn't change when the shell executes a command that forks.
+
+i. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
+   conforming applications aren't supposed to use them.
+
+j. POSIX mode now enables the `shift_verbose' option.
+
+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.
+
+b. The "Insert" keypad key, if available, now puts readline into overwrite
+   mode.
+
+------------------------------------------------------------------------------
 This document details the changes between this version, bash-5.0-beta, and
 the previous version, bash-5.0-alpha.
 
index 41b07225ba59df25e41a99adc803371fd7eaa9b3..e1727fc82f221af4d3f38362e33956abd64f97d8 100644 (file)
@@ -4730,3 +4730,18 @@ general.c
 
 doc/bashref.texi
        - posix mode: note the effect of posix mode on shift_verbose
+
+                                  11/12
+                                  -----
+subst.c
+       - parameter_brace_expand: if parameter_brace_expand_word returns an
+         error, make sure to set TEMP = 0 (to note that the variable is unset).
+         From a report by Grisha Levit <grishalevit@gmail.com>
+       - param_expand: if expanding $! when set -u is enabled, honor the
+         PF_IGNUNBOUND flag and just return NULL, relying on the caller to
+         take care of understanding that the variable is unset
+         From a report by Grisha Levit <grishalevit@gmail.com> 
+       - parameter_brace_expand: if we are checking nullness, and we have a
+         valid array expansion, a quoted null string resulting from the array
+         expansion of a * or @ subscript satisfies the nullness check.
+         From a report by Grisha Levit <grishalevit@gmail.com>
diff --git a/NEWS b/NEWS
index 1ef109f3649e1f4e2e3d0343723d906351199862..9e4570b2a6950fef326f33404234cbbfe7b84270 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -110,6 +110,30 @@ gg. The localvar_inherit option will not attempt to inherit a value from a
 hh. The `globasciiranges' option is now enabled by default; it can be set to
     off by default at configuration time.
 
+ii. Associative and indexed arrays now allow subscripts consisting solely of
+    whitespace.
+
+jj. `checkwinsize' is now enabled by default.
+
+kk. The `localvar_unset' shopt option is now visible and documented.
+
+ll. The `progcomp_alias' shopt option is now visible and documented.
+
+mm. The signal name processing code now understands `SIGRTMIN+n' all the way
+    up to SIGRTMAX.
+
+nn. There is a new `seq' loadable builtin.
+
+oo. Trap execution now honors the (internal) max invocations of `eval', since
+    traps are supposed to be executed as if using `eval'.
+
+pp. The $_ variable doesn't change when the shell executes a command that forks.
+
+qq. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
+    conforming applications aren't supposed to use them.
+
+rr. POSIX mode now enables the `shift_verbose' option.
+
 2.  New Features in Readline
 
 a. Non-incremental vi-mode search (`N', `n') can search for a shell pattern, as
@@ -145,6 +169,12 @@ i. The history library has a new variable that allows applications to set the
    initial quoting state, so quoting state can be inherited from a previous
    line.
 
+j. Readline now allows application-defined keymap names; there is a new public
+   function, rl_set_keymap_name(), to do that.
+
+k. The "Insert" keypad key, if available, now puts readline into overwrite
+   mode.
+
 -------------------------------------------------------------------------------
 This is a terse description of the new features added to bash-4.4 since
 the release of bash-4.3.  As always, the manual page (doc/bash.1) is
index 84c90e16f38b12572d6be9c3afca2135da101253..cb199304e7142a3183c2db701a3a79d0ce091472 100644 (file)
--- a/NEWS-5.0
+++ b/NEWS-5.0
@@ -110,6 +110,30 @@ gg. The localvar_inherit option will not attempt to inherit a value from a
 hh. The `globasciiranges' option is now enabled by default; it can be set to
     off by default at configuration time.
 
+ii. Associative and indexed arrays now allow subscripts consisting solely of
+    whitespace.
+
+jj. `checkwinsize' is now enabled by default.
+
+kk. The `localvar_unset' shopt option is now visible and documented.
+
+ll. The `progcomp_alias' shopt option is now visible and documented.
+
+mm. The signal name processing code now understands `SIGRTMIN+n' all the way
+    up to SIGRTMAX.
+
+nn. There is a new `seq' loadable builtin.
+
+oo. Trap execution now honors the (internal) max invocations of `eval', since
+    traps are supposed to be executed as if using `eval'.
+
+pp. The $_ variable doesn't change when the shell executes a command that forks.
+
+qq. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
+    conforming applications aren't supposed to use them.
+
+rr. POSIX mode now enables the `shift_verbose' option.
+
 2.  New Features in Readline
 
 a. Non-incremental vi-mode search (`N', `n') can search for a shell pattern, as
@@ -144,3 +168,9 @@ h. The history expansion library now understands command and process
 i. The history library has a new variable that allows applications to set the
    initial quoting state, so quoting state can be inherited from a previous
    line.
+
+j. Readline now allows application-defined keymap names; there is a new public
+   function, rl_set_keymap_name(), to do that.
+
+k. The "Insert" keypad key, if available, now puts readline into overwrite
+   mode.
index 6ed03e10b295d6773d779a7059b91e136057c8ea..065f490aa559178fa241691ee7800d0e82f5715f 100644 (file)
@@ -1852,7 +1852,7 @@ main()
 ],
 ac_cv_rl_version=`cat conftest.rlv`,
 ac_cv_rl_version='0.0',
-ac_cv_rl_version='7.0')])
+ac_cv_rl_version='8.0')])
 
 CFLAGS="$_save_CFLAGS"
 LDFLAGS="$_save_LDFLAGS"
index 3319525e883769d2fd2e01d7d7b89c63274c2caa..6d7ba9f15807904408c31a308b59be68d512b2a1 100755 (executable)
--- a/configure
+++ b/configure
@@ -5295,7 +5295,7 @@ if ${ac_cv_rl_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then :
-  ac_cv_rl_version='7.0'
+  ac_cv_rl_version='8.0'
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
diff --git a/subst.c b/subst.c
index a3acb32b0ac350d87febf74bda8c7ec4c71e0a4f..35266796e10b22b921ea7cd3f5d66ad76d092c28 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -131,7 +131,6 @@ extern int errno;
    the embedded `break'. The dangling else accommodates a trailing semicolon;
    we could also put in a do ; while (0) */
 
-   
 #define CHECK_STRING_OVERRUN(oind, ind, len, ch) \
   if (ind >= len) \
     { \
@@ -8765,6 +8764,12 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
   else
     tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&(PF_NOSPLIT2|PF_ASSIGNRHS)), &ind);
 
+  if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal)
+    {
+      tflag = 0;
+      tdesc = 0;
+    }
+
   if (tdesc)
     {
       temp = tdesc->word;
@@ -8810,6 +8815,14 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
   /* XXX - this may not need to be restricted to special variables */
   if (check_nullness)
     var_is_null |= var_is_set && var_is_special && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && QUOTED_NULL (temp);
+#if defined (ARRAY_VARS)
+  if (check_nullness)
+    var_is_null |= var_is_set && 
+                  (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) &&
+                  QUOTED_NULL (temp) &&
+                  valid_array_reference (name, 0) &&
+                  chk_atstar (name, 0, (int *)0, (int *)0);
+#endif
 
   /* Get the rest of the stuff inside the braces. */
   if (c && c != RBRACE)
@@ -9131,6 +9144,7 @@ param_expand (string, sindex, quoted, expanded_something,
     case '8':
     case '9':
       temp1 = dollar_vars[TODIGIT (c)];
+      /* This doesn't get called when (pflags&PF_IGNUNBOUND) != 0 */
       if (unbound_vars_is_error && temp1 == (char *)NULL)
        {
          uerror[0] = '$';
@@ -9179,7 +9193,7 @@ param_expand (string, sindex, quoted, expanded_something,
          if (expanded_something)
            *expanded_something = 0;
          temp = (char *)NULL;
-         if (unbound_vars_is_error)
+         if (unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
            {
              uerror[0] = '$';
              uerror[1] = c;
index 58c375b70d886bcff86f789ae4a15eee397f87c8..554f3d6ecc09d7149b13daa2d36a6bab1480269f 100755 (executable)
@@ -1,4 +1,4 @@
-BUILD_DIR=/usr/local/build/chet/bash/bash-current
+BUILD_DIR=/usr/local/build/bash/bash-current
 THIS_SH=$BUILD_DIR/bash
 PATH=$PATH:$BUILD_DIR
 
index 5d3e29958c973fa883eaa7cfce572f658656cbc5..ff0c3dd24f4ce8cad44c3fbe3d151d4a99577337 100644 (file)
@@ -506,7 +506,8 @@ a1
 argv[1] = <>
 argv[2] = <>
 a2
-argv[1] = <>
+argv[1] = <y>
+argv[1] = <z>
 a3
 argv[1] = <>
 argv[2] = <x>
@@ -520,6 +521,8 @@ argv[1] = <>
 argv[2] = <x>
 p3
 argv[1] = <y>
+<X> <X> <X> <X>
+<X> <X> <X> <X>
 ./array23.sub: line 9: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
 ./array23.sub: line 10: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
 foo
index e0463c3436d8e541b80ade65d356f70e00e9fd83..adae6e1a1255780ce097d6f1d40e83fdfc72722a 100644 (file)
@@ -7,6 +7,7 @@ unset a
 
 echo a2
 a[1]=; recho "${a[@]:-y}"
+a[1]=; recho "${a[*]:-z}"
 unset a
 
 echo a3
@@ -32,3 +33,14 @@ shift $#
 echo p3
 set '' x
 recho ${@:+y}
+
+# problems with * and null expansions dating back to bash's earliest days
+A=(''); set -- ''
+
+echo "<${A[*]:-X}>" "<${*:-X}>" "<${A:-X}>" "<${A[0]:-X}>" 
+
+IFS=
+A=('' ''); set -- '' ''
+B=''
+
+echo "<${A[*]:-X}>" "<${*:-X}>" "<${B:-X}>" "<${B[*]:-X}>"
index ce0b29dcf7166d67de68e7205026a3f5204381db..91718e3d36fe5a9cdce7cf46fa37b2e22f5e4877 100644 (file)
@@ -27,4 +27,12 @@ ${THIS_SH} -uc 'echo $1' 2>/dev/null && exit 20
 ${THIS_SH} -uc 'echo $1' ${THIS_SH} xnotthere >/dev/null || exit 21
 ${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere 2>/dev/null && exit 22
 ${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere ynotthere >/dev/null || exit 23
+
+${THIS_SH} -uc 'echo $! ; exit 24' 2>/dev/null
+${THIS_SH} -uc 'echo ${!} ; exit 25' 2>/dev/null
+${THIS_SH} -uc 'echo ${!,} ; exit 26' 2>/dev/null
+
+${THIS_SH} -uc 'echo ${!-ok 27} >/dev/null || exit 27'
+${THIS_SH} -uc 'echo ${2-ok 28} >/dev/null || exit 28'
+
 exit 0