diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index c1c0b795..48e0d987 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -14384,3 +14384,18 @@ shell.c - main: set positional parameters before running the startup files, so the startup files can inspect $@. Often-requested feature, most recently from Stephane Chazelas + + 10/27 + ----- +doc/{bash.1,bashref.texi} + - Arrays: add some clarifying language to make it clear that array + references that don't use the ${a[s]} syntax are subject to + globbing when passed as arguments to commands such as unset, and + should be quoted for safety. Change prompted by a report from + Eli Barzilay + +parse.y + - parse_comsub: make sure we don't run off the end of the `ret' + buffer when checking for the here doc delimiter. Report from + Jakub Wilk , the result of a fuzzing test. Pointer + to place for the fix from Eduardo Bustamante diff --git a/doc/bash.1 b/doc/bash.1 index 92642550..fc181e45 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Sat Oct 7 17:30:18 EDT 2017 +.\" Last Change: Fri Oct 27 14:15:26 EDT 2017 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2017 October 7" "GNU Bash 4.4" +.TH BASH 1 "2017 October 27" "GNU Bash 4.4" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -2684,13 +2684,16 @@ builtin is used to destroy arrays. \fBunset\fP \fIname\fP[\fIsubscript\fP] destroys the array element at index \fIsubscript\fP, for both indexed and associative arrays. Negative subscripts to indexed arrays are interpreted as described above. -Care must be taken to avoid unwanted side effects caused by pathname -expansion. Unsetting the last element of an array variable does not unset the variable. \fBunset\fP \fIname\fP, where \fIname\fP is an array, or \fBunset\fP \fIname\fP[\fIsubscript\fP], where \fIsubscript\fP is \fB*\fP or \fB@\fP, removes the entire array. .PP +When using a variable name with a subscript as an argument to a command, +such as with \fBunset\fP, without using the word expansion syntax +described above, the argument is subject to pathname expansion. +If pathname expansion is not desired, the argument should be quoted. +.PP The .BR declare , .BR local , @@ -4335,10 +4338,6 @@ A function definition may be deleted using the \fB\-f\fP option to the .B unset builtin. -Note that shell functions and variables with the same name may result -in multiple identically-named entries in the environment passed to the -shell's children. -Care should be taken in cases where this may cause a problem. .PP Functions may be recursive. The \fBFUNCNEST\fP variable may be used to limit the depth of the diff --git a/doc/bashref.texi b/doc/bashref.texi index 41ffe8e6..1fc4cc4a 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -1505,10 +1505,6 @@ Functions may be exported so that subshells automatically have them defined with the @option{-f} option to the @code{export} builtin (@pxref{Bourne Shell Builtins}). -Note that shell functions and variables with the same name may result -in multiple identically-named entries in the environment passed to the -shell's children. -Care should be taken in cases where this may cause a problem. Functions may be recursive. The @code{FUNCNEST} variable may be used to limit the depth of the @@ -7183,13 +7179,16 @@ The @code{unset} builtin is used to destroy arrays. @code{unset @var{name}[@var{subscript}]} destroys the array element at index @var{subscript}. Negative subscripts to indexed arrays are interpreted as described above. -Care must be taken to avoid unwanted side effects caused by filename -expansion. Unsetting the last element of an array variable does not unset the variable. @code{unset @var{name}}, where @var{name} is an array, removes the entire array. A subscript of @samp{*} or @samp{@@} also removes the entire array. +When using a variable name with a subscript as an argument to a command, +such as with @code{unset}, without using the word expansion syntax +described above, the argument is subject to the shell's filename expansion. +If filename expansion is not desired, the argument should be quoted. + The @code{declare}, @code{local}, and @code{readonly} builtins each accept a @option{-a} option to specify an indexed array and a @option{-A} option to specify an associative array. diff --git a/doc/version.texi b/doc/version.texi index fd2cef0d..0845d5fd 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2017 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Sat Oct 7 17:29:58 EDT 2017 +@set LASTCHANGE Fri Oct 27 14:15:11 EDT 2017 @set EDITION 4.4 @set VERSION 4.4 -@set UPDATED 7 October 2017 +@set UPDATED 27 October 2017 @set UPDATED-MONTH October 2017 diff --git a/lib/readline/rlprivate.h b/lib/readline/rlprivate.h index b11a6bf8..2fd2f5ea 100644 --- a/lib/readline/rlprivate.h +++ b/lib/readline/rlprivate.h @@ -26,6 +26,7 @@ #include "rlconf.h" /* for VISIBLE_STATS */ #include "rlstdc.h" #include "posixjmp.h" /* defines procenv_t */ +#include "rlmbutil.h" /* for HANDLE_MULTIBYTE */ /************************************************************************* * * diff --git a/parse.y b/parse.y index 623648c6..252310c6 100644 --- a/parse.y +++ b/parse.y @@ -3838,7 +3838,7 @@ eof_error: tind = lex_firstind; while ((tflags & LEX_STRIPDOC) && ret[tind] == '\t') tind++; - if (STREQN (ret + tind, heredelim, hdlen)) + if (retind-tind == hdlen && STREQN (ret + tind, heredelim, hdlen)) { tflags &= ~(LEX_STRIPDOC|LEX_INHEREDOC|LEX_QUOTEDDOC); /*itrace("parse_comsub:%d: found here doc end `%s'", line_number, ret + tind);*/ diff --git a/trap.c b/trap.c index 28013e88..0fe649d5 100644 --- a/trap.c +++ b/trap.c @@ -1054,7 +1054,7 @@ _run_trap_internal (sig, tag) int run_debug_trap () { - int trap_exit_value; + int trap_exit_value, old_verbose; pid_t save_pgrp; int save_pipe[2]; @@ -1072,8 +1072,15 @@ run_debug_trap () stop_making_children (); #endif + old_verbose = echo_input_at_read; +#if 0 /* not yet */ + echo_input_at_read = 0; +#endif + trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap"); + echo_input_at_read = old_verbose; + #if defined (JOB_CONTROL) pipeline_pgrp = save_pgrp; restore_pipeline (1);