]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20190118 snapshot
authorChet Ramey <chet.ramey@case.edu>
Tue, 22 Jan 2019 13:40:19 +0000 (08:40 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 22 Jan 2019 13:40:19 +0000 (08:40 -0500)
CWRU/CWRU.chlog
bashline.c
doc/bash.1
doc/bashref.texi
general.c
lib/readline/doc/rluser.texi
parse.y
patchlevel.h
tests/alias.right
tests/alias4.sub

index e972bf4ede598f286d5605db1e2fd0dfe786a7bb..386e558cf5b42624596a18f30b3abadaa323dbbc 100644 (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>
index ff79b7048d80bd761fef9c1df6d0ce1ffd9e796b..f5d90a5160686982bc0ed58275e2b52e4ffbc1d6 100644 (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;
index e6cd08db3867a8e0c166b44c91c1a6c078d5154f..825fb3096fa6202ef47070e17cc885cb48ce4591 100644 (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
index d33cd57104710da586f5167c3e0baf38f4be3548..fc0229737a5a6152c87564d54be7ca5f889a0d41 100644 (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)
index 9542963aa2d04f9f2465da119c89e8dfb526c80e..2a6edc1c951bebed70f2709197aaaf79e952a49d 100644 (file)
--- a/general.c
+++ b/general.c
@@ -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);
index a59bd144633f9707506b822828d070575607c719..9b025e4711d1d6a118ae1c5da0db6a552d39ee98 100644 (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.
 
diff --git a/parse.y b/parse.y
index 07e6e3e44a9a87c8103ad0415b1d3384ae5066e7..cb8e50084744a50e07b775ca970b6e6ba1eda336 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -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) != '"'))
     {
index 1cd7c96c7bf94ae7242e8af39fce6b1c82d94b20..a988d852644985230969d343fdc0c88a3626f7a4 100644 (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_ */
index 398c69e650c5f91416058fa55bebbf5dfa535b78..29eb90daa63b77abadab4f66bc9db28f208ceb94 100644 (file)
@@ -31,3 +31,6 @@ a a b
 ok 3
 ok 4
 bar
+bad
+0
+<|cat>
index b205fee753a26f677e09a9c276790a1c3f569a7d..a82f151f40a7550a3dbb7143df52001a97f532e6 100644 (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