From: Chet Ramey Date: Fri, 9 Dec 2011 01:12:19 +0000 (-0500) Subject: commit bash-20090709 snapshot X-Git-Tag: bash-4.3-alpha~220 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6669f0e53825adb822456f2c74cf8f102e501cf5;p=thirdparty%2Fbash.git commit bash-20090709 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 9b75bc0f8..a29952985 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -8197,3 +8197,11 @@ builtins/command.def verbose-handling section, so command -v and command -V honor the PATH set by command -p. Bug and fix from ohki@gssm.otsuka.tsukuba.ac.jp + + 7/9 + --- +subst.c + - change brace_expand_word_list to defer brace expansion on compound + array assignments that are arguments to builtins like `declare', + deferring the expansion until the assignment statement is processed. + Fixes inconsistency reported by agriffis@n01se.net diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 02c016245..9b75bc0f8 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -8148,3 +8148,52 @@ findcmd.c - use eaccess(2) if available in file_status to take other file access mechanisms such as ACLs into account. Patch supplied by werner@suse.de + + 6/12 + ---- +xmalloc.c + - also calculate lowest brk() value the first time xmalloc/xrealloc + (and their sh_ counterparts) are called + - error messages consolidated into a single function (allocerr/ + sh_allocerr) to avoid string duplication + + 6/16 + ---- +variables.c + - changes to allow variables.c to be compiled if ALIAS is not defined. + Bug and fix from John Gatewood Ham + +lib/sh/getcwd.c + - fix so systems defining BROKEN_DIRENT_D_INO have the necessary + defines. Fix from Jay Krell + +configure.in + - add -D_ALL_SOURCE to interix CFLAGS for struct timezone definition. + Bug and fix from John Gatewood Ham + + 6/29 + ---- +variables.c + - change initialize_shell_variables to add environment variables with + invalid names to the variables hash table, but marking them as + invisible and imported + - new function, export_environment_candidate. Used when creating the + export environment for commands to include variables with invalid + names inherited from the initial environment. Apparently this + behavior is widespread + - change make_var_export_array to use export_environment_candidate + rather than visible_and_exported to test variables for inclusion + in the export environment + + 7/1 + --- +builtins/read.def + - fix a memory leak where the number of fields is not the same as + the number of variables passed to `read'. Bug report from + werner@suse.de + +builtins/command.def + - move section of code that sets PATH from -p option before the + verbose-handling section, so command -v and command -V honor + the PATH set by command -p. Bug and fix from + ohki@gssm.otsuka.tsukuba.ac.jp diff --git a/builtins/psize-posix.c b/builtins/psize-posix.c index 8663a44a4..e5840e437 100644 --- a/builtins/psize-posix.c +++ b/builtins/psize-posix.c @@ -20,6 +20,7 @@ #include #include +#include main(c, v) int c; diff --git a/subst.c b/subst.c index ea7cf3c6a..f628c0b83 100644 --- a/subst.c +++ b/subst.c @@ -8579,6 +8579,13 @@ brace_expand_word_list (tlist, eflags) { next = tlist->next; + if ((tlist->word->flags & (W_COMPASSIGN|W_ASSIGNARG)) == (W_COMPASSIGN|W_ASSIGNARG)) + { +/*itrace("brace_expand_word_list: %s: W_COMPASSIGN|W_ASSIGNARG", tlist->word->word);*/ + PREPEND_LIST (tlist, output_list); + continue; + } + /* Only do brace expansion if the word has a brace character. If not, just add the word list element to BRACES and continue. In the common case, at least when running shell scripts, this will diff --git a/subst.c~ b/subst.c~ index 65ebf2fe6..6e54a63c4 100644 --- a/subst.c~ +++ b/subst.c~ @@ -5972,7 +5972,6 @@ pat_subst (string, pat, rep, mflags) mtype = mflags & MATCH_TYPEMASK; -itrace("pat_subst: string = `%s' pat = `%s' rep = `%s'", string, pat, rep); /* Special cases: * 1. A null pattern with mtype == MATCH_BEG means to prefix STRING * with REP and return the result. @@ -6794,7 +6793,7 @@ parameter_brace_expand (string, indexp, quoted, quoted_dollar_atp, contains_doll return &expand_wdesc_error; case RBRACE: - if (var_is_set == 0 && unbound_vars_is_error) + if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1])) { last_command_exit_value = EXECUTION_FAILURE; err_unboundvar (name); @@ -7017,6 +7016,15 @@ param_expand (string, sindex, quoted, expanded_something, case '*': /* `$*' */ list = list_rest_of_args (); +#if 0 + /* According to austin-group posix proposal by Geoff Clare in + <20090505091501.GA10097@squonk.masqnet> of 5 May 2009: + + "The shell shall write a message to standard error and + immediately exit when it tries to expand an unset parameter + other than the '@' and '*' special parameters." + */ + if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0) { uerror[0] = '$'; @@ -7026,6 +7034,7 @@ param_expand (string, sindex, quoted, expanded_something, err_unboundvar (uerror); return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); } +#endif /* If there are no command-line arguments, this should just disappear if there are other characters in the expansion, @@ -7079,6 +7088,15 @@ param_expand (string, sindex, quoted, expanded_something, case '@': /* `$@' */ list = list_rest_of_args (); +#if 0 + /* According to austin-group posix proposal by Geoff Clare in + <20090505091501.GA10097@squonk.masqnet> of 5 May 2009: + + "The shell shall write a message to standard error and + immediately exit when it tries to expand an unset parameter + other than the '@' and '*' special parameters." + */ + if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0) { uerror[0] = '$'; @@ -7088,6 +7106,7 @@ param_expand (string, sindex, quoted, expanded_something, err_unboundvar (uerror); return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); } +#endif /* We want to flag the fact that we saw this. We can't turn off quoting entirely, because other characters in the @@ -8560,6 +8579,13 @@ brace_expand_word_list (tlist, eflags) { next = tlist->next; + if ((tlist->word->flags & (W_COMPASSIGN|W_ASSIGNARG)) == (W_COMPASSIGN|W_ASSIGNARG)) + { +itrace("brace_expand_word_list: %s: W_COMPASSIGN|W_ASSIGNARG", tlist->word->word); + PREPEND_LIST (tlist, output_list); + continue; + } + /* Only do brace expansion if the word has a brace character. If not, just add the word list element to BRACES and continue. In the common case, at least when running shell scripts, this will