commit bash-20191115 snapshot

This commit is contained in:
Chet Ramey
2019-11-18 10:16:09 -05:00
parent 5e061bb08b
commit dfc7113bf2
9 changed files with 5633 additions and 5553 deletions
+27
View File
@@ -6837,3 +6837,30 @@ lib/sh/unicode.c
- u32toutf8: fix a typo that assigned the wrong value to the first
byte of a six-byte UTF-8 character. Report and fix from
Istv谩n P谩sztor <pasztorpisti@gmail.com>
11/15
-----
doc/bash.1,lib/readline/doc/{history.3,hsuser.texi}
- quick substitution: make it clear that ^s1^s2^ is equivalent to
!!:s^s1^s2^, since that's the internal transformation we perform.
Reported by Jim Monte <jim.monte01@gmail.com>
- note that the `q' and `x' modifiers are mutually exclusive; last
one wins. Reported by Jim Monte <jim.monte01@gmail.com>
- note that the `G' modifier can work with `&' as well as `s'.
Reported by Jim Monte <jim.monte01@gmail.com>
- note that a word designator of `-' is equivalent to `0-'.
Reported by Jim Monte <jim.monte01@gmail.com>
lib/readline/histexpand.c
- history_expand_internal: make multiple :p modifiers work to suppress
execution. Reported by Jim Monte <jim.monte01@gmail.com>
- get_history_word_specifier: fix so a `^' word designator works as
the second part of a range.
Reported by Jim Monte <jim.monte01@gmail.com>
- hist_error: make sure we don't blindly copy a null character into
the error string (e.g., if there is a missing word designator
following `:'). Reported by Jim Monte <jim.monte01@gmail.com>
- get_history_event: if the history event specifier (!) is followed
immediately by a `-' and a non-digit (e.g. !-a), make sure the - is
treated as part of a search string instead of making it an offset of
0. Reported by Jim Monte <jim.monte01@gmail.com>
+19 -9
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Wed Oct 30 16:58:09 EDT 2019
.\" Last Change: Fri Nov 15 09:39:07 EST 2019
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2019 October 30" "GNU Bash 5.0"
.TH BASH 1 "2019 November 15" "GNU Bash 5.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -7192,6 +7192,8 @@ history list containing
The trailing \fB?\fP may be omitted if
.I string
is followed immediately by a newline.
If \fIstring\fP is missing, the string from the most recent search is used;
it is an error if there is no previous search string.
.TP
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
Quick substitution. Repeat the previous command, replacing
@@ -7199,7 +7201,7 @@ Quick substitution. Repeat the previous command, replacing
with
.IR string2 .
Equivalent to
``!!:s/\fIstring1\fP/\fIstring2\fP/''
``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u''
(see \fBModifiers\fP below).
.TP
.B !#
@@ -7239,7 +7241,8 @@ The last word. This is usually the last argument, but will expand to the
zeroth word if there is only one word in the line.
.TP
.B %
The word matched by the most recent `?\fIstring\fR?' search.
The first word matched by the most recent `?\fIstring\fR?' search,
if the search string begins with a character that is part of a word.
.TP
.I x\fB\-\fPy
A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
@@ -7256,6 +7259,7 @@ Abbreviates \fIx\-$\fP.
.TP
.B x\-
Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
If \fBx\fP is missing, it defaults to 0.
.PD
.PP
If a word designator is supplied without an event specification, the
@@ -7293,15 +7297,19 @@ Quote the substituted words as with
but break into words at
.B blanks
and newlines.
The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one
supplied is used.
.TP
.B s/\fIold\fP/\fInew\fP/
Substitute
.I new
for the first occurrence of
.I old
in the event line. Any delimiter can be used in place of /. The
final delimiter is optional if it is the last character of the
event line. The delimiter may be quoted in
in the event line.
Any character may be used as the delimiter in place of /.
The final delimiter is optional if it is the last character of the
event line.
The delimiter may be quoted in
.I old
and
.I new
@@ -7309,7 +7317,8 @@ with a single backslash. If & appears in
.IR new ,
it is replaced by
.IR old .
A single backslash will quote the &. If
A single backslash will quote the &.
If
.I old
is null, it is set to the last
.I old
@@ -7333,7 +7342,8 @@ if it is the last character of the event line.
An \fBa\fP may be used as a synonym for \fBg\fP.
.TP
.B G
Apply the following `\fBs\fP' modifier once to each word in the event line.
Apply the following `\fBs\fP' or `\fB&\fP' modifier once to each word
in the event line.
.PD
.SH "SHELL BUILTIN COMMANDS"
.\" start of bash_builtins
BIN
View File
Binary file not shown.
+5526 -5517
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2019 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Wed Oct 30 16:57:22 EDT 2019
@set LASTCHANGE Fri Nov 15 09:34:39 EST 2019
@set EDITION 5.0
@set VERSION 5.0
@set UPDATED 30 October 2019
@set UPDATED-MONTH October 2019
@set UPDATED 15 November 2019
@set UPDATED-MONTH November 2019
+19 -9
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Sun Oct 8 11:43:43 EDT 2017
.\" Last Change: Fri Nov 15 09:39:27 EST 2019
.\"
.TH HISTORY 3 "2017 October 8" "GNU History 6.3"
.TH HISTORY 3 "2019 November 15" "GNU History 8.0"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -118,6 +118,8 @@ containing
The trailing \fB?\fP may be omitted if
.I string
is followed immediately by a newline.
If \fIstring\fP is missing, the string from the most recent search is used;
it is an error if there is no previous search string.
.TP
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
Quick substitution. Repeat the last command, replacing
@@ -125,7 +127,7 @@ Quick substitution. Repeat the last command, replacing
with
.IR string2 .
Equivalent to
``!!:s/\fIstring1\fP/\fIstring2\fP/''
``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u''
(see \fBModifiers\fP below).
.TP
.B !#
@@ -165,7 +167,8 @@ The last word. This is usually the last argument, but will expand to the
zeroth word if there is only one word in the line.
.TP
.B %
The word matched by the most recent `?\fIstring\fR?' search.
The first word matched by the most recent `?\fIstring\fR?' search,
if the search string begins with a character that is part of a word.
.TP
.I x\fB\-\fPy
A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
@@ -182,6 +185,7 @@ Abbreviates \fIx\-$\fP.
.TP
.B x\-
Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
If \fBx\fP is missing, it defaults to 0.
.PD
.PP
If a word designator is supplied without an event specification, the
@@ -219,15 +223,19 @@ Quote the substituted words as with
but break into words at
.B blanks
and newlines.
The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one
supplied is used.
.TP
.B s/\fIold\fP/\fInew\fP/
Substitute
.I new
for the first occurrence of
.I old
in the event line. Any delimiter can be used in place of /. The
final delimiter is optional if it is the last character of the
event line. The delimiter may be quoted in
in the event line.
Any character may be used as the delimiter in place of /.
The final delimiter is optional if it is the last character of the
event line.
The delimiter may be quoted in
.I old
and
.I new
@@ -235,7 +243,8 @@ with a single backslash. If & appears in
.IR new ,
it is replaced by
.IR old .
A single backslash will quote the &. If
A single backslash will quote the &.
If
.I old
is null, it is set to the last
.I old
@@ -259,7 +268,8 @@ if it is the last character of the event line.
An \fBa\fP may be used as a synonym for \fBg\fP.
.TP
.B G
Apply the following `\fBs\fP' modifier once to each word in the event line.
Apply the following `\fBs\fP' or `\fB&\fP' modifier once to each word
in the event line.
.PD
.SH "PROGRAMMING WITH HISTORY FUNCTIONS"
This section describes how to use the History library in other programs.
+19 -5
View File
@@ -370,11 +370,13 @@ containing @var{string}.
The trailing
@samp{?} may be omitted if the @var{string} is followed immediately by
a newline.
If @var{string} is missing, the string from the most recent search is used;
it is an error if there is no previous search string.
@item @code{^@var{string1}^@var{string2}^}
Quick Substitution. Repeat the last command, replacing @var{string1}
with @var{string2}. Equivalent to
@code{!!:s/@var{string1}/@var{string2}/}.
@code{!!:s^@var{string1}^@var{string2}^}.
@item @code{!#}
The entire command line typed so far.
@@ -426,7 +428,8 @@ The first argument; that is, word 1.
The last argument.
@item %
The word matched by the most recent @samp{?@var{string}?} search.
The first word matched by the most recent @samp{?@var{string}?} search,
if the search string begins with a character that is part of a word.
@item @var{x}-@var{y}
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
@@ -441,6 +444,7 @@ Abbreviates @samp{@var{x}-$}
@item @var{x}-
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
If @samp{x} is missing, it defaults to 0.
@end table
@@ -478,15 +482,24 @@ Quote the substituted words, escaping further substitutions.
@item x
Quote the substituted words as with @samp{q},
but break into words at spaces, tabs, and newlines.
The @samp{q} and @samp{x} modifiers are mutually exclusive; the last one
supplied is used.
@end ifset
@item s/@var{old}/@var{new}/
Substitute @var{new} for the first occurrence of @var{old} in the
event line. Any delimiter may be used in place of @samp{/}.
event line.
Any character may be used as the delimiter in place of @samp{/}.
The delimiter may be quoted in @var{old} and @var{new}
with a single backslash. If @samp{&} appears in @var{new},
it is replaced by @var{old}. A single backslash will quote
the @samp{&}. The final delimiter is optional if it is the last
the @samp{&}.
If @var{old} is null, it is set to the last @var{old}
substituted, or, if no previous history substitutions took place,
the last @var{string}
in a !?@var{string}@code[?]}
search.
The final delimiter is optional if it is the last
character on the input line.
@item &
@@ -499,6 +512,7 @@ conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
or with @samp{&}.
@item G
Apply the following @samp{s} modifier once to each word in the event.
Apply the following @samp{s} or @samp{&} modifier once to each word
in the event.
@end table
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2019 Free Software Foundation, Inc.
@set EDITION 8.0
@set VERSION 8.0
@set UPDATED 6 March 2019
@set UPDATED-MONTH March 2019
@set UPDATED 15 November 2019
@set UPDATED-MONTH November 2019
@set LASTCHANGE Wed Mar 6 09:51:02 EST 2019
@set LASTCHANGE Fri Nov 15 09:34:19 EST 2019
+17 -7
View File
@@ -180,7 +180,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
}
/* Hack case of numeric line specification. */
if (string[i] == '-')
if (string[i] == '-' && _rl_digit_p (string[i+1]))
{
sign = -1;
i++;
@@ -230,10 +230,12 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
}
#endif /* HANDLE_MULTIBYTE */
if ((!substring_okay && (whitespace (c) || c == ':' ||
(history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
(history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
string[i] == delimiting_quote)) ||
if ((!substring_okay &&
(whitespace (c) || c == ':' ||
(i > local_index && history_event_delimiter_chars && c == '-') ||
(c != '-' && history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
(history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
string[i] == delimiting_quote)) ||
string[i] == '\n' ||
(substring_okay && string[i] == '?'))
break;
@@ -409,7 +411,10 @@ hist_error(char *s, int start, int current, int errtype)
}
temp = (char *)xmalloc (ll + elen + 3);
strncpy (temp, s + start, ll);
if (s[start])
strncpy (temp, s + start, ll);
else
ll = 0;
temp[ll] = ':';
temp[ll + 1] = ' ';
strcpy (temp + ll + 2, emsg);
@@ -624,7 +629,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
return an error state after adding this line to the
history. */
case 'p':
print_only++;
print_only = 1;
break;
/* :t discards all but the last part of the pathname. */
@@ -1356,6 +1361,11 @@ get_history_word_specifier (char *spec, char *from, int *caller_index)
i++;
last = '$';
}
else if (spec[i] == '^')
{
i++;
last = 1;
}
#if 0
else if (!spec[i] || spec[i] == ':')
/* check against `:' because there could be a modifier separator */