commit bash-20171103 snapshot

This commit is contained in:
Chet Ramey
2017-11-06 09:19:55 -05:00
parent ed9d6077c5
commit 5bf9b550c0
6 changed files with 53 additions and 5 deletions
+34
View File
@@ -14399,3 +14399,37 @@ parse.y
buffer when checking for the here doc delimiter. Report from
Jakub Wilk <jwilk@jwilk.net>, the result of a fuzzing test. Pointer
to place for the fix from Eduardo Bustamante <dualbus@gmail.com>
10/30
-----
builtins/pushd.def
- get_directory_stack: make sure the current directory (element 0 of
the stack) is passed to polite_directory_format under the same
conditions as the rest of the stack entries (flags & 1). Otherwise
something like `cd ${DIRSTACK[0]}' will fail. Fixes bug reported
by Steve Jones <sjml@slohj.org>
builtins/declare.def
- declare_internal: when checking for a `[' to see whether or not this
is an array variable declaration (declare -a foo[12]), make sure
we don't do the check if we're just dealing with shell functions.
Bug and pointer to fix from PJ Eby <pje@telecommunity.com>
11/1
----
parse.y
- parse_comsub: if we read a four-character word followed by a break
character, and that word is not one of the reserved words, set
lex_rwlen to 0 since we are no longer in a reserved word. It only
hurts if another break character immediately follows, so that test
succeeds again. Turn off the RESWDOK flag only if it's not a shell
metacharacter, too. Fixes bug reported by Kjetil Torgrim Homme
<kjetilho@scribus.ms.redpill-linpro.com>
11/3
----
lib/readline/isearch.c
- _rl_isearch_dispatch: if we are searching in reverse order, let
sline_index go to -1 to avoid searching the same line twice. It
gets reset right after that, so there's no danger of indexing into
the history line with a negative index.
+1 -1
View File
@@ -373,7 +373,7 @@ restart_new_var_name:
compound_array_assign = simple_array_assign = 0;
array_subscript_assignment = 0;
subscript_start = (char *)NULL;
if (t = strchr (name, '[')) /* ] */
if ((t = strchr (name, '[')) && (flags_on & att_function) == 0) /* ] */
{
/* If offset != 0 we have already validated any array reference
because assignment() calls skipsubscript() */
+1 -1
View File
@@ -678,7 +678,7 @@ get_directory_stack (flags)
d = ".";
else
{
t = polite_directory_format (d);
t = (flags&1) ? polite_directory_format (d) : d;
/* polite_directory_format sometimes returns its argument unchanged.
If it does not, we can free d right away. If it does, we need to
mark d to be deleted later. */
+8 -2
View File
@@ -516,7 +516,7 @@ add_character:
}
return (1);
}
else if (cxt->sflags & SF_REVERSE && cxt->sline_index > 0)
else if ((cxt->sflags & SF_REVERSE) && cxt->sline_index >= 0)
cxt->sline_index--;
else if (cxt->sline_index != cxt->sline_len)
cxt->sline_index++;
@@ -665,6 +665,7 @@ add_character:
}
else
cxt->sline_index += cxt->direction;
if (cxt->sline_index < 0)
{
cxt->sline_index = 0;
@@ -697,7 +698,12 @@ add_character:
(cxt->search_string_index > cxt->sline_len));
if (cxt->sflags & SF_FAILED)
break;
{
/* XXX - reset sline_index if < 0 */
if (cxt->sline_index < 0)
cxt->sline_index = 0;
break;
}
/* Now set up the line for searching... */
cxt->sline_index = (cxt->sflags & SF_REVERSE) ? cxt->sline_len - cxt->search_string_index : 0;
+3 -1
View File
@@ -4079,11 +4079,13 @@ eof_error:
tflags |= LEX_RESWDOK;
lex_rwlen = 0;
}
else
else if (shellmeta (ch) == 0)
{
tflags &= ~LEX_RESWDOK;
/*itrace("parse_comsub:%d: found `%.4s', lex_reswdok -> 0", line_number, ret+retind-4);*/
}
else /* can't be in a reserved word any more */
lex_rwlen = 0;
}
else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
; /* don't modify LEX_RESWDOK if we're starting a comment */
+6
View File
@@ -50,6 +50,12 @@ do
:
done
# problem with four-character words followed by a metachar through bash-4.4
comsub_foo_1()
{
echo $(while true; do case $HOME in /*) echo abs ;; esac; done)
}
${THIS_SH} ./comsub1.sub
${THIS_SH} ./comsub2.sub
${THIS_SH} ./comsub3.sub