commit bash-20160805 snapshot

This commit is contained in:
Chet Ramey
2016-08-08 15:57:30 -04:00
parent 13eae87b0c
commit ec69166705
13 changed files with 347 additions and 27 deletions
+47
View File
@@ -1,3 +1,50 @@
This document details the changes between this version, bash-4.4-rc2, and
the previous version, bash-4.4-beta2.
1. Changes to Bash
a. Fixed an out-of-bounds read in the redirection operator completion code.
b. Fixed execution context so `until continue' doesn't disable execution for
subsequent commands.
c. Fixed trap handling code so traps don't inherit a command's temporary
environment.
d. Fixed a bug that resulted in incorrect line numbers when a function is defined
as part of another function's execution.
e. Fixed a bug in the expansion of ${a[@]} in contexts where word splitting is not
performed and $IFS is not the default.
f. Fixed a bug that caused ''"$@" to not expand to an empty argument when there are
no positional parameters.
g. Fixed a bug that caused a shell compiled without job control to use the incorrect
exit status for builtin commands preceded by a command executed from the file
system that causes the shell to call waitpid().
2. Changes to Readline
a. Fixed a bug that caused mode strings to be displayed incorrectly if the prompt was
shorter than the mode string.
3. New Features in Bash
a. Using ${a[@]} or ${a[*]} with an array without any assigned elements when
the nounset option is enabled no longer throws an unbound variable error.
4. New Features in Readline
a. New application-callable function: rl_pending_signal(): returns the signal
number of any signal readline has caught but not yet handled.
b. New application-settable variable: rl_persistent_signal_handlers: if set to a
non-zero value, readline will enable the readline-6.2 signal handler behavior
in callback mode: handlers are installed when rl_callback_handler_install is
called and removed removed when a complete line has been read.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-beta2, and
the previous version, bash-4.4-rc1.
+173
View File
@@ -1,3 +1,176 @@
This document details the changes between this version, bash-4.4-rc2, and
the previous version, bash-4.4-beta2.
1. Changes to Bash
a. Fixed an out-of-bounds read in the redirection operator completion code.
b. Fixed execution context so `until continue' doesn't disable execution for
subsequent commands.
c. Fixed trap handling code so traps don't inherit a command's temporary
environment.
d. Fixed a bug that resulted in incorrect line numbers when a function is defined
as part of another function's execution.
e. Fixed a bug in the expansion of ${a[@]} in contexts where word splitting is not
performed and $IFS is not the default.
f. Fixed a bug that caused ''"$@" to not expand to an empty argument when there are
no positional parameters.
g. Fixed a bug that caused a shell compiled without job control to use the incorrect
exit status for builtin commands preceded by a command executed from the file
system that causes the shell to call waitpid().
2. Changes to Readline
a. Fixed a bug that caused mode strings to be displayed incorrectly if the prompt was
shorter than the mode string.
3. New Features in Bash
a. Using ${a[@]} or ${a[*]} with an array without any assigned elements when
the nounset option is enabled no longer throws an unbound variable error.
4. New Features in Readline
a. New application-callable function: rl_pending_signal(): returns the signal
number of any signal readline has caught but not yet handled.
b. New application-settable variable: rl_persistent_signal_handlers: if set to a
non-zero value, readline will enable the readline-6.2 signal handler behavior
in callback mode: handlers are installed when rl_callback_handler_install is
called and removed removed when a complete line has been read.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-beta2, and
the previous version, bash-4.4-rc1.
1. Changes to Bash
a. Fixed a memory leak when processing ${!var[@]}.
b. Fixed a bug that caused subshells to free trap strings associated with
inherited signals.
c. Inheriting BASHOPTS from the environment now works to force actions
associated with enabling an option, instead of just marking the option
as enabled.
d. Fixed a bug that allowed assignments to BASH_CMDS when the shell was in
restricted mode.
e. Fixed a bug caused by an accidental omission of part of the original patch
for EXECIGNORE.
e. Prompt expansion now quotes the results of the \s, \h, and \H expansions.
f. Fixed a bug that caused parsing errors in command substitutions with
consecutive case statements separated by newlines.
g. Updated logic used to decide whether bash is running inside an emacs
terminal emulator to work with future emacs versions.
h. Fixed two extended pattern matching bugs caused by premature short-
circuiting.
i. Fixed a memory leak in the code that removes duplicate history entries.
j. There are a number of bug fixes to coproc, mapfile, declare, unset,
and assignment statements that prevent nameref variables from creating
and unsetting variables with invalid names.
k. Fixed a bug that caused variables to be inadvertently marked as both an
associative and an indexed array.
l. Fixed a bug that caused `bash -c' to not run a trap specified in the
command string.
j. There are a number of bug fixes to coproc, mapfile, declare, and assignment
statements that prevent nameref variables from overwriting or modifying
attributes of readonly variables.
k. Fixed a bug that caused command substitution to attempt to set the
terminal's process group incorrectly.
l. Fixed a bug that could cause prompt string expansion to display error
messages when the `nounset' shell option is set.
m. Fixed a bug that caused "$@" to not expand to an empty string under the
circumstances when Posix says it should ("${@-${@-$@}}").
n. Fixed several bugs caused by referencing nameref variables whose values
are names of unset variables (or names that are valid for referencing
but not assignment), including creating variables in the temporary
environment.
o. Function tracing and error tracing are disabled if --debugger is supplied
at startup but the shell can't find the debugger start file.
p. Fixed a bug when IFS is used as the control variable in a for statement.
q. Fixed a bug with SIGINT received by a command substitution in an interactive
shell.
r. The checks for nameref variable self-references are more thorough.
s. Fixed several bugs with multi-line aliases.
t. Fixed `test' to handle the four-argument case where $1 == '(' and
$4 == ')'.
u. Fixed a bug in the expansion of $* in the cases where word splitting is
not performed.
v. Fixed a bug in execution of case statements where IFS includes the
pattern matching characters.
2. Changes to Readline
a. When refreshing the line as the result of a key sequence, Readline attempts
to redraw only the last line of a multiline prompt.
b. Fixed an issue that caused completion of git commands to display
incorrectly when using colored-completion-prefix.
c. Fixed several redisplay bugs having to do with multibyte characters and
invisible characters in prompt strings.
3. New Features in Bash
a. Value conversions (arithmetic expansions, case modification, etc.) now
happen when assigning elements of an array using compound assignment.
b. There is a new option settable in config-top.h that makes multiple
directory arguments to `cd' a fatal error.
c. Bash now uses mktemp() when creating internal temporary files; it produces
a warning at build time on many Linux systems.
4. New Features in Readline
a. The default binding for ^W in vi mode now uses word boundaries specified
by Posix (vi-unix-word-rubout is bindable command name).
b. rl_clear_visible_line: new application-callable function; clears all
screen lines occupied by the current visible readline line.
c. rl_tty_set_echoing: application-callable function that controls whether
or not readline thinks it is echoing terminal output.
d. Handle >| and strings of digits preceding and following redirection
specifications as single tokens when tokenizing the line for history
expansion.
e. Fixed a bug with displaying completions when the prefix display length
is greater than the length of the completions to be displayed.
f. The :p history modifier now applies to the entire line, so any expansion
specifying :p causes the line to be printed instead of expanded.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-rc1, and
the previous version, bash-4.4-beta.
+55 -1
View File
@@ -10342,7 +10342,7 @@ lib/readline/bind.c
1/11
----
execute_cmd.c
subst.c
- process_substitute: when compiled without job control (JOB_CONTROL not
defined), make sure we call stop_making_children like we do in the job
control code branch, so already_making_children is reset to 0. This
@@ -11469,3 +11469,57 @@ lib/readline/display.c
use prompt_last_invisible directly. Fixes mode string redisplay issue
with short prompt strings reported by Steve Jones <sjml@slohj.org>
8/4
---
nojobs.c
- without_job_control: new function, resets child state that's eventually
used to decide whether or not to wait_for children
execute_cmd.c
- initialize_subshell: call without_job_control in both the JOB_CONTROL and
no job control paths so we can reset the state in subshells that will not
cause them to wait_for children inappropriately. Fixes bug reported by
Dan Cross <crossd@gmail.com>
8/5
---
configure.ac
- release version is now `rc2'
bashline.c
- command_word_completion_function: if direxpand is set, make sure to
run hint_text through bash_directory_completion_hook, since
readline will do that and we want to be able to match the results
readline returns. Fixes bug reported by Pat Somaru
<tuf18542@temple.edu>
command.h
- W_COMPLETE: new flag word value
- PF_COMPLETE: new flags value for param_expand
subst.h
- SX_STRIPDQ: new flag, used for string_extract_double_quoted
bashline.c
- bash_filename_stat_hook,bash_directory_completion_hook: pass W_COMPLETE
flag to expand_prompt_string
subst.c
- expand_word_internal: if W_COMPLETE in word->flags, pass PF_COMPLETE
to param_expand
- param_expand: if PF_COMPLETE in pflags, pass SX_COMPLETE to
extract_command_subst. This allows `"$(echo ~/' to perform
completion successfully
- string_extract_double_quoted: turn third argument into a flags arg,
old STRIPDQ is now set if flags&SX_STRIPDQ
- string_extract_double_quoted: changed callers, if third argument was
1, pass SX_STRIPDQ instead
- expand_word_internal: if W_COMPLETE in word->flags, pass SX_COMPLETE
in flags to string_extract_double_quoted for case '"'
- string_extract_double_quoted: if SX_COMPLETE in flags, pass it to
extract_command_subst
- expand_word_internal: if W_COMPLETE in word->flags, make sure W_COMPLETE
is in temp word passed to recursive call to expand_word_internal to
expand double-quoted string. Fixes bug reported by John Passaro
<john.a.passaro@gmail.com>
+11
View File
@@ -137,6 +137,9 @@ nn. Shells running as root no longer inherit PS4 from the environment, closing a
oo. If executing an implicit `cd' when the `autocd' option is set, bash will now
invoke a function named `cd' if one exists before executing the `cd' builtin.
pp. Using ${a[@]} or ${a[*]} with an array without any assigned elements when
the nounset option is enabled no longer throws an unbound variable error.
2. New Features in Readline
a. The history truncation code now uses the same error recovery mechansim as
@@ -181,3 +184,11 @@ k. If readline reads a history file that begins with `#' (or the value of
l. Readline now throws an error if it parses a key binding without a terminating
`:' or whitespace.
m. New application-callable function: rl_pending_signal(): returns the signal
number of any signal readline has caught but not yet handled.
n. New application-settable variable: rl_persistent_signal_handlers: if set to a
non-zero value, readline will enable the readline-6.2 signal handler behavior
in callback mode: handlers are installed when rl_callback_handler_install is
called and removed removed when a complete line has been read.
+10 -3
View File
@@ -1845,7 +1845,9 @@ command_word_completion_function (hint_text, state)
if (globpat || absolute_program (hint_text))
{
/* Perform tilde expansion on what's passed, so we don't end up
passing filenames with tildes directly to stat(). */
passing filenames with tildes directly to stat(). The rest of
the shell doesn't do variable expansion on the word following
the tilde, so we don't do it here even if direxpand is set. */
if (*hint_text == '~')
{
hint = bash_tilde_expand (hint_text, 0);
@@ -1859,6 +1861,11 @@ command_word_completion_function (hint_text, state)
directory_part = (char *)NULL;
}
}
else if (dircomplete_expand)
{
hint = savestring (hint_text);
bash_directory_completion_hook (&hint);
}
else
hint = savestring (hint_text);
@@ -3148,7 +3155,7 @@ bash_filename_stat_hook (dirname)
have to worry about restoring this setting. */
global_nounset = unbound_vars_is_error;
unbound_vars_is_error = 0;
wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB); /* does the right thing */
wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
unbound_vars_is_error = global_nounset;
if (wl)
{
@@ -3243,7 +3250,7 @@ bash_directory_completion_hook (dirname)
if (should_expand_dirname)
{
new_dirname = savestring (local_dirname);
wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB); /* does the right thing */
wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
if (wl)
{
*dirname = string_list (wl);
+3 -1
View File
@@ -1,7 +1,7 @@
/* command.h -- The structures used internally to represent commands, and
the extern declarations of the functions used to create them. */
/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
/* Copyright (C) 1993-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -100,6 +100,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
#define W_ARRAYIND 0x1000000 /* word is an array index being expanded */
#define W_ASSNGLOBAL 0x2000000 /* word is a global assignment to declare (declare/typeset -g) */
#define W_NOBRACE 0x4000000 /* Don't perform brace expansion */
#define W_COMPLETE 0x8000000 /* word is being expanded for completion */
/* Flags for the `pflags' argument to param_expand() and various
parameter_brace_expand_xxx functions; also used for string_list_dollar_at */
@@ -107,6 +108,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
#define PF_IGNUNBOUND 0x02 /* ignore unbound vars even if -u set */
#define PF_NOSPLIT2 0x04 /* same as W_NOSPLIT2 */
#define PF_ASSIGNRHS 0x08 /* same as W_ASSIGNRHS */
#define PF_COMPLETE 0x10 /* same as W_COMPLETE, sets SX_COMPLETE */
/* Possible values for subshell_environment */
#define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */
Vendored
+10 -10
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 4.4, version 4.080.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-beta2.
# Generated by GNU Autoconf 2.69 for bash 4.4-rc2.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='4.4-beta2'
PACKAGE_STRING='bash 4.4-beta2'
PACKAGE_VERSION='4.4-rc2'
PACKAGE_STRING='bash 4.4-rc2'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1393,7 +1393,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 4.4-beta2 to adapt to many kinds of systems.
\`configure' configures bash 4.4-rc2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1458,7 +1458,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 4.4-beta2:";;
short | recursive ) echo "Configuration of bash 4.4-rc2:";;
esac
cat <<\_ACEOF
@@ -1651,7 +1651,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 4.4-beta2
bash configure 4.4-rc2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2360,7 +2360,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 4.4-beta2, which was
It was created by bash $as_me 4.4-rc2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2754,7 +2754,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=4.4
RELSTATUS=beta2
RELSTATUS=rc2
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -16666,7 +16666,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 4.4-beta2, which was
This file was extended by bash $as_me 4.4-rc2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16732,7 +16732,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bash config.status 4.4-beta2
bash config.status 4.4-rc2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+1 -1
View File
@@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_REVISION([for Bash 4.4, version 4.080])dnl
define(bashvers, 4.4)
define(relstatus, beta2)
define(relstatus, rc2)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
+2 -1
View File
@@ -5384,9 +5384,10 @@ initialize_subshell ()
history_lines_this_session = 0;
#endif
#if defined (JOB_CONTROL)
/* Forget about the way job control was working. We are in a subshell. */
without_job_control ();
#if defined (JOB_CONTROL)
set_sigchld_handler ();
init_job_stats ();
#endif /* JOB_CONTROL */
+11 -2
View File
@@ -639,12 +639,13 @@ get_original_tty_job_signals ()
/* Wait for a single pid (PID) and return its exit status. Called by
the wait builtin. */
int
wait_for_single_pid (pid)
wait_for_single_pid (pid, flags)
pid_t pid;
int flags;
{
pid_t got_pid;
WAIT status;
int pstatus, flags;
int pstatus;
pstatus = find_status_by_pid (pid);
@@ -995,6 +996,14 @@ stop_making_children ()
already_making_children = 0;
}
/* The name is kind of a misnomer, but it's what the job control code uses. */
void
without_job_control ()
{
stop_making_children ();
last_made_pid = NO_PID; /* XXX */
}
int
get_job_by_pid (pid, block)
pid_t pid;
+22 -7
View File
@@ -498,6 +498,12 @@ dump_word_flags (flags)
f &= ~W_HASDOLLAR;
fprintf (stderr, "W_HASDOLLAR%s", f ? "|" : "");
}
if (f & W_COMPLETE)
{
f &= ~W_COMPLETE;
fprintf (stderr, "W_COMPLETE%s", f ? "|" : "");
}
fprintf (stderr, "\n");
fflush (stderr);
}
@@ -814,9 +820,9 @@ string_extract (string, sindex, charlist, flags)
Backslashes between the embedded double quotes are processed. If STRIPDQ
is zero, an unquoted `"' terminates the string. */
static char *
string_extract_double_quoted (string, sindex, stripdq)
string_extract_double_quoted (string, sindex, flags)
char *string;
int *sindex, stripdq;
int *sindex, flags;
{
size_t slen;
char *send;
@@ -825,11 +831,14 @@ string_extract_double_quoted (string, sindex, stripdq)
char *temp, *ret; /* The new string we return. */
int pass_next, backquote, si; /* State variables for the machine. */
int dquote;
int stripdq;
DECLARE_MBSTATE;
slen = strlen (string + *sindex) + *sindex;
send = string + slen;
stripdq = (flags & SX_STRIPDQ);
pass_next = backquote = dquote = 0;
temp = (char *)xmalloc (1 + slen - *sindex);
@@ -912,7 +921,7 @@ add_one_character:
si = i + 2;
if (string[i + 1] == LPAREN)
ret = extract_command_subst (string, &si, 0);
ret = extract_command_subst (string, &si, (flags & SX_COMPLETE));
else
ret = extract_dollar_brace_string (string, &si, Q_DOUBLE_QUOTES, 0);
@@ -4751,7 +4760,7 @@ getpattern (value, quoted, expandpat)
if (expandpat && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *tword)
{
i = 0;
pat = string_extract_double_quoted (tword, &i, 1);
pat = string_extract_double_quoted (tword, &i, SX_STRIPDQ);
free (tword);
tword = pat;
}
@@ -6617,7 +6626,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *value)
{
sindex = 0;
temp = string_extract_double_quoted (value, &sindex, 1);
temp = string_extract_double_quoted (value, &sindex, SX_STRIPDQ);
}
else
temp = value;
@@ -8688,7 +8697,9 @@ param_expand (string, sindex, quoted, expanded_something,
case LPAREN:
/* We have to extract the contents of this paren substitution. */
t_index = zindex + 1;
temp = extract_command_subst (string, &t_index, 0);
/* XXX - might want to check for string[t_index+2] == LPAREN and parse
as arithmetic substitution immediately. */
temp = extract_command_subst (string, &t_index, (pflags&PF_COMPLETE) ? SX_COMPLETE : 0);
zindex = t_index;
/* For Posix.2-style `$(( ))' arithmetic substitution,
@@ -9210,6 +9221,8 @@ add_string:
pflags |= PF_NOSPLIT2;
if (word->flags & W_ASSIGNRHS)
pflags |= PF_ASSIGNRHS;
if (word->flags & W_COMPLETE)
pflags |= PF_COMPLETE;
tword = param_expand (string, &sindex, quoted, expanded_something,
&temp_has_dollar_at, &quoted_dollar_at,
&had_quoted_null, pflags);
@@ -9348,7 +9361,7 @@ add_twochars:
goto add_character;
t_index = ++sindex;
temp = string_extract_double_quoted (string, &sindex, 0);
temp = string_extract_double_quoted (string, &sindex, (word->flags & W_COMPLETE) ? SX_COMPLETE : 0);
/* If the quotes surrounded the entire string, then the
whole word was quoted. */
@@ -9364,6 +9377,8 @@ add_twochars:
/* XXX - bash-4.4/bash-5.0 */
if (word->flags & W_ASSIGNARG)
tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS); /* affects $@ */
if (word->flags & W_COMPLETE)
tword->flags |= W_COMPLETE; /* for command substitutions */
temp = (char *)NULL;
+1
View File
@@ -63,6 +63,7 @@
#define SX_POSIXEXP 0x0100 /* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
#define SX_WORD 0x0200 /* extracting word in ${param op word} */
#define SX_COMPLETE 0x0400 /* extracting word for completion */
#define SX_STRIPDQ 0x0800 /* strip double quotes when extracting double-quoted string */
/* Remove backslashes which are quoting backquotes from STRING. Modifies
STRING, and returns a pointer to it. */
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/bash/bash-current
BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR