commit bash-20160610 snapshot

This commit is contained in:
Chet Ramey
2016-06-15 15:34:12 -04:00
parent 80c3b1d4bd
commit fe17e988f9
4 changed files with 30 additions and 7 deletions
+8
View File
@@ -11262,3 +11262,11 @@ arrayfunc.c
- valid_array_reference: make sure the array reference is properly
terminated after the first subscript; return invalid if there is
anything following the closing `]'
6/12
----
variables.c
- bind_variable_internal: if asked to perform an array subscript
assignment on a nameref variable, display a warning and remove the
nameref attribute (as bash-4.3 did). Reported by Dan Douglas
<ormaaj@gmail.com>
-3
View File
@@ -981,9 +981,6 @@ edit_and_execute_command (count, c, editing_mode, edit_command)
metaval = rl_variable_value ("input-meta");
metaflag = RL_BOOLEAN_VARIABLE_VALUE (metaval);
/* Now, POSIX.1-2001 and SUSv3 say that the commands executed from the
temporary file should be placed into the history. We don't do that
yet. */
if (rl_deprep_term_function)
(*rl_deprep_term_function) ();
save_parser_state (&ps);
+7
View File
@@ -447,6 +447,13 @@ fc_builtin (list)
return (EXECUTION_FAILURE);
}
#if defined (READLINE)
/* If we're executing as part of a dispatched readline commnand like
{emacs,vi}_edit_and_execute_command, the readline state will indicate it.
We could remove the partial command from the history, but ksh93 doesn't
so we stay compatible. */
#endif
/* Make sure parse_and_execute doesn't turn this off, even though a
call to parse_and_execute farther up the function call stack (e.g.,
if this is called by vi_edit_and_execute_command) may have already
+15 -4
View File
@@ -2689,8 +2689,8 @@ bind_variable_internal (name, value, table, hflags, aflags)
HASH_TABLE *table;
int hflags, aflags;
{
char *newval;
SHELL_VAR *entry;
char *newval, *tname;
SHELL_VAR *entry, *tentry;
entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table);
/* Follow the nameref chain here if this is the global variables table */
@@ -2720,11 +2720,22 @@ bind_variable_internal (name, value, table, hflags, aflags)
{
newval = nameref_cell (entry);
#if defined (ARRAY_VARS)
/* declare -n foo=x[2] */
/* declare -n foo=x[2] ; foo=bar */
if (valid_array_reference (newval, 0))
{
tname = array_variable_name (newval, (char **)0, (int *)0);
if (tname && (tentry = find_variable_noref (tname)) && nameref_p (tentry))
{
/* nameref variables can't be arrays */
internal_warning (_("%s: removing nameref attribute"), name_cell (tentry));
#if 1
FREE (value_cell (tentry)); /* XXX - bash-4.3 compat */
var_setvalue (tentry, (char *)NULL);
#endif
VUNSETATTR (tentry, att_nameref);
}
/* XXX - should it be aflags? */
entry = assign_array_element (newval, make_variable_value (entry, value, 0), aflags);
entry = assign_array_element (newval, make_variable_value (entry, value, 0), aflags|ASS_NAMEREF);
if (entry == 0)
return entry;
}