From: Chet Ramey Date: Mon, 23 Feb 2015 21:29:18 +0000 (-0500) Subject: commit bash-20150220 snapshot X-Git-Tag: bash-4.4-alpha~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60b80a1f458cd2cdf4a2c187d801474d0a44576f;p=thirdparty%2Fbash.git commit bash-20150220 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index b49d3e38f..d22b48ae0 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -7999,3 +7999,41 @@ include/posixjmp.h lib/readline/util.c - change calls to longjmp to use _rl_longjmp + 2/18 + ---- +variables.c + - bind_int_variable: make sure `v' is non-null before making it visible + + 2/19 + ---- +arrayfunc.c + - assign_array_var_from_word_list: after assignment, mark variable as no + longer invisible + - assign_array_var_from_string: after assignment, mark variable as no + longer invisible + +builtins/declare.def + - declare_internal: add warning if an attempt is made to use a quoted + compound assignment as an argument to declare (declare -a foo='( 1 2 )'); + backwards compatible with bash-4.3. Still a tentative change + + 2/20 + ---- +lib/glob/smatch.c + - is_wcclass: check malloc() return value, return -1 if it fails + Report from Tobias Stoeckmann + +lib/sh/shmatch.c + - sh_regmatch: check malloc() return value, handle NULL value if it + fails. Report from Tobias Stoeckmann + + 2/22 + ---- +lib/readline/doc/rltech.texi + - rl_callback_handler_install: note that the handler function should + free the line it receives, as with readline. Suggested by + Ulf Magnusson + - Readline Signal Handling: note that application needs to clean up + readline's terminal state if it wants to handle a signal before + the line handler restores it. Suggested by Ulf Magnusson + diff --git a/arrayfunc.c b/arrayfunc.c index c2ea0e5f1..6dab71ca6 100644 --- a/arrayfunc.c +++ b/arrayfunc.c @@ -407,6 +407,9 @@ assign_array_var_from_word_list (var, list, flags) (*var->assign_func) (var, l->word->word, i, 0); else array_insert (a, i, l->word->word); + + VUNSETATTR (var, att_invisible); /* no longer invisible */ + return var; } @@ -639,6 +642,10 @@ assign_array_var_from_string (var, value, flags) if (nlist) dispose_words (nlist); + + if (var) + VUNSETATTR (var, att_invisible); /* no longer invisible */ + return (var); } diff --git a/builtins/declare.def b/builtins/declare.def index bdff891d8..79d7a0c75 100644 --- a/builtins/declare.def +++ b/builtins/declare.def @@ -567,11 +567,13 @@ declare_internal (list, local_var) int vlen; vlen = STRLEN (value); /*itrace("declare_builtin: name = %s value = %s flags = %d", name, value, wflags);*/ -#if 0 /* bash-4.4 */ - if (value[0] == '(' && value[vlen-1] == ')' && (shell_compatibility_level <= 43 || (wflags & W_COMPASSIGN))) -#else - if (array_exists == 0 && value[0] == '(' && value[vlen-1] == ')') -#endif + if (shell_compatibility_level > 43 && (wflags & W_COMPASSIGN) == 0 && + value[0] == '(' && value[vlen-1] == ')') + { + internal_warning (_("%s: quoted compound array assignment deprecated"), list->word->word); + compound_array_assign = 1; + } + else if (value[0] == '(' && value[vlen-1] == ')' && (shell_compatibility_level < 44 || (wflags & W_COMPASSIGN))) compound_array_assign = 1; else simple_array_assign = 1; diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c index 6ebe8c3b4..edc5b95d0 100644 --- a/lib/glob/smatch.c +++ b/lib/glob/smatch.c @@ -334,6 +334,8 @@ is_wcclass (wc, name) memset (&state, '\0', sizeof (mbstate_t)); mbs = (char *) malloc (wcslen(name) * MB_CUR_MAX + 1); + if (mbs == 0) + return -1; mbslength = wcsrtombs (mbs, (const wchar_t **)&name, (wcslen(name) * MB_CUR_MAX + 1), &state); if (mbslength == (size_t)-1 || mbslength == (size_t)-2) diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index cfbca3f63..2fd0b943d 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -1307,6 +1307,8 @@ expanded value of @var{prompt}. Save the value of @var{lhandler} to use as a handler function to call when a complete line of input has been entered. The handler function receives the text of the line as an argument. +As with @code{readline()}, the handler function should @code{free} the +line when it it finished with it. @end deftypefun @deftypefun void rl_callback_read_char (void) @@ -1532,7 +1534,14 @@ resetting the terminal to its original state. If the application's signal handler does more than update its idea of the terminal size and return (for example, a @code{longjmp} back to a main processing loop), it @emph{must} call @code{rl_cleanup_after_signal()} (described below), to restore the -terminal state. +terminal state. + +When an application is using the callback interface +(@pxref{Alternate Interface}), Readline installs signal handlers only for +the duration of the call to @code{rl_callback_read_char}. Applications +using the callback interface should be prepared to clean up Readline's +state if they wish to handle the signal before the line handler completes +and restores the terminal state. Readline provides two variables that allow application writers to control whether or not it will catch certain signals and act on them diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index 351faa08f..0f75ecb74 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -1,10 +1,10 @@ @ignore -Copyright (C) 1988-2014 Free Software Foundation, Inc. +Copyright (C) 1988-2015 Free Software Foundation, Inc. @end ignore -@set EDITION 6.3 -@set VERSION 6.3 -@set UPDATED 21 November 2014 -@set UPDATED-MONTH November 2014 +@set EDITION 6.4 +@set VERSION 6.4 +@set UPDATED 22 February 2015 +@set UPDATED-MONTH February 2015 -@set LASTCHANGE Fri Nov 21 08:07:14 EST 2014 +@set LASTCHANGE Sun Feb 22 20:32:36 EST 2015 diff --git a/lib/sh/shmatch.c b/lib/sh/shmatch.c index 3abefed58..fcd228ef2 100644 --- a/lib/sh/shmatch.c +++ b/lib/sh/shmatch.c @@ -2,7 +2,7 @@ * shmatch.c -- shell interface to posix regular expression matching. */ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -79,7 +79,8 @@ sh_regmatch (string, pattern, flags) matches = NULL; #endif - if (regexec (®ex, string, regex.re_nsub + 1, matches, 0)) + /* man regexec: NULL PMATCH ignored if NMATCH == 0 */ + if (regexec (®ex, string, matches ? regex.re_nsub + 1 : 0, matches, 0)) result = EXECUTION_FAILURE; else result = EXECUTION_SUCCESS; /* match */ @@ -95,7 +96,7 @@ sh_regmatch (string, pattern, flags) rematch = make_new_array_variable ("BASH_REMATCH"); amatch = array_cell (rematch); - if ((flags & SHMAT_SUBEXP) && result == EXECUTION_SUCCESS && subexp_str) + if (matches && (flags & SHMAT_SUBEXP) && result == EXECUTION_SUCCESS && subexp_str) { for (subexp_ind = 0; subexp_ind <= regex.re_nsub; subexp_ind++) { diff --git a/variables.c b/variables.c index 2f07ebb92..cbe780637 100644 --- a/variables.c +++ b/variables.c @@ -2872,10 +2872,12 @@ bind_int_variable (lhs, rhs) #endif v = bind_variable (lhs, rhs, 0); - if (v && isint) - VSETATTR (v, att_integer); - - VUNSETATTR (v, att_invisible); + if (v) + { + if (isint) + VSETATTR (v, att_integer); + VUNSETATTR (v, att_invisible); + } return (v); }