commit bash-20190118 snapshot

This commit is contained in:
Chet Ramey
2019-01-22 08:40:19 -05:00
parent 0e8fd32490
commit cb7da4469b
10 changed files with 54 additions and 15 deletions
+17
View File
@@ -5061,3 +5061,20 @@ parse.y
alias to determine whether or not to add a trailing space instead
of testing against a space only. These are the non-shell-metacharacters
that can delimit words. Used together with PST_ENDALIAS
1/17
----
parse.y
- shell_getc: keep track of whether the last character read from
shell_input_line is an unquoted backslash and don't add a space to
the end of an alias if the alias value ends in an unquoted backslash.
From an austin-group mailing list discussion message from
Harald van Dijk <ag@gigawatt.nl>
1/20
----
general.c
- check_identifier: make sure CHECK_WORD is non-zero before we check
whether or not the word consists of all digits. This allows function
names to consist solely of digits when not in posix mode. From a
report by Andrey Butirsky <butirsky@gmail.com>
+4 -4
View File
@@ -231,7 +231,7 @@ static int bash_possible_variable_completions __P((int, int));
static int bash_complete_command __P((int, int));
static int bash_possible_command_completions __P((int, int));
static int completion_glob_pattern __P((const char *));
static int completion_glob_pattern __P((char *));
static char *glob_complete_word __P((const char *, int));
static int bash_glob_completion_internal __P((int));
static int bash_glob_complete_word __P((int, int));
@@ -1742,7 +1742,7 @@ bash_default_completion (text, start, end, qc, compflags)
/* This could be a globbing pattern, so try to expand it using pathname
expansion. */
if (!matches && completion_glob_pattern (text))
if (!matches && completion_glob_pattern ((char *)text))
{
matches = rl_completion_matches (text, glob_complete_word);
/* A glob expression that matches more than one filename is problematic.
@@ -1851,7 +1851,7 @@ command_word_completion_function (hint_text, state)
glob_matches = (char **)NULL;
}
globpat = completion_glob_pattern (hint_text);
globpat = completion_glob_pattern ((char *)hint_text);
/* If this is an absolute program name, do not check it against
aliases, reserved words, functions or builtins. We must check
@@ -3716,7 +3716,7 @@ bash_complete_command_internal (what_to_do)
static int
completion_glob_pattern (string)
const char *string;
char *string;
{
register int c;
char *send;
+2 -2
View File
@@ -7696,7 +7696,7 @@ The \fB\-E\fP option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The \fB\-I\fP option indicates that other supplied options and actions should
apply to completion on the inital non-assignment word on the line, or after
apply to completion on the initial non-assignment word on the line, or after
a command delimiter such as \fB;\fP or \fB|\fP, which is usually command
name completion.
If multiple options are supplied, the \fB\-D\fP option takes precedence
@@ -7914,7 +7914,7 @@ The \fB\-E\fP option indicates that other supplied options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The \fB\-I\fP option indicates that other supplied options should
apply to completion on the inital non-assignment word on the line,
apply to completion on the initial non-assignment word on the line,
or after a command delimiter such as \fB;\fP or \fB|\fP, which is usually
command name completion.
.sp 1
+1 -1
View File
@@ -2234,7 +2234,7 @@ array in turn, and the expansion is the resultant list.
@itemx $@{@var{parameter}%%@var{word}@}
The @var{word}
is expanded to produce a pattern and matched according to the rules
described below (@pxref{Pattern Matching}). If the pattern matches
described below (@pxref{Pattern Matching}).
If the pattern matches a trailing portion of the expanded value of
@var{parameter}, then the result of the expansion is the value of
@var{parameter} with the shortest matching pattern (the @samp{%} case)
+5 -5
View File
@@ -338,21 +338,21 @@ check_selfref (name, value, flags)
}
/* Make sure that WORD is a valid shell identifier, i.e.
does not contain a dollar sign, nor is quoted in any way. Nor
does it consist of all digits. If CHECK_WORD is non-zero,
does not contain a dollar sign, nor is quoted in any way.
If CHECK_WORD is non-zero,
the word is checked to ensure that it consists of only letters,
digits, and underscores. */
digits, and underscores, and does not consist of all digits. */
int
check_identifier (word, check_word)
WORD_DESC *word;
int check_word;
{
if ((word->flags & (W_HASDOLLAR|W_QUOTED)) || all_digits (word->word))
if (word->flags & (W_HASDOLLAR|W_QUOTED)) /* XXX - HASDOLLAR? */
{
internal_error (_("`%s': not a valid identifier"), word->word);
return (0);
}
else if (check_word && legal_identifier (word->word) == 0)
else if (check_word && (all_digits (word->word) || legal_identifier (word->word) == 0))
{
internal_error (_("`%s': not a valid identifier"), word->word);
return (0);
+2 -2
View File
@@ -2044,7 +2044,7 @@ The @option{-E} option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options and actions should
apply to completion on the inital non-assignment word on the line, or after a
apply to completion on the initial non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
If multiple options are supplied, the @option{-D} option takes precedence
@@ -2255,7 +2255,7 @@ The @option{-E} option indicates that other supplied options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options should
apply to completion on the inital non-assignment word on the line, or after a
apply to completion on the initial non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
+9
View File
@@ -2260,6 +2260,8 @@ static struct dstack temp_dstack = { (char *)NULL, 0, 0 };
shell_ungetc when we're at the start of a line. */
static int eol_ungetc_lookahead = 0;
static int unquoted_backslash = 0;
static int
shell_getc (remove_quoted_newline)
int remove_quoted_newline;
@@ -2525,10 +2527,16 @@ shell_getc (remove_quoted_newline)
}
next_alias_char:
if (shell_input_line_index == 0)
unquoted_backslash = 0;
uc = shell_input_line[shell_input_line_index];
if (uc)
{
unquoted_backslash = unquoted_backslash == 0 && uc == '\\';
shell_input_line_index++;
}
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
/* If UC is NULL, we have reached the end of the current input string. If
@@ -2561,6 +2569,7 @@ next_alias_char:
shell_input_line_index > 0 &&
shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
shell_input_line[shell_input_line_index-1] != '\n' &&
unquoted_backslash == 0 &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
+1 -1
View File
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 0
#define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
+3
View File
@@ -31,3 +31,6 @@ a a b
ok 3
ok 4
bar
bad
0
<|cat>
+10
View File
@@ -75,3 +75,13 @@ alias foo="\
"
foo
alias foo=$'echo bad \t'
foo
# this should probably just echo a blank line to stdout
alias foo='echo 0'
foo>&2
alias a='printf "<%s>\n" \'
a|cat