From: Chet Ramey Date: Wed, 14 Nov 2018 16:45:55 +0000 (-0500) Subject: commit bash-20181114 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83ea087e65005411435a417f0eaa78c551bf13a5;p=thirdparty%2Fbash.git commit bash-20181114 snapshot --- diff --git a/CHANGES b/CHANGES index fb8e622a0..4397bc42a 100644 --- 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. diff --git a/CHANGES-5.0 b/CHANGES-5.0 index a1619a742..c6474703f 100644 --- a/CHANGES-5.0 +++ b/CHANGES-5.0 @@ -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. diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 41b07225b..e1727fc82 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -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 + - 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 + - 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 diff --git a/NEWS b/NEWS index 1ef109f36..9e4570b2a 100644 --- 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 diff --git a/NEWS-5.0 b/NEWS-5.0 index 84c90e16f..cb199304e 100644 --- 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. diff --git a/aclocal.m4 b/aclocal.m4 index 6ed03e10b..065f490aa 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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" diff --git a/configure b/configure index 3319525e8..6d7ba9f15 100755 --- 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 a3acb32b0..35266796e 100644 --- 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; diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 58c375b70..554f3d6ec 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -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 diff --git a/tests/array.right b/tests/array.right index 5d3e29958..ff0c3dd24 100644 --- a/tests/array.right +++ b/tests/array.right @@ -506,7 +506,8 @@ a1 argv[1] = <> argv[2] = <> a2 -argv[1] = <> +argv[1] = +argv[1] = a3 argv[1] = <> argv[2] = @@ -520,6 +521,8 @@ argv[1] = <> argv[2] = p3 argv[1] = + + ./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 diff --git a/tests/array22.sub b/tests/array22.sub index e0463c343..adae6e1a1 100644 --- a/tests/array22.sub +++ b/tests/array22.sub @@ -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}>" diff --git a/tests/posixexp1.sub b/tests/posixexp1.sub index ce0b29dcf..91718e3d3 100644 --- a/tests/posixexp1.sub +++ b/tests/posixexp1.sub @@ -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