fix error message when completing backquote command substitution; fix test builtin with double negation

This commit is contained in:
Chet Ramey
2022-06-28 16:15:24 -04:00
parent eb2d46d77c
commit 42768befc0
11 changed files with 2692 additions and 1549 deletions
+15 -1
View File
@@ -3715,5 +3715,19 @@ execute_cmd.c
- execute_select_command: set this_command_name to NULL after running
any DEBUG trap like execute_for_command does
6/23
----
test.c
- three_arguments: when given [ ! ! arg ], make sure to advance POS
after calling two_arguments to avoid a `too many arguments' error.
Report from Steffen Nurpmeso <steffen@sdaoden.eu>
6/27
----
subst.c
- expand_word_internal: when expanding backquoted command substitution,
call string_extract with the SX_REQMATCH flag (closing backquote
required) only if the word flags don't contain W_COMPLETE,
indicating that we're doing this for completion, probably to
determine whether or not to append something to the word. Fixes bug
reported by Emanuele Torre <torreemanuele6@gmail.com>.
+6 -4
View File
@@ -250,7 +250,7 @@ printf_builtin (list)
WORD_LIST *list;
{
int ch, fieldwidth, precision;
int have_fieldwidth, have_precision, use_Lmod;
int have_fieldwidth, have_precision, use_Lmod, altform;
char convch, thisch, nextch, *format, *modstart, *precstart, *fmt, *start;
#if defined (HANDLE_MULTIBYTE)
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
@@ -341,7 +341,7 @@ printf_builtin (list)
for (fmt = format; *fmt; fmt++)
{
precision = fieldwidth = 0;
have_fieldwidth = have_precision = 0;
have_fieldwidth = have_precision = altform = 0;
precstart = 0;
if (*fmt == '\\')
@@ -379,9 +379,11 @@ printf_builtin (list)
continue;
}
/* found format specification, skip to field width */
/* Found format specification, skip to field width. We check for
alternate form for possible later use. */
for (; *fmt && strchr(SKIP1, *fmt); ++fmt)
;
if (*fmt == '#')
altform++;
/* Skip optional field width. */
if (*fmt == '*')
BIN
View File
Binary file not shown.
+2211 -1117
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+451 -424
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -11258,7 +11258,7 @@ add_string:
{
t_index = sindex++;
temp = string_extract (string, &sindex, "`", SX_REQMATCH);
temp = string_extract (string, &sindex, "`", (word->flags & W_COMPLETE) ? SX_COMPLETE : SX_REQMATCH);
/* The test of sindex against t_index is to allow bare instances of
` to pass through, for backwards compatibility. */
if (temp == &extract_string_error || temp == &extract_string_fatal)
+1
View File
@@ -804,6 +804,7 @@ three_arguments ()
{
advance (1);
value = !two_arguments ();
pos = argc;
}
else if (argv[pos][0] == '(' && argv[pos+2][0] == ')')
{
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+3 -1
View File
@@ -220,6 +220,8 @@ t ! -z "$z"
0
t ! -n "$z"
1
t ! ! "$z"
0
t "$zero"
1
t ! "$zero"
@@ -272,7 +274,7 @@ b ( 1 = 2
2
./test.tests: line 26: test: too many arguments
2
./test.tests: line 431: [: missing `]'
./test.tests: line 434: [: missing `]'
2
./test.tests: line 26: test: (: unary operator expected
2
+3
View File
@@ -358,6 +358,9 @@ t ! -z "$z"
echo 't ! -n "$z"'
t ! -n "$z"
echo 't ! ! "$z"'
t ! ! "$z"
zero=
echo 't "$zero"'
t "$zero"