From d994b9d61248e577ca2fbc5193ddcf59e60f6313 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Wed, 6 Jul 2016 10:22:51 -0400 Subject: [PATCH] commit bash-20160701 snapshot --- CWRU/CWRU.chlog | 24 ++++++++++++++++++++++++ arrayfunc.c | 4 ++-- configure | 22 +++++++++++----------- configure.ac | 4 ++-- execute_cmd.c | 4 +++- include/shmbutil.h | 29 +++++++++++++++++++++++++++++ subst.c | 15 ++++++++------- subst.h | 2 +- 8 files changed, 80 insertions(+), 24 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index fdccac81..d9860d6f 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -11306,3 +11306,27 @@ execute_cmd.c - param_expand: when expanding $* in a context where splitting is not desired (pflags & PF_ASSIGNRHS), make sure to quote the word and the included separators. Reported by Dan Douglas + + 6/30 + ---- +configure.ac + - release version is now `beta2' + +execute_cmd.c + - execute_simple_command: even if already_making_children is non-zero, + don't call wait_for if last_made_pid == NO_PID. Indirectly inspired + by report from Nicolas Vivet + + 7/2 + --- +subst.c + - expand_word_internal: when adding an IFS character to the accumulated + string, don't quote it if word expansion is not going to be + performed ((word->flags & (W_NOSPLIT|W_NOSPLIT2)) == 0) in the + default case. This was already the case everwhere else, when we did + `goto add_ifs_character;'. Fixes bug reported by Ibrahim M. Ghazal + + +subst.[ch],arrayfunc.c + - string_list_dollar_at: now takes a new third argument, currently + reserved for future use; changed callers and declaration diff --git a/arrayfunc.c b/arrayfunc.c index 3498b2cb..fb871122 100644 --- a/arrayfunc.c +++ b/arrayfunc.c @@ -1087,7 +1087,7 @@ array_value_internal (s, quoted, flags, rtype, indp) free (temp); } else /* ${name[@]} or unquoted ${name[*]} */ - retval = string_list_dollar_at (l, quoted); /* XXX - leak here */ + retval = string_list_dollar_at (l, quoted, 0); /* XXX - leak here */ dispose_words (l); } @@ -1204,7 +1204,7 @@ array_keys (s, quoted) free (temp); } else /* ${!name[@]} or unquoted ${!name[*]} */ - retval = string_list_dollar_at (l, quoted); + retval = string_list_dollar_at (l, quoted, 0); dispose_words (l); return retval; diff --git a/configure b/configure index c0d903a0..b4d51498 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac for Bash 4.4, version 4.079. +# From configure.ac for Bash 4.4, version 4.080. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bash 4.4-rc2. +# Generated by GNU Autoconf 2.69 for bash 4.4-beta2. # # Report bugs to . # @@ -581,8 +581,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bash' PACKAGE_TARNAME='bash' -PACKAGE_VERSION='4.4-rc2' -PACKAGE_STRING='bash 4.4-rc2' +PACKAGE_VERSION='4.4-beta2' +PACKAGE_STRING='bash 4.4-beta2' PACKAGE_BUGREPORT='bug-bash@gnu.org' PACKAGE_URL='' @@ -1393,7 +1393,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bash 4.4-rc2 to adapt to many kinds of systems. +\`configure' configures bash 4.4-beta2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1458,7 +1458,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bash 4.4-rc2:";; + short | recursive ) echo "Configuration of bash 4.4-beta2:";; esac cat <<\_ACEOF @@ -1651,7 +1651,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bash configure 4.4-rc2 +bash configure 4.4-beta2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2360,7 +2360,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bash $as_me 4.4-rc2, which was +It was created by bash $as_me 4.4-beta2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2754,7 +2754,7 @@ ac_config_headers="$ac_config_headers config.h" BASHVERS=4.4 -RELSTATUS=rc2 +RELSTATUS=beta2 case "$RELSTATUS" in alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;; @@ -16666,7 +16666,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bash $as_me 4.4-rc2, which was +This file was extended by bash $as_me 4.4-beta2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16732,7 +16732,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bash config.status 4.4-rc2 +bash config.status 4.4-beta2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 156f2804..23f8678d 100644 --- a/configure.ac +++ b/configure.ac @@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script. # You should have received a copy of the GNU General Public License # along with this program. If not, see . -AC_REVISION([for Bash 4.4, version 4.079])dnl +AC_REVISION([for Bash 4.4, version 4.080])dnl define(bashvers, 4.4) -define(relstatus, rc2) +define(relstatus, beta2) AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org]) diff --git a/execute_cmd.c b/execute_cmd.c index 1f11efc8..58051057 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -836,7 +836,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, #if !defined (JOB_CONTROL) /* Do not wait for asynchronous processes started from startup files. */ - if (last_made_pid != last_asynchronous_pid) + if (last_made_pid != NO_PID && last_made_pid != last_asynchronous_pid) +#else + if (last_made_pid != NO_PID) #endif /* When executing a shell function that executes other commands, this causes the last simple command in diff --git a/include/shmbutil.h b/include/shmbutil.h index afb381a4..dbaaba86 100644 --- a/include/shmbutil.h +++ b/include/shmbutil.h @@ -499,5 +499,34 @@ extern int locale_mb_cur_max; /* XXX */ \ goto add_string +# define SADD_MBCHAR_BODY(_dst, _src, _si, _srcsize) \ +\ + int i; \ + mbstate_t state_bak; \ + size_t mblength; \ +\ + i = is_basic (*((_src) + (_si))); \ + if (i) \ + mblength = 1; \ + else \ + { \ + state_bak = state; \ + mblength = mbrlen ((_src) + (_si), (_srcsize) - (_si), &state); \ + } \ + if (mblength == (size_t)-1 || mblength == (size_t)-2) \ + { \ + state = state_bak; \ + mblength = 1; \ + } \ + if (mblength < 1) \ + mblength = 1; \ +\ + (_dst) = (char *)xmalloc (mblength + 1); \ + for (i = 0; i < mblength; i++) \ + (_dst)[i+1] = (_src)[(_si)++]; \ + (_dst)[mblength+1] = '\0'; \ +\ + goto add_string + #endif /* HANDLE_MULTIBYTE */ #endif /* _SH_MBUTIL_H_ */ diff --git a/subst.c b/subst.c index f93a843c..47dd7818 100644 --- a/subst.c +++ b/subst.c @@ -2514,9 +2514,10 @@ string_list_dollar_star (list) to quote the words in the list to preserve the positional parameters exactly. */ char * -string_list_dollar_at (list, quoted) +string_list_dollar_at (list, quoted, flags) WORD_LIST *list; int quoted; + int flags; { char *ifs, *ret; #if defined (HANDLE_MULTIBYTE) @@ -2613,7 +2614,7 @@ string_list_pos_params (pchar, list, quoted) string_list_dollar_star if the string is unquoted so we make sure that the elements of $@ are separated by the first character of $IFS for later splitting. */ - ret = string_list_dollar_at (list, quoted); + ret = string_list_dollar_at (list, quoted, 0); else if (pchar == '@') ret = string_list_dollar_star (list); else @@ -8021,7 +8022,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta temp = string_list_dollar_star (xlist); else { - temp = string_list_dollar_at (xlist, quoted); + temp = string_list_dollar_at (xlist, quoted, 0); if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && quoted_dollar_atp) *quoted_dollar_atp = 1; if (contains_dollar_at) @@ -8558,7 +8559,7 @@ param_expand (string, sindex, quoted, expanded_something, temp = string_list_dollar_star (list); else { - temp = string_list_dollar_at (list, quoted); + temp = string_list_dollar_at (list, quoted, 0); if (quoted == 0 && (ifs_is_set == 0 || ifs_is_null)) tflag |= W_SPLITSPACE; /* If we're not quoted but we still don't want word splitting, make @@ -8626,7 +8627,7 @@ param_expand (string, sindex, quoted, expanded_something, performed? Even when IFS is not the default, posix seems to imply that we behave like unquoted $* ? Maybe we should use PF_NOSPLIT2 here. */ - temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted); + temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted, 0); tflag |= W_DOLLARAT; dispose_words (list); @@ -9419,7 +9420,7 @@ add_twochars: /* Testing quoted_dollar_at makes sure that "$@" is split correctly when $IFS does not contain a space. */ temp = quoted_dollar_at - ? string_list_dollar_at (list, Q_DOUBLE_QUOTES) + ? string_list_dollar_at (list, Q_DOUBLE_QUOTES, 0) : string_list (quote_list (list)); dispose_words (list); goto add_string; @@ -9519,7 +9520,7 @@ add_twochars: default: /* This is the fix for " $@ " */ add_ifs_character: - if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (isexp == 0 && isifs (c))) + if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (isexp == 0 && isifs (c) && (word->flags & (W_NOSPLIT|W_NOSPLIT2)) == 0)) { if (string[sindex]) /* from old goto dollar_add_string */ sindex++; diff --git a/subst.h b/subst.h index 75e8e8b9..7c96fc8d 100644 --- a/subst.h +++ b/subst.h @@ -104,7 +104,7 @@ extern char *string_list __P((WORD_LIST *)); extern char *string_list_dollar_star __P((WORD_LIST *)); /* Expand $@ into a single string, obeying POSIX rules. */ -extern char *string_list_dollar_at __P((WORD_LIST *, int)); +extern char *string_list_dollar_at __P((WORD_LIST *, int, int)); /* Turn the positional paramters into a string, understanding quoting and the various subtleties of using the first character of $IFS as the