commit bash-20161129 snapshot

This commit is contained in:
Chet Ramey
2016-12-05 09:45:14 -05:00
parent 1975c9b5fa
commit 731e5676a2
24 changed files with 581 additions and 600 deletions
+69 -1
View File
@@ -12561,4 +12561,72 @@ subst.c
subst.c
- parameter_brace_expand_indir: if the variable is not special and
the indirect variable is unset (!variable where variable is unset),
report an error. Fixes omission reported by otenba@protonmail.com
report an error. This is a slight incompatibility with previous
versions, which did not differentiate between indirecting an unset
variable and an indirect expansion resulting in an unset variable.
Fixes omission reported by otenba@protonmail.com
11/30
-----
lib/readline/doc/{rluser.texi,readline.3},doc/bash.1
- do-uppercase-version: since this doesn't actually exist, replace it
with do-lowercase-version, with the caveat that do-lowercase-version
results in undefined behavior if bound to a character that's
already lowercase. Suggested by Branden Robinson
<g.branden.robinson@gmail.com>
lib/readline/doc/rluser.texi
- history-substring-search-forward: was misspelled as "substr-search";
ditto for search-backward
doc/bash.1
- history-substring-search-{backward,forward}: add documentation, text
straight from readline.3
jobs.c
- initialize_job_control: if the terminal's process group is valid,
but the shell is not the foreground process, check for terminating
signals (like SIGHUP, which the kernel would send if the process
group were orphaned) during the loop where we try to stop the shell
if it's not in the foreground. Not a perfect solution; the kernel
might not send SIGHUP
12/1
----
jobs.c
- initialize_job_control: only go through the SIGTTIN loop 16 times at
most before deciding we're in the background and probably a member of
an orphaned process group; set original_pgrp to the terminal's pgrp
(so the eventual give_terminal_to doesn't leave the terminal in the
wrong pgrp); and bail on job control initialization
tests/run-all
- unset SHELLOPTS to avoid its options `polluting' the test
environment. Suggestion from Vladimir Marek
<Vladimir.Marek@oracle.com>
tests/execscript
- use $PWD/exec8.sub to protect against someone who has a cd command
in his bashrc. Report from Vladimir Marek
<Vladimir.Marek@oracle.com>
12/2
----
shell.c
- open_shell_script: call end_job_control before exiting the shell in
case we were run as `bash -i script' and there is a problem with
executing `script'. If we don't, the terminal ends up in the wrong
process group. Fix from Clark Wang <clarkw@vmware.com>
12/3
----
parse.y
- read_comsub: if we look for a character following a `<' and it's
not `<' (indicating that we don't have to read a here-document),
make sure we push that character back and go through the loop again
so we note the right word start location. Fixes bug reported by
parasite parasite <42parasite@gmail.com>
subst.c
- parameter_brace_expand_indir: clean up checks for unset variables to
minimize incompatibilities with previous versions
+29 -15
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Tue Nov 1 16:05:17 EDT 2016
.\" Last Change: Wed Nov 30 10:05:42 PST 2016
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2016 November 1" "GNU Bash 4.4"
.TH BASH 1 "2016 November 30" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -5616,6 +5616,15 @@ can be set to either
or
.BR vi .
.TP
.B emacs\-mode\-string (@)
This string is displayed immediately before the last line of the primary
prompt when emacs editing mode is active. The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the \e1 and \e2 escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
.TP
.B enable\-bracketed\-paste (Off)
When set to \fBOn\fP, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
@@ -5685,15 +5694,6 @@ the value of
.B editing\-mode
also affects the default keymap.
.TP
.B emacs\-mode\-string (@)
This string is displayed immediately before the last line of the primary
prompt when emacs editing mode is active. The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the \e1 and \e2 escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
.TP
.B keyseq\-timeout (500)
Specifies the duration \fIreadline\fP will wait for a character when reading an
ambiguous key sequence (one that can form a complete key sequence using
@@ -6021,6 +6021,19 @@ Search backward through the history for the string of characters
between the start of the current line and the point.
This is a non-incremental search.
.TP
.B history\-substring\-search\-backward
Search backward through the history for the string of characters
between the start of the current line and the current cursor
position (the \fIpoint\fP).
The search string may match anywhere in a history line.
This is a non-incremental search.
.TP
.B history\-substring\-search\-forward
Search forward through the history for the string of characters
between the start of the current line and the point.
The search string may match anywhere in a history line.
This is a non-incremental search.
.TP
.B yank\-nth\-arg (M\-C\-y)
Insert the first argument to the previous command (usually
the second word on the previous line) at point.
@@ -6086,7 +6099,7 @@ Accept the current line for execution and fetch the next line
relative to the current line from the history for editing. Any
argument is ignored.
.TP
.B edit\-and\-execute\-command (C\-xC\-e)
.B edit\-and\-execute\-command (C\-x C\-e)
Invoke an editor on the current command line, and execute the result as shell
commands.
\fBBash\fP attempts to invoke
@@ -6401,9 +6414,10 @@ Abort the current editing command and
ring the terminal's bell (subject to the setting of
.BR bell\-style ).
.TP
.B do\-uppercase\-version (M\-a, M\-b, M\-\fIx\fP, ...)
If the metafied character \fIx\fP is lowercase, run the command
that is bound to the corresponding uppercase character.
.B do\-lowercase\-version (M\-A, M\-B, M\-\fIx\fP, ...)
If the metafied character \fIx\fP is uppercase, run the command
that is bound to the corresponding metafied lowercase character.
The behavior is undefined if \fIx\fP is already lowercase.
.TP
.B prefix\-meta (ESC)
Metafy the next character typed.
+2 -2
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2016 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Tue Nov 1 16:08:43 EDT 2016
@set LASTCHANGE Wed Nov 30 10:06:51 PST 2016
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 1 November 2016
@set UPDATED 30 November 2016
@set UPDATED-MONTH November 2016
+13 -9
View File
@@ -217,14 +217,6 @@ pid_t pipeline_pgrp = (pid_t)0;
int pgrp_pipe[2] = { -1, -1 };
#endif
#if 0
/* The job which is current; i.e. the one that `%+' stands for. */
int current_job = NO_JOB;
/* The previous job; i.e. the one that `%-' stands for. */
int previous_job = NO_JOB;
#endif
/* Last child made by the shell. */
volatile pid_t last_made_pid = NO_PID;
@@ -251,6 +243,8 @@ PROCESS *last_procsub_child = (PROCESS *)NULL;
/* Functions local to this file. */
void debug_print_pgrps (void);
static sighandler wait_sigint_handler __P((int));
static sighandler sigchld_handler __P((int));
static sighandler sigcont_sighandler __P((int));
@@ -4074,7 +4068,7 @@ initialize_job_control (force)
int force;
{
pid_t t;
int t_errno;
int t_errno, tty_sigs;
t_errno = -1;
shell_pgrp = getpgid (0);
@@ -4124,15 +4118,24 @@ initialize_job_control (force)
tcsetpgrp (shell_tty, shell_pgrp);
}
tty_sigs = 0;
while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1)
{
if (shell_pgrp != terminal_pgrp)
{
SigHandler *ottin;
CHECK_TERMSIG;
ottin = set_signal_handler (SIGTTIN, SIG_DFL);
kill (0, SIGTTIN);
set_signal_handler (SIGTTIN, ottin);
if (tty_sigs++ > 16)
{
sys_error (_("initialize_job_control: no job control in background"));
job_control = 0;
original_pgrp = terminal_pgrp; /* for eventual give_terminal_to */
goto just_bail;
}
continue;
}
break;
@@ -4192,6 +4195,7 @@ initialize_job_control (force)
internal_error (_("no job control in this shell"));
}
just_bail:
running_in_background = terminal_pgrp != shell_pgrp;
if (shell_tty != fileno (stderr))
+15 -14
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Sun Feb 28 15:42:34 EST 2016
.\" Last Change: Wed Nov 30 10:06:13 PST 2016
.\"
.TH READLINE 3 "2016 February 28" "GNU Readline 7.0"
.TH READLINE 3 "2016 November 30" "GNU Readline 7.0"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -438,6 +438,15 @@ can be set to either
or
.BR vi .
.TP
.B emacs\-mode\-string (@)
This string is displayed immediately before the last line of the primary
prompt when emacs editing mode is active. The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the \e1 and \e2 escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
.TP
.B enable\-bracketed\-paste (Off)
When set to \fBOn\fP, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
@@ -506,15 +515,6 @@ The value of
.B editing\-mode
also affects the default keymap.
.TP
.B emacs\-mode\-string (@)
This string is displayed immediately before the last line of the primary
prompt when emacs editing mode is active. The value is expanded like a
key binding, so the standard set of meta- and control prefixes and
backslash escape sequences is available.
Use the \e1 and \e2 escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
.TP
.B keyseq\-timeout (500)
Specifies the duration \fIreadline\fP will wait for a character when reading an
ambiguous key sequence (one that can form a complete key sequence using
@@ -1120,9 +1120,10 @@ Abort the current editing command and
ring the terminal's bell (subject to the setting of
.BR bell\-style ).
.TP
.B do\-uppercase\-version (M\-a, M\-b, M\-\fIx\fP, ...)
If the metafied character \fIx\fP is lowercase, run the command
that is bound to the corresponding uppercase character.
.B do\-lowercase\-version (M\-A, M\-B, M\-\fIx\fP, ...)
If the metafied character \fIx\fP is uppercase, run the command
that is bound to the corresponding metafied lowercase character.
The behavior is undefined if \fIx\fP is already lowercase.
.TP
.B prefix\-meta (ESC)
Metafy the next character typed.
+7 -6
View File
@@ -1216,14 +1216,14 @@ The search string must match at the beginning of a history line.
This is a non-incremental search.
By default, this command is unbound.
@item history-substr-search-forward ()
@item history-substring-search-forward ()
Search forward through the history for the string of characters
between the start of the current line and the point.
The search string may match anywhere in a history line.
This is a non-incremental search.
By default, this command is unbound.
@item history-substr-search-backward ()
@item history-substring-search-backward ()
Search backward through the history for the string of characters
between the start of the current line and the point.
The search string may match anywhere in a history line.
@@ -1590,9 +1590,10 @@ Abort the current editing command and
ring the terminal's bell (subject to the setting of
@code{bell-style}).
@item do-uppercase-version (M-a, M-b, M-@var{x}, @dots{})
If the metafied character @var{x} is lowercase, run the command
that is bound to the corresponding uppercase character.
@item do-lowercase-version (M-A, M-B, M-@var{x}, @dots{})
If the metafied character @var{x} is upper case, run the command
that is bound to the corresponding metafied lower case character.
The behavior is undefined if @var{x} is already lower case.
@item prefix-meta (@key{ESC})
Metafy the next character typed. This is for keyboards
@@ -1721,7 +1722,7 @@ Accept the current line for execution and fetch the next line
relative to the current line from the history for editing. Any
argument is ignored.
@item edit-and-execute-command (C-xC-e)
@item edit-and-execute-command (C-x C-e)
Invoke an editor on the current command line, and execute the result as shell
commands.
Bash attempts to invoke
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2016 Free Software Foundation, Inc.
@set EDITION 7.0
@set VERSION 7.0
@set UPDATED 16 July 2016
@set UPDATED-MONTH July 2016
@set UPDATED 30 November 2016
@set UPDATED-MONTH November 2016
@set LASTCHANGE Sat Jul 16 13:43:15 EDT 2016
@set LASTCHANGE Wed Nov 30 10:06:36 PST 2016
+4 -1
View File
@@ -4114,7 +4114,10 @@ eof_error:
continue;
}
else
ch = peekc; /* fall through and continue XXX */
{
shell_ungetc (peekc); /* not a here-doc, start over */
continue;
}
}
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
{
+384 -535
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -1504,6 +1504,9 @@ open_shell_script (script_name)
{
e = errno;
file_error (filename);
#if defined (JOB_CONTROL)
end_job_control (); /* just in case we were run as bash -i script */
#endif
sh_exit ((e == ENOENT) ? EX_NOTFOUND : EX_NOINPUT);
}
@@ -1523,6 +1526,9 @@ open_shell_script (script_name)
errno = EINVAL;
#endif
file_error (filename);
#if defined (JOB_CONTROL)
end_job_control (); /* just in case we were run as bash -i script */
#endif
sh_exit (EX_NOINPUT);
}
@@ -1571,11 +1577,17 @@ open_shell_script (script_name)
errno = e;
file_error (filename);
}
#if defined (JOB_CONTROL)
end_job_control (); /* just in case we were run as bash -i script */
#endif
exit (EX_NOEXEC);
}
else if (sample_len > 0 && (check_binary_file (sample, sample_len)))
{
internal_error (_("%s: cannot execute binary file"), filename);
#if defined (JOB_CONTROL)
end_job_control (); /* just in case we were run as bash -i script */
#endif
exit (EX_BINARY_FILE);
}
/* Now rewind the file back to the beginning. */
+26 -2
View File
@@ -223,7 +223,7 @@ static WORD_LIST *cached_quoted_dollar_at = 0;
static WORD_LIST expand_word_error, expand_word_fatal;
static WORD_DESC expand_wdesc_error, expand_wdesc_fatal;
static char expand_param_error, expand_param_fatal;
static char expand_param_error, expand_param_fatal, expand_param_unset;
static char extract_string_error, extract_string_fatal;
/* Set by expand_word_unsplit; used to inhibit splitting and re-joining
@@ -6752,7 +6752,11 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
}
}
if (var_is_special == 0 && v == 0)
/* An indirect reference to a positional parameter or a special parameter
is ok. Indirect references to array references, as explained above, are
ok (currently). Only references to unset variables are errors at this
point. */
if (legal_identifier (name) && v == 0)
{
report_error (_("%s: invalid indirect expansion"), name);
w = alloc_word_desc ();
@@ -6764,6 +6768,25 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
t = parameter_brace_find_indir (name, var_is_special, quoted, 0);
chk_atstar (t, quoted, quoted_dollar_atp, contains_dollar_at);
#if defined (ARRAY_VARS)
/* Array references to unset variables are also an error */
if (t == 0 && valid_array_reference (name, 0))
{
v = array_variable_part (name, 0, (int *)0, (int *)0);
if (v == 0)
{
report_error (_("%s: invalid indirect expansion"), name);
w = alloc_word_desc ();
w->word = &expand_param_error;
w->flags = 0;
return (w);
}
else
return (WORD_DESC *)NULL;
}
#endif
if (t == 0)
return (WORD_DESC *)NULL;
@@ -8311,6 +8334,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
temp = (char *)NULL;
goto bad_substitution;
}
/* Turn off the W_ARRAYIND flag because there is no way for this function
to return the index we're supposed to be using. */
if (tdesc && tdesc->flags)
+1
View File
@@ -50,6 +50,7 @@
#define ASS_MKGLOBAL 0x0008 /* force global assignment */
#define ASS_NAMEREF 0x0010 /* assigning to nameref variable */
#define ASS_FORCE 0x0020 /* force assignment even to readonly variable */
#define ASS_CHKLOCAL 0x0040 /* check local variable before assignment */
/* Flags for the string extraction functions. */
#define SX_NOALLOC 0x0001 /* just skip; don't return substring */
+1
View File
@@ -1,3 +1,4 @@
: ${HOME:=/}
# works right
echo ab$(echo mnop)yz
+3 -3
View File
@@ -3,6 +3,6 @@ qpath='\/tmp\/foo\/bar'
echo "$qpath"
# it's crazy that all three of these produce the same result
echo ${qpath//\\/}
echo ${qpath//"`echo \\`"/}
echo ${qpath//`echo "\\\\\\\\"`/}
printf "%s\n" ${qpath//\\/}
printf "%s\n" ${qpath//"`echo \\`"/}
printf "%s\n" ${qpath//`echo "\\\\\\\\"`/}
+2 -2
View File
@@ -128,9 +128,9 @@ after 3: 1
array after 1: 1
array after 2: 1
./errors6.sub: line 18: ${-3}: bad substitution
./errors6.sub: line 19: -3: bad substitution
./errors6.sub: line 19: -3: invalid variable name
after indir: 1
./errors6.sub: line 18: ${-3}: bad substitution
./errors6.sub: line 19: -3: bad substitution
./errors6.sub: line 19: -3: invalid variable name
after indir: 1
./errors.tests: line 278: `!!': not a valid identifier
+1 -1
View File
@@ -108,7 +108,7 @@ ${THIS_SH} ./exec6.sub
# checks for properly deciding what constitutes an executable file
${THIS_SH} ./exec7.sub
${THIS_SH} -i ./exec8.sub
${THIS_SH} -i ${PWD}/exec8.sub
${THIS_SH} ./exec9.sub
+1 -1
View File
@@ -226,7 +226,7 @@ declare -- var="x\001y\177z"$
argv[1] = <$'x\001y\177z'>
argv[1] = <x^Ay^?z>
var=$'x\001y\177z'
./exp8.sub: line 16: xyz: syntax error: invalid arithmetic operator (error token is "z")
./exp8.sub: line 18: xyz: syntax error: invalid arithmetic operator (error token is "z")
declare -a array=()
declare -a array=([0]=$'x\001y\177z')
argv[1] = <x^Ay^?z>
+1
View File
@@ -1,4 +1,5 @@
# expansions involving patterns
shopt -u xpg_echo
var='[hello'
echo "${var//[/}"
+2
View File
@@ -1,3 +1,5 @@
shopt -u xpg_echo
var=$'x\001y\177z'
recho "$var"
+1 -1
View File
@@ -70,7 +70,7 @@ cat <<END
hello
\END
END
echo end 'hello<NL>\END'
echo -E end 'hello<NL>\END'
# gprof
if [ -n "$GMON_OUT_PREFIX" ]; then
+1 -1
View File
@@ -48,7 +48,7 @@ argv[1] = <unset>
expect <bar>
argv[1] = <bar>
expect <unset>
argv[1] = <unset>
./nameref3.sub: line 16: foo: invalid indirect expansion
./nameref3.sub: line 21: unset: bar: cannot unset: readonly variable
expect <two>
two
+1 -1
View File
@@ -1,6 +1,6 @@
# From mksh
set -o posix
set -o posix ; shopt -u xpg_echo
(echo 1 ${IFS+'}'z}) 2>&- || echo failed in 1
(echo 2 "${IFS+'}'z}") 2>&- || echo failed in 2
+1 -1
View File
@@ -14,7 +14,7 @@ echo "'${test//"'"/}'"
echo "'${test//"'"/"'\\''"}'"
echo "'${test//"'"/\'\\'\'}'"
printf "%s\n" "'${test//"'"/\'\\'\'}'"
#echo "'${test//'/}'" # hangs waiting for '
#echo "'${test//"'"/'\\''}'" # hangs waiting for '
+1 -1
View File
@@ -17,7 +17,7 @@ export PATH
# unset BASH_ENV only if it is set
[ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV
# ditto for SHELLOPTS
#[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS
[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS
: ${THIS_SH:=../bash}
export THIS_SH