]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
fix for adding here-documents to history; change to checking for custom LS_COLORS...
authorChet Ramey <chet.ramey@case.edu>
Thu, 9 Dec 2021 20:31:21 +0000 (15:31 -0500)
committerChet Ramey <chet.ramey@case.edu>
Thu, 9 Dec 2021 20:31:21 +0000 (15:31 -0500)
CWRU/CWRU.chlog
bashhist.c
compatibility-level [deleted file]
lib/readline/colors.c
parse.y

index 39a2af9707f4686586f889f673740653d0ca6776..821e85c03a4065da43836b25e36f0538b2fece56 100644 (file)
@@ -2607,3 +2607,18 @@ COMPAT,doc/bashref.texi
 lib/malloc/malloc.c
        - mremap: only use if MREMAP_MAYMOVE is defined, since we use the Linux
          version of the function signature
+
+                                  12/6
+                                  ----
+bashhist.c
+       - bash_add_history: if we're parsing a here-document (PST_HEREDOC), only
+         suppress adding the newline between lines if we're not at the first
+         line of the here-document (here_doc_first_line!= 0). From a report
+         by S0AndS0 <strangerthanbland@gmail.com>
+
+                                  12/8
+                                  ----
+lib/readline/colors.c
+       - _rl_custom_readline_prefix: use STREQN to check for the extension
+         string in $LS_COLORS, since it's not necessarily null-terminated.
+         From https://savannah.gnu.org/patch/?10158
index 3ad417dfde710e14713257994b346821b174caa3..90cd8c34fa8f05fff43cd9e889bd0003263a1d0c 100644 (file)
@@ -892,7 +892,7 @@ bash_add_history (line)
                (current_command_line_count > 2)
         don't add a newline here. This will also take care of the literal_history
         case if the other conditions are met. */
-      if ((parser_state & PST_HEREDOC) && current_command_line_count > 2 && line[strlen (line) - 1] == '\n')
+      if ((parser_state & PST_HEREDOC) && here_doc_first_line == 0 && line[strlen (line) - 1] == '\n')
        chars_to_add = "";
       else if (current_command_line_count == current_command_line_comment+1)
        chars_to_add = "\n";
diff --git a/compatibility-level b/compatibility-level
deleted file mode 100644 (file)
index 8edd8d4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-o The `unset' builtin will unset the array a given an argument like `a[@]'.
-  Bash-5.2 will unset an element with key `@' (associative arrays) or remove
-  all the elements without unsetting the array (indexed arrays);
-
-o arithmetic commands ( ((...)) ) and the expressions in an arithmetic for
-  statement can be expanded more than once;
-
-o expressions used as arguments to arithmetic operators in the [[ conditional
-  command can be expanded more than once;
-
-o the expressions in substring parameter brace expansion can be
-  expanded more than once;
-
-o the expressions in the $(( ... )) word expansion can be expanded
-  more than once;
-
-o arithmetic expressions used as indexed array subscripts can be
-  expanded more than once;
-
-o `test -v', when given an argument of A[@], where A is an existing
-  associative array, will return true if the array has any set elements.
-  Bash-5.2 will look for a key named `@';
-
-o the ${param[:]=value} word expansion will return VALUE, before any
-  variable-specific transformations have been performed (e.g., converting
-  to lowercase). Bash-5.2 will return the final value assigned to the
-  variable.
index f7b9dfddce38bc0834e565fc088735d15857dfb2..dba81a279ac7b5d285834f7cf7fc1e03c593450d 100644 (file)
@@ -120,7 +120,7 @@ _rl_custom_readline_prefix (void)
 
   len = strlen (RL_COLOR_PREFIX_EXTENSION);
   for (ext = _rl_color_ext_list; ext; ext = ext->next)
-    if (ext->ext.len == len && STREQ (ext->ext.string, RL_COLOR_PREFIX_EXTENSION))
+    if (ext->ext.len == len && STREQN (ext->ext.string, RL_COLOR_PREFIX_EXTENSION, len))
       return (&ext->seq);
   return (NULL);
 }
diff --git a/parse.y b/parse.y
index 990fcc4695d619a259ed35f9ec5d540ee1e7b260..fa70644d7af313f6362c70a1a050a22f681275b8 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -4064,10 +4064,13 @@ parse_comsub (qc, open, close, lenp, flags)
 
   /* Posix interp 217 says arithmetic expressions have precedence, so
      assume $(( introduces arithmetic expansion and parse accordingly. */
-  peekc = shell_getc (0);
-  shell_ungetc (peekc);
-  if (peekc == '(')
-    return (parse_matched_pair (qc, open, close, lenp, 0));
+  if (open == '(')             /*)*/
+    {
+      peekc = shell_getc (0);
+      shell_ungetc (peekc);
+      if (peekc == '(')                /*)*/
+       return (parse_matched_pair (qc, open, close, lenp, 0));
+    }
 
 /*itrace("parse_comsub: qc = `%c' open = %c close = %c", qc, open, close);*/