commit bash-20200512 snapshot

This commit is contained in:
Chet Ramey
2020-05-14 17:16:09 -04:00
parent fdbb7e8481
commit 48394b08a7
6 changed files with 39 additions and 22 deletions
+13
View File
@@ -8347,3 +8347,16 @@ support/config.{guess,sub}
configure.ac
- add support for `genode' from Emery Hemingway <ehmry@posteo.net>
5/14
----
test.c
- term: fix case where an argument that looks like a unary operator,
but doesn't have enough tokens left to have an argument to that
operator, was not being treated as a one-argument test. Affects
only uses of test with four and greater arguments, which posix says
are unspecified. This is a bug, or at least an incompatibility, at
least 30 years old.
- test_command: if there are unconsumed arguments, call test_syntax_error
with a `syntax error' argument if the first remaining argument starts
with a `-'. Better than a generic `too many arguments' error
+3 -2
View File
@@ -1187,8 +1187,9 @@ not been present.
.PP
A double-quoted string preceded by a dollar sign (\fB$\fP\(dq\fIstring\fP\(dq)
will cause the string to be translated according to the current locale.
If the current locale is \fBC\fP or \fBPOSIX\fP, the dollar sign
is ignored.
If the current locale is \fBC\fP or \fBPOSIX\fP,
or if there are no translations available,
the dollar sign is ignored.
If the string is translated and replaced, the replacement is
double-quoted.
.SH PARAMETERS
+5 -4
View File
@@ -533,10 +533,11 @@ been present.
@cindex native languages
@cindex translation, native languages
A double-quoted string preceded by a dollar sign (@samp{$}) will cause
the string to be translated according to the current locale.
If the current locale is @code{C} or @code{POSIX}, the dollar sign
is ignored.
A double-quoted string preceded by a dollar sign (@samp{$})
will cause the string to be translated according to the current locale.
If the current locale is @code{C} or @code{POSIX},
or if there are no translations available,
the dollar sign is ignored.
If the string is translated and replaced, the replacement is
double-quoted.
+11 -9
View File
@@ -273,14 +273,11 @@ term ()
if ((pos + 3 <= argc) && test_binop (argv[pos + 1]))
value = binary_operator ();
/* Might be a switch type argument */
else if (argv[pos][0] == '-' && argv[pos][1] && argv[pos][2] == '\0')
{
if (test_unop (argv[pos]))
value = unary_operator ();
else
test_syntax_error (_("%s: unary operator expected"), argv[pos]);
}
/* Might be a switch type argument -- make sure we have enough arguments for
the unary operator and argument */
else if ((pos + 2) <= argc && test_unop (argv[pos]))
value = unary_operator ();
else
{
value = argv[pos][0] != '\0';
@@ -894,7 +891,12 @@ test_command (margc, margv)
value = posixtest ();
if (pos != argc)
test_syntax_error (_("too many arguments"), (char *)NULL);
{
if (pos < argc && argv[pos][0] == '-')
test_syntax_error (_("syntax error: `%s' unexpected"), argv[pos]);
else
test_syntax_error (_("too many arguments"), (char *)NULL);
}
test_exit (SHELL_BOOLEAN (value));
}
+6 -6
View File
@@ -1,6 +1,6 @@
/* test.h -- external interface to the conditional command code. */
/* Copyright (C) 1997-2009 Free Software Foundation, Inc.
/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -28,12 +28,12 @@
#define TEST_ARITHEXP 0x02
#define TEST_LOCALE 0x04
extern int test_unop __P((char *));
extern int test_binop __P((char *));
extern int test_unop PARAMS((char *));
extern int test_binop PARAMS((char *));
extern int unary_test __P((char *, char *));
extern int binary_test __P((char *, char *, char *, int));
extern int unary_test PARAMS((char *, char *));
extern int binary_test PARAMS((char *, char *, char *, int));
extern int test_command __P((int, char **));
extern int test_command PARAMS((int, char **));
#endif /* _TEST_H_ */
+1 -1
View File
@@ -268,7 +268,7 @@ b ( 1 = 2
2
./test.tests: line 26: test: -A: unary operator expected
2
./test.tests: line 26: test: too many arguments
./test.tests: line 26: test: syntax error: `-ne' unexpected
2
./test.tests: line 26: test: too many arguments
2