fix for adding here-documents to history; change to checking for custom LS_COLORS prefix

This commit is contained in:
Chet Ramey
2021-12-09 15:31:21 -05:00
parent 71a11dbeb4
commit e93bed95a8
5 changed files with 24 additions and 33 deletions
+15
View 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
+1 -1
View 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";
-27
View File
@@ -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.
+1 -1
View 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);
}
+7 -4
View File
@@ -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);*/