commit bash-20170622 snapshot

This commit is contained in:
Chet Ramey
2017-06-22 09:02:46 -04:00
parent d7d836dfc5
commit a930c746a8
18 changed files with 63 additions and 2 deletions
+24
View File
@@ -14169,3 +14169,27 @@ parse.y
- history_delimiting_chars: return "" for a blank line, since there's
nothing to delimit with `;'
6/21
----
jobs.c
- wait_for: make sure to call restore_sigint_handler before returning
if we return out of the loop due to no children. Report from
Eduardo Bustamante <dualbus@gmail.com>
subst.c
- expand_word_internal: if split_on_spaces is set, and the word is
unquoted, and IFS is null, split the results of the previous steps
on $' \t\n' instead of just ' '. This relies on the previous steps
quoting the portions of the word that should not be split. Fixes
bug reported by Kevin Brodsky <corax26@gmail.com>
expr.c
- evalexp: after running expr_unwind, make sure we reset expr_depth
to 0 for the next call
- expr_streval: if after a call to get_array_value (which can call
the expression evaluator recursively) we discover that expr_depth
is less than it was before we called it, we assume there has been
some kind of error and an expr_unwind, so we treat it as an
error and either longjmp back to the expression top level or return
0 immediately. Fixes bug reported by Eduardo Bustamante
<dualbus@gmail.com>
+1
View File
@@ -117,6 +117,7 @@ head_builtin (list)
return (EX_USAGE);
}
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -91,6 +91,7 @@ id_builtin (list)
case 'n': id_flags |= ID_USENAME; break;
case 'r': id_flags |= ID_USEREAL; break;
case 'u': id_flags |= ID_USERONLY; break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -76,6 +76,7 @@ ln_builtin (list)
case 'n':
flags |= LN_NOFOLLOW;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -68,6 +68,7 @@ mkdir_builtin (list)
case 'm':
mode = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage();
return (EX_USAGE);
+1
View File
@@ -112,6 +112,7 @@ pathchk_builtin (list)
case 'p':
pflag = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -122,6 +122,7 @@ print_builtin (list)
case 'f':
pfmt = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -46,6 +46,7 @@ printenv_builtin (list)
{
switch (opt)
{
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -51,6 +51,7 @@ push_builtin (list)
{
switch (opt)
{
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -86,6 +86,7 @@ WORD_LIST *list;
case 'v':
vflag = 1;
break;
CASE_HELPOPT;
default:
builtin_usage();
return (EX_USAGE);
+1
View File
@@ -84,6 +84,7 @@ tee_builtin (list)
case 'i':
nointr = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -31,6 +31,7 @@ template_builtin (list)
{
switch (opt)
{
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -46,6 +46,7 @@ tty_builtin (list)
case 's':
sflag = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -95,6 +95,7 @@ uname_builtin (list)
case 'v':
uname_flags |= FLAG_VERSION;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -39,6 +39,7 @@ whoami_builtin (list)
{
switch (opt)
{
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+11
View File
@@ -402,6 +402,7 @@ evalexp (expr, flags, validp)
tokstr = expression = (char *)NULL;
expr_unwind ();
expr_depth = 0; /* XXX - make sure */
/* We copy in case we've called evalexp recursively */
FASTCOPY (oevalbuf, evalbuf, sizeof (evalbuf));
@@ -1117,6 +1118,7 @@ expr_streval (tok, e, lvalue)
SHELL_VAR *v;
char *value;
intmax_t tval;
int initial_depth;
#if defined (ARRAY_VARS)
arrayind_t ind;
int tflag, aflag;
@@ -1128,6 +1130,8 @@ expr_streval (tok, e, lvalue)
if (noeval)
return (0);
initial_depth = expr_depth;
#if defined (ARRAY_VARS)
tflag = assoc_expand_once && already_expanded; /* for a start */
#endif
@@ -1181,6 +1185,13 @@ expr_streval (tok, e, lvalue)
value = get_variable_value (v);
#endif
if (expr_depth < initial_depth)
{
if (no_longjmp_on_fatal_error && interactive_shell)
sh_longjmp (evalbuf, 1);
return (0);
}
tval = (value && *value) ? subexpr (value) : 0;
if (lvalue)
+2 -1
View File
@@ -2782,7 +2782,8 @@ itrace("wait_for: blocking wait for %d returns %d child = %p", (int)pid, r, chil
if (r == -1 && errno == ECHILD && this_shell_builtin == wait_builtin)
{
termination_state = -1;
/* XXX - restore sigint handler here? */
/* XXX - restore sigint handler here */
restore_sigint_handler ();
goto wait_for_return;
}
+12 -1
View File
@@ -8984,6 +8984,8 @@ param_expand (string, sindex, quoted, expanded_something,
else
{
temp = string_list_dollar_at (list, quoted, 0);
/* Set W_SPLITSPACE to make sure the individual positional
parameters are split into separate arguments */
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
@@ -10158,7 +10160,16 @@ finished_with_string:
or we expanded "$@" with IFS null and we need to split the positional
parameters into separate words. */
if (split_on_spaces)
list = list_string (istring, " ", 1); /* XXX quoted == 1? */
{
/* If IFS is not set, and the word is not quoted, we want to split
the individual words on $' \t\n'. We rely on previous steps to
quote the portions of the word that should not be split */
if (ifs_is_set == 0)
list = list_string (istring, " \t\n", 1); /* XXX quoted == 1? */
else
list = list_string (istring, " ", 1); /* XXX quoted == 1? */
}
/* If we have $@ (has_dollar_at != 0) and we are in a context where we
don't want to split the result (W_NOSPLIT2), and we are not quoted,
we have already separated the arguments with the first character of