bash-4.4-rc2 release

This commit is contained in:
Chet Ramey
2016-08-22 15:58:43 -04:00
parent a4eef1991c
commit 9555438775
43 changed files with 4796 additions and 3992 deletions
+50
View File
@@ -1,3 +1,53 @@
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().
h. Improved word completion for quoted strings containing unterminated command
substitutions with embedded double quotes.
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.
+176
View File
@@ -1,3 +1,179 @@
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().
h. Improved word completion for quoted strings containing unterminated command
substitutions with embedded double quotes.
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.
+194 -2
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
@@ -11303,7 +11303,7 @@ execute_cmd.c
6/23
----
execute_cmd.c
subst.c
- param_expand: when expanding $* in a context where splitting is not
desired (pflags & PF_ASSIGNRHS), make sure to quote the word and the
included separators. Reported by Dan Douglas <ormaaj@gmail.com>
@@ -11331,3 +11331,195 @@ subst.c
subst.[ch],arrayfunc.c
- string_list_dollar_at: now takes a new third argument, currently
reserved for future use; changed callers and declaration
7/7
---
[bash-4.4-beta2 frozen]
7/9
---
bashline.c
- check_redir: make sure that index is > 0 before checking previous
char; fixes out of bounds read reported by Hanno Böck
<hanno@hboeck.de>
7/16
----
subst.c
- parameter_brace_expand: if ${array[@]} or ${array[*]} is supplied
with an unset (or empty) array, and -u is enabled, don't make it
an unbound variable error, like $@ or $* when there are no
positional parameters. Based on report from Ian Allen
<idallen@idallen-fibe.dyndns.org>
lib/readline/signals.c
- rl_pending_signal(): return the number of any signal readline has
caught but is waiting to handle
lib/readline/callback.c
- rl_persistent_signal_handlers: new variable, restores readline-6.2
signal handler semantics: installed at rl_callback_handler_install
time and removed with rl_clear_signals when a complete line has
been read
- _rl_callback_newline: call rl_set_signals if rl_persistent_signal_handlers
is non-zero
- rl_callback_read_char: install signal handlers with rl_set_signals
if rl_persistent_signal_handlers is 0 (the default)
- CALLBACK_READ_RETURN: uninstall signal handlers with rl_clear_signals
only if rl_persistent_signal_handlers is 0 (the default)
lib/readline/readline.h
- rl_pending_signal: new extern declaration
- rl_persistent_signal_handlers: new extern declaration
7/19
----
execute_cmd.c
- execute_while_or_until: make sure we decrement `continuing' the way
we decrement `breaking' if the loop test indicates we will be
breaking out of the loop. That keeps `until continue' from
keeping `continuing' set to 1. Reported by Dan Douglas
<ormaaj@gmail.com>
7/20
----
trap.c
- run_pending_traps,_run_trap_internal: save and restore temporary_env,
set temporary_env to 0 before trap runs so traps don't inherit a
command's temporary env. Fixes bug with IFS assignment in tempenv
and trap reported by Andriy Martynets <martynets@volia.ua>
jobs.c
- run_sigchld_trap: save and restore temporary_env, set temporary_env
to 0 before trap runs so traps don't inherit a command's temporary
env (see above)
7/21
----
execute_cmd.c
- execute_function: unwind-protect function_line_number, in case we
are executing a function inside another function. Reported by
Grisha Levit <grishalevit@gmail.com> in context of evaled functions
and DEBUG traps
- execute_arith_for_command,execute_arith_command,execute_simple_command,
execute_cond_command: make sure line_number doesn't go < 0 when
adjusting it by function_line_number
7/23
----
subst.c,command.h
- move the PF_ constants to command.h so other files can see them, now
that PF_ASSIGNRHS has meaning to string_list_dollar_at
arrayfunc.h
- AV_ASSIGNRHS: new flag, indicate that ${a[@]} is being expanded on
the RHS of an assignment statement
arrayfunc.c
- array_value_internal: if AV_ASSIGNRHS passed for ${a[@]}, pass
PF_ASSIGNRHS to string_list_dollar_at to support args separated by
spaces even if $IFS does not have the default value. Reported by
Dan Douglas <ormaaj@gmail.com>
subst.c
- string_list_dollar_at: if FLAGS argument includes PF_ASSIGNRHS, obey
rules for $@ on the RHS of an assignment statement: expand to
postitional parameters separated by spaces no matter what the first
character of $IFS is. Reported by Dan Douglas <ormaaj@gmail.com>
- parameter_brace_expand_word: pass AV_ASSIGNRHS as flags value to
array_value if PF_ASSIGNRHS is set and we are expanding an array
variable subscripted by @ or *
- param_expand: pass pflags to string_list_dollar_at in case it contains
PF_ASSIGNRHS
- expand_word_internal: if we have an assignment statement argument to
a declaration builtin (W_ASSIGNARG), turn on W_ASSIGNRHS when we see
the `=' to enable special $@ behavior
- expand_word_internal: if W_ASSIGNARG enabled in word flags, pass that
flag and W_ASSIGNRHS to recursive call to expand_word_internal when
expanding double-quoted string; handles "$@" when IFS is not the
default value and word splitting will not be performed
subst.c
- expand_word_internal: change case that handles '' (single-quoted
empty string) to only discard it if we will not be performing word
splitting (W_NOSPLIT|W_NOSPLIT2), since we need to add a quoted null
argument if the subsequent characters will cause word splitting.
This is how "" (double-quoted empty string) is handled after a bug
fix back in August 2010. Reported by Grisha Levit
<grishalevit@gmail.com>, fix for Posix interp 888
7/27
----
subst.c
- param_expand: change fix from 6/23 (expanding $* in a context where
word splitting is not performed) to make sure that $* expands to
something before trying to quote the string. Bug and fix from
Andreas Schwab <schwab@suse.de>
lib/readline/bind.c
- _rl_get_string_variable_value: fix a cut-and-paste error that caused
the emacs mode string to be displayed for both vi insert and command
mode strings. Report and fix from Steve Jones <sjml@slohj.org>
7/28
----
lib/readline/display.c
- update_line: we can't use PROMPT_ENDING_INDEX unless we're testing
against _rl_last_c_pos; if we are testing buffer indices, we need to
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>
+2
View File
@@ -924,6 +924,7 @@ tests/dollar-at-star4.sub f
tests/dollar-at-star5.sub f
tests/dollar-at-star6.sub f
tests/dollar-at-star7.sub f
tests/dollar-at-star8.sub f
tests/dollar-at1.sub f
tests/dollar-at2.sub f
tests/dollar-at3.sub f
@@ -975,6 +976,7 @@ tests/exp5.sub f
tests/exp6.sub f
tests/exp7.sub f
tests/exp8.sub f
tests/exp9.sub f
tests/exportfunc.tests f
tests/exportfunc.right f
tests/exportfunc1.sub f
+2 -1
View File
@@ -1087,7 +1087,8 @@ array_value_internal (s, quoted, flags, rtype, indp)
free (temp);
}
else /* ${name[@]} or unquoted ${name[*]} */
retval = string_list_dollar_at (l, quoted, 0); /* XXX - leak here */
/* XXX - bash-4.4/bash-5.0 test AV_ASSIGNRHS and pass PF_ASSIGNRHS */
retval = string_list_dollar_at (l, quoted, (flags & AV_ASSIGNRHS) ? PF_ASSIGNRHS : 0); /* XXX - leak here */
dispose_words (l);
}
+2
View File
@@ -30,6 +30,7 @@
#define AV_QUOTED 0x002
#define AV_USEIND 0x004
#define AV_USEVAL 0x008 /* XXX - should move this */
#define AV_ASSIGNRHS 0x010 /* no splitting, special case ${a[@]} */
extern SHELL_VAR *convert_var_to_array __P((SHELL_VAR *));
extern SHELL_VAR *convert_var_to_assoc __P((SHELL_VAR *));
@@ -72,6 +73,7 @@ extern SHELL_VAR *array_variable_part __P((char *, char **, int *));
#define AV_ALLOWALL 0
#define AV_QUOTED 0
#define AV_USEIND 0
#define AV_ASSIGNRHS 0
#endif
+11 -4
View File
@@ -1279,7 +1279,7 @@ check_redir (ti)
/* Handle the two character tokens `>&', `<&', and `>|'.
We are not in a command position after one of these. */
this_char = rl_line_buffer[ti];
prev_char = rl_line_buffer[ti - 1];
prev_char = (ti > 0) ? rl_line_buffer[ti - 1] : 0;
if ((this_char == '&' && (prev_char == '<' || prev_char == '>')) ||
(this_char == '|' && prev_char == '>'))
@@ -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);
+10 -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,15 @@ 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 */
#define PF_NOCOMSUB 0x01 /* Do not perform command substitution */
#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])
+393 -389
View File
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -2288,7 +2288,9 @@ Example:
\fBMAILPATH\fP=\(aq/var/mail/bfox?"You have mail":~/shell\-mail?"$_ has mail!"\(aq
.PP
.B Bash
supplies a default value for this variable, but the location of the user
can be configured to supply
a default value for this variable (there is no value by default),
but the location of the user
mail files that it uses is system dependent (e.g., /var/mail/\fB$USER\fP).
.RE
.TP
@@ -3724,7 +3726,10 @@ before the standard output was redirected to
.IR dirlist .
.PP
\fBBash\fP handles several filenames specially when they are used in
redirections, as described in the following table:
redirections, as described in the following table.
If the operating system on which \fBbash\fP is running provides these
special files, bash will use them; otherwise it will emulate them
internally with the behavior described below.
.RS
.PP
.PD 0
+8 -3
View File
@@ -2908,7 +2908,9 @@ Example:
<B>Bash</B>
supplies a default value for this variable, but the location of the user
can be configured to supply
a default value for this variable (there is no value by default),
but the location of the user
mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
</DL>
@@ -4709,7 +4711,10 @@ before the standard output was redirected to
<P>
<B>Bash</B> handles several filenames specially when they are used in
redirections, as described in the following table:
redirections, as described in the following table.
If the operating system on which <B>bash</B> is running provides these
special files, bash will use them; otherwise it will emulate them
internally with the behavior described below.
<DL COMPACT><DT><DD>
<P>
@@ -13620,6 +13625,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 20 June 2016 15:38:21 EDT
Time: 14 July 2016 11:48:02 EDT
</BODY>
</HTML>
BIN
View File
Binary file not shown.
+3398 -3398
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+4 -1
View File
@@ -3179,7 +3179,10 @@ because the standard error was made a copy of the standard output
before the standard output was redirected to <var>dirlist</var>.
</p>
<p>Bash handles several filenames specially when they are used in
redirections, as described in the following table:
redirections, as described in the following table.
If the operating system on which Bash is running provides these
special files, bash will use them; otherwise it will emulate them
internally with the behavior described below.
</p>
<dl compact="compact">
<dt><code>/dev/fd/<var>fd</var></code></dt>
+92 -89
View File
@@ -2201,7 +2201,10 @@ error was made a copy of the standard output before the standard output
was redirected to DIRLIST.
Bash handles several filenames specially when they are used in
redirections, as described in the following table:
redirections, as described in the following table. If the operating
system on which Bash is running provides these special files, bash will
use them; otherwise it will emulate them internally with the behavior
described below.
'/dev/fd/FD'
If FD is a valid integer, file descriptor FD is duplicated.
@@ -11375,93 +11378,93 @@ Node: Filename Expansion87384
Node: Pattern Matching89668
Node: Quote Removal93366
Node: Redirections93661
Node: Executing Commands102904
Node: Simple Command Expansion103574
Node: Command Search and Execution105504
Node: Command Execution Environment107840
Node: Environment110824
Node: Exit Status112483
Node: Signals114153
Node: Shell Scripts116120
Node: Shell Builtin Commands118635
Node: Bourne Shell Builtins120669
Node: Bash Builtins141269
Node: Modifying Shell Behavior169914
Node: The Set Builtin170259
Node: The Shopt Builtin180672
Node: Special Builtins196471
Node: Shell Variables197450
Node: Bourne Shell Variables197887
Node: Bash Variables199918
Node: Bash Features228298
Node: Invoking Bash229197
Node: Bash Startup Files235146
Node: Interactive Shells240249
Node: What is an Interactive Shell?240659
Node: Is this Shell Interactive?241308
Node: Interactive Shell Behavior242123
Node: Bash Conditional Expressions245498
Node: Shell Arithmetic249499
Node: Aliases252316
Node: Arrays254864
Node: The Directory Stack259948
Node: Directory Stack Builtins260732
Node: Controlling the Prompt263700
Node: The Restricted Shell266446
Node: Bash POSIX Mode268271
Node: Job Control278324
Node: Job Control Basics278784
Node: Job Control Builtins283503
Node: Job Control Variables288033
Node: Command Line Editing289189
Node: Introduction and Notation290860
Node: Readline Interaction292483
Node: Readline Bare Essentials293674
Node: Readline Movement Commands295457
Node: Readline Killing Commands296417
Node: Readline Arguments298335
Node: Searching299379
Node: Readline Init File301565
Node: Readline Init File Syntax302712
Node: Conditional Init Constructs322899
Node: Sample Init File325424
Node: Bindable Readline Commands328541
Node: Commands For Moving329745
Node: Commands For History330888
Node: Commands For Text335177
Node: Commands For Killing338566
Node: Numeric Arguments341047
Node: Commands For Completion342186
Node: Keyboard Macros346377
Node: Miscellaneous Commands347064
Node: Readline vi Mode352868
Node: Programmable Completion353775
Node: Programmable Completion Builtins361236
Node: A Programmable Completion Example371122
Node: Using History Interactively376374
Node: Bash History Facilities377058
Node: Bash History Builtins380059
Node: History Interaction384056
Node: Event Designators387020
Node: Word Designators388239
Node: Modifiers389876
Node: Installing Bash391278
Node: Basic Installation392415
Node: Compilers and Options395106
Node: Compiling For Multiple Architectures395847
Node: Installation Names397510
Node: Specifying the System Type398328
Node: Sharing Defaults399044
Node: Operation Controls399717
Node: Optional Features400675
Node: Reporting Bugs410932
Node: Major Differences From The Bourne Shell412126
Node: GNU Free Documentation License428978
Node: Indexes454155
Node: Builtin Index454609
Node: Reserved Word Index461436
Node: Variable Index463884
Node: Function Index479343
Node: Concept Index492500
Node: Executing Commands103081
Node: Simple Command Expansion103751
Node: Command Search and Execution105681
Node: Command Execution Environment108017
Node: Environment111001
Node: Exit Status112660
Node: Signals114330
Node: Shell Scripts116297
Node: Shell Builtin Commands118812
Node: Bourne Shell Builtins120846
Node: Bash Builtins141446
Node: Modifying Shell Behavior170091
Node: The Set Builtin170436
Node: The Shopt Builtin180849
Node: Special Builtins196648
Node: Shell Variables197627
Node: Bourne Shell Variables198064
Node: Bash Variables200095
Node: Bash Features228475
Node: Invoking Bash229374
Node: Bash Startup Files235323
Node: Interactive Shells240426
Node: What is an Interactive Shell?240836
Node: Is this Shell Interactive?241485
Node: Interactive Shell Behavior242300
Node: Bash Conditional Expressions245675
Node: Shell Arithmetic249676
Node: Aliases252493
Node: Arrays255041
Node: The Directory Stack260125
Node: Directory Stack Builtins260909
Node: Controlling the Prompt263877
Node: The Restricted Shell266623
Node: Bash POSIX Mode268448
Node: Job Control278501
Node: Job Control Basics278961
Node: Job Control Builtins283680
Node: Job Control Variables288210
Node: Command Line Editing289366
Node: Introduction and Notation291037
Node: Readline Interaction292660
Node: Readline Bare Essentials293851
Node: Readline Movement Commands295634
Node: Readline Killing Commands296594
Node: Readline Arguments298512
Node: Searching299556
Node: Readline Init File301742
Node: Readline Init File Syntax302889
Node: Conditional Init Constructs323076
Node: Sample Init File325601
Node: Bindable Readline Commands328718
Node: Commands For Moving329922
Node: Commands For History331065
Node: Commands For Text335354
Node: Commands For Killing338743
Node: Numeric Arguments341224
Node: Commands For Completion342363
Node: Keyboard Macros346554
Node: Miscellaneous Commands347241
Node: Readline vi Mode353045
Node: Programmable Completion353952
Node: Programmable Completion Builtins361413
Node: A Programmable Completion Example371299
Node: Using History Interactively376551
Node: Bash History Facilities377235
Node: Bash History Builtins380236
Node: History Interaction384233
Node: Event Designators387197
Node: Word Designators388416
Node: Modifiers390053
Node: Installing Bash391455
Node: Basic Installation392592
Node: Compilers and Options395283
Node: Compiling For Multiple Architectures396024
Node: Installation Names397687
Node: Specifying the System Type398505
Node: Sharing Defaults399221
Node: Operation Controls399894
Node: Optional Features400852
Node: Reporting Bugs411109
Node: Major Differences From The Bourne Shell412303
Node: GNU Free Documentation License429155
Node: Indexes454332
Node: Builtin Index454786
Node: Reserved Word Index461613
Node: Variable Index464061
Node: Function Index479520
Node: Concept Index492677

End Tag Table
BIN
View File
Binary file not shown.
+35 -30
View File
@@ -1,7 +1,7 @@
%!PS-Adobe-2.0
%%Creator: dvips(k) 5.995 Copyright 2015 Radical Eye Software
%%Creator: dvips(k) 5.996 Copyright 2016 Radical Eye Software
%%Title: bashref.dvi
%%CreationDate: Mon Jun 20 15:38:16 2016
%%CreationDate: Thu Jul 14 11:47:59 2016
%%Pages: 177
%%PageOrder: Ascend
%%BoundingBox: 0 0 612 792
@@ -12,7 +12,7 @@
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
%DVIPSParameters: dpi=600
%DVIPSSource: TeX output 2016.06.20:1538
%DVIPSSource: TeX output 2016.07.14:1147
%%BeginProcSet: tex.pro 0 0
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
@@ -10497,49 +10497,54 @@ y(The)31 b(w)m(ord)h(follo)m(wing)i(the)f(redirection)g(op)s(erator)f
518 y(substitution,)31 b(arithmetic)h(expansion,)f(quote)h(remo)m(v)-5
b(al,)33 b(\014lename)e(expansion,)g(and)f(w)m(ord)h(splitting.)150
628 y(If)f(it)h(expands)e(to)i(more)g(than)f(one)h(w)m(ord,)f(Bash)h
(rep)s(orts)e(an)h(error.)275 790 y(Note)h(that)g(the)g(order)f(of)g
(rep)s(orts)e(an)h(error.)275 778 y(Note)h(that)g(the)g(order)f(of)g
(redirections)h(is)g(signi\014can)m(t.)41 b(F)-8 b(or)31
b(example,)h(the)e(command)390 953 y Ft(ls)47 b(>)h Fj(dirlist)d
Ft(2>&1)150 1115 y Fu(directs)28 b(b)s(oth)f(standard)g(output)g
b(example,)h(the)e(command)390 928 y Ft(ls)47 b(>)h Fj(dirlist)d
Ft(2>&1)150 1079 y Fu(directs)28 b(b)s(oth)f(standard)g(output)g
(\(\014le)h(descriptor)f(1\))i(and)e(standard)f(error)i(\(\014le)g
(descriptor)f(2\))h(to)h(the)150 1225 y(\014le)h Fr(dirlist)p
Fu(,)h(while)f(the)h(command)390 1388 y Ft(ls)47 b(2>&1)g(>)g
Fj(dirlist)150 1550 y Fu(directs)28 b(only)f(the)h(standard)e(output)i
(descriptor)f(2\))h(to)h(the)150 1188 y(\014le)h Fr(dirlist)p
Fu(,)h(while)f(the)h(command)390 1339 y Ft(ls)47 b(2>&1)g(>)g
Fj(dirlist)150 1489 y Fu(directs)28 b(only)f(the)h(standard)e(output)i
(to)g(\014le)f Fr(dirlist)p Fu(,)h(b)s(ecause)g(the)f(standard)g(error)
g(w)m(as)h(made)f(a)h(cop)m(y)150 1660 y(of)j(the)f(standard)g(output)g
g(w)m(as)h(made)f(a)h(cop)m(y)150 1599 y(of)j(the)f(standard)g(output)g
(b)s(efore)g(the)g(standard)g(output)g(w)m(as)g(redirected)h(to)g
Fr(dirlist)p Fu(.)275 1822 y(Bash)26 b(handles)f(sev)m(eral)j
Fr(dirlist)p Fu(.)275 1749 y(Bash)26 b(handles)f(sev)m(eral)j
(\014lenames)e(sp)s(ecially)h(when)f(they)g(are)g(used)g(in)g
(redirections,)i(as)e(describ)s(ed)150 1932 y(in)k(the)h(follo)m(wing)g
(table:)150 2133 y Ft(/dev/fd/)p Fj(fd)630 2243 y Fu(If)f
Fr(fd)j Fu(is)d(a)h(v)-5 b(alid)31 b(in)m(teger,)h(\014le)e(descriptor)
h Fr(fd)i Fu(is)d(duplicated.)150 2431 y Ft(/dev/stdin)630
2540 y Fu(File)i(descriptor)e(0)h(is)f(duplicated.)150
2728 y Ft(/dev/stdout)630 2837 y Fu(File)i(descriptor)e(1)h(is)f
(duplicated.)150 3025 y Ft(/dev/stderr)630 3134 y Fu(File)i(descriptor)
e(2)h(is)f(duplicated.)150 3322 y Ft(/dev/tcp/)p Fj(host)p
Ft(/)p Fj(port)630 3431 y Fu(If)41 b Fr(host)i Fu(is)f(a)g(v)-5
(redirections,)i(as)e(describ)s(ed)150 1859 y(in)38 b(the)h(follo)m
(wing)h(table.)66 b(If)38 b(the)h(op)s(erating)g(system)f(on)h(whic)m
(h)f(Bash)h(is)f(running)f(pro)m(vides)h(these)150 1968
y(sp)s(ecial)27 b(\014les,)g(bash)e(will)i(use)f(them;)h(otherwise)g
(it)f(will)h(em)m(ulate)h(them)e(in)m(ternally)h(with)f(the)g(b)s(eha)m
(vior)150 2078 y(describ)s(ed)j(b)s(elo)m(w.)150 2261
y Ft(/dev/fd/)p Fj(fd)630 2371 y Fu(If)h Fr(fd)j Fu(is)d(a)h(v)-5
b(alid)31 b(in)m(teger,)h(\014le)e(descriptor)h Fr(fd)i
Fu(is)d(duplicated.)150 2546 y Ft(/dev/stdin)630 2656
y Fu(File)i(descriptor)e(0)h(is)f(duplicated.)150 2831
y Ft(/dev/stdout)630 2941 y Fu(File)i(descriptor)e(1)h(is)f
(duplicated.)150 3116 y Ft(/dev/stderr)630 3226 y Fu(File)i(descriptor)
e(2)h(is)f(duplicated.)150 3401 y Ft(/dev/tcp/)p Fj(host)p
Ft(/)p Fj(port)630 3511 y Fu(If)41 b Fr(host)i Fu(is)f(a)g(v)-5
b(alid)41 b(hostname)h(or)f(In)m(ternet)h(address,)i(and)c
Fr(p)s(ort)j Fu(is)f(an)f(in)m(teger)i(p)s(ort)630 3541
Fr(p)s(ort)j Fu(is)f(an)f(in)m(teger)i(p)s(ort)630 3620
y(n)m(um)m(b)s(er)23 b(or)i(service)h(name,)g(Bash)f(attempts)h(to)f
(op)s(en)f(the)h(corresp)s(onding)f(TCP)g(so)s(c)m(k)m(et.)150
3728 y Ft(/dev/udp/)p Fj(host)p Ft(/)p Fj(port)630 3838
3795 y Ft(/dev/udp/)p Fj(host)p Ft(/)p Fj(port)630 3905
y Fu(If)41 b Fr(host)i Fu(is)f(a)g(v)-5 b(alid)41 b(hostname)h(or)f(In)
m(ternet)h(address,)i(and)c Fr(p)s(ort)j Fu(is)f(an)f(in)m(teger)i(p)s
(ort)630 3948 y(n)m(um)m(b)s(er)23 b(or)h(service)h(name,)h(Bash)e
(ort)630 4015 y(n)m(um)m(b)s(er)23 b(or)h(service)h(name,)h(Bash)e
(attempts)h(to)g(op)s(en)f(the)g(corresp)s(onding)f(UDP)i(so)s(c)m(k)m
(et.)275 4149 y(A)30 b(failure)h(to)g(op)s(en)e(or)i(create)h(a)e
(et.)275 4198 y(A)30 b(failure)h(to)g(op)s(en)e(or)i(create)h(a)e
(\014le)h(causes)g(the)f(redirection)h(to)g(fail.)275
4312 y(Redirections)f(using)e(\014le)i(descriptors)f(greater)h(than)f
4348 y(Redirections)f(using)e(\014le)i(descriptors)f(greater)h(than)f
(9)h(should)e(b)s(e)h(used)f(with)h(care,)h(as)g(they)f(ma)m(y)150
4421 y(con\015ict)i(with)f(\014le)h(descriptors)f(the)g(shell)h(uses)f
(in)m(ternally)-8 b(.)150 4649 y Fk(3.6.1)63 b(Redirecting)40
b(Input)150 4796 y Fu(Redirection)35 b(of)f(input)f(causes)i(the)f
4458 y(con\015ict)i(with)f(\014le)h(descriptors)f(the)g(shell)h(uses)f
(in)m(ternally)-8 b(.)150 4673 y Fk(3.6.1)63 b(Redirecting)40
b(Input)150 4820 y Fu(Redirection)35 b(of)f(input)f(causes)i(the)f
(\014le)g(whose)g(name)g(results)g(from)g(the)g(expansion)g(of)g
Fr(w)m(ord)k Fu(to)d(b)s(e)150 4905 y(op)s(ened)d(for)g(reading)g(on)g
Fr(w)m(ord)k Fu(to)d(b)s(e)150 4930 y(op)s(ened)d(for)g(reading)g(on)g
(\014le)h(descriptor)f Ft(n)p Fu(,)h(or)f(the)g(standard)g(input)f
(\(\014le)i(descriptor)f(0\))h(if)f Ft(n)g Fu(is)h(not)150
5015 y(sp)s(eci\014ed.)275 5177 y(The)c(general)j(format)e(for)h
5039 y(sp)s(eci\014ed.)275 5190 y(The)c(general)j(format)e(for)h
(redirecting)g(input)e(is:)390 5340 y Ft([)p Fj(n)p Ft(]<)p
Fj(word)p eop end
%%Page: 34 40
+4 -1
View File
@@ -2592,7 +2592,10 @@ because the standard error was made a copy of the standard output
before the standard output was redirected to @var{dirlist}.
Bash handles several filenames specially when they are used in
redirections, as described in the following table:
redirections, as described in the following table.
If the operating system on which Bash is running provides these
special files, bash will use them; otherwise it will emulate them
internally with the behavior described below.
@table @code
@item /dev/fd/@var{fd}
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Mon Jun 20 15:38:03 2016
%%CreationDate: Thu Jul 14 11:47:50 2016
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Mon Jun 20 15:38:03 2016
%%CreationDate: Thu Jul 14 11:47:50 2016
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+29 -6
View File
@@ -2928,7 +2928,11 @@ execute_arith_for_command (arith_for_command)
and the DEBUG trap. */
line_number = arith_lineno = arith_for_command->line;
if (variable_context && interactive_shell)
line_number -= function_line_number;
{
line_number -= function_line_number;
if (line_number < 0)
line_number = 0;
}
/* Evaluate the initialization expression. */
expresult = eval_arith_for_expr (arith_for_command->init, &expok);
@@ -3482,17 +3486,22 @@ execute_while_or_until (while_command, type)
loop. The job control code will set `breaking' to loop_level
when a job in a loop is stopped with SIGTSTP. If the stopped job
is in the loop test, `breaking' will not be reset unless we do
this, and the shell will cease to execute commands. */
this, and the shell will cease to execute commands. The same holds
true for `continue'. */
if (type == CMD_WHILE && return_value != EXECUTION_SUCCESS)
{
if (breaking)
breaking--;
if (continuing)
continuing--;
break;
}
if (type == CMD_UNTIL && return_value == EXECUTION_SUCCESS)
{
if (breaking)
breaking--;
if (continuing)
continuing--;
break;
}
@@ -3569,7 +3578,11 @@ execute_arith_command (arith_command)
line_number = arith_command->line;
/* If we're in a function, update the line number information. */
if (variable_context && interactive_shell)
line_number -= function_line_number;
{
line_number -= function_line_number;
if (line_number < 0)
line_number = 0;
}
command_string_index = 0;
print_arith_command (arith_command->exp);
@@ -3767,7 +3780,11 @@ execute_cond_command (cond_command)
line_number = cond_command->line;
/* If we're in a function, update the line number information. */
if (variable_context && interactive_shell)
line_number -= function_line_number;
{
line_number -= function_line_number;
if (line_number < 0)
line_number = 0;
}
command_string_index = 0;
print_cond_command (cond_command);
@@ -4008,7 +4025,11 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
/* If we're in a function, update the line number information. */
if (variable_context && interactive_shell && sourcelevel == 0)
line_number -= function_line_number;
{
line_number -= function_line_number;
if (line_number < 0)
line_number = 0;
}
/* Remember what this command line looks like at invocation. */
command_string_index = 0;
@@ -4619,6 +4640,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
add_unwind_protect (pop_context, (char *)NULL);
unwind_protect_int (line_number);
unwind_protect_int (line_number_for_err_trap);
unwind_protect_int (function_line_number);
unwind_protect_int (return_catch_flag);
unwind_protect_jmp_buf (return_catch);
add_unwind_protect (dispose_command, (char *)tc);
@@ -5362,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 */
+1 -1
View File
@@ -265,7 +265,7 @@ check_selfref (name, value, flags)
#if defined (ARRAY_VARS)
if (valid_array_reference (value, 0))
{
t = array_variable_name (value, (int *)NULL, (int *)NULL);
t = array_variable_name (value, (char **)NULL, (int *)NULL);
if (t && STREQ (name, t))
{
free (t);
+2
View File
@@ -3845,6 +3845,7 @@ run_sigchld_trap (nchild)
unwind_protect_pointer (the_pipeline);
unwind_protect_pointer (subst_assign_varlist);
unwind_protect_pointer (this_shell_builtin);
unwind_protect_pointer (temporary_env);
/* We have to add the commands this way because they will be run
in reverse order of adding. We don't want maybe_set_sigchld_trap ()
@@ -3854,6 +3855,7 @@ run_sigchld_trap (nchild)
subst_assign_varlist = (WORD_LIST *)NULL;
the_pipeline = (PROCESS *)NULL;
temporary_env = 0; /* traps should not run with temporary env */
running_trap = SIGCHLD + 1;
+2 -2
View File
@@ -2591,9 +2591,9 @@ _rl_get_string_variable_value (name)
else if (_rl_stricmp (name, "emacs-mode-string") == 0)
return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_EMACS_MODESTR_DEFAULT);
else if (_rl_stricmp (name, "vi-cmd-mode-string") == 0)
return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_VI_CMD_MODESTR_DEFAULT);
return (_rl_vi_cmd_mode_str ? _rl_vi_cmd_mode_str : RL_VI_CMD_MODESTR_DEFAULT);
else if (_rl_stricmp (name, "vi-ins-mode-string") == 0)
return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_VI_INS_MODESTR_DEFAULT);
return (_rl_vi_ins_mode_str ? _rl_vi_ins_mode_str : RL_VI_INS_MODESTR_DEFAULT);
else
return (0);
}
+17 -2
View File
@@ -50,6 +50,14 @@
_rl_callback_func_t *_rl_callback_func = 0;
_rl_callback_generic_arg *_rl_callback_data = 0;
/* Applications can set this to non-zero to have readline's signal handlers
installed during the entire duration of reading a complete line, as in
readline-6.2. This should be used with care, because it can result in
readline receiving signals and not handling them until it's called again
via rl_callback_read_char, thereby stealing them from the application.
By default, signal handlers are only active while readline is active. */
int rl_persistent_signal_handlers = 0;
/* **************************************************************** */
/* */
/* Callback Readline Functions */
@@ -82,6 +90,11 @@ _rl_callback_newline ()
if (rl_prep_term_function)
(*rl_prep_term_function) (_rl_meta_flag);
#if defined (HANDLE_SIGNALS)
if (rl_persistent_signal_handlers)
rl_set_signals ();
#endif
}
readline_internal_setup ();
@@ -103,7 +116,8 @@ rl_callback_handler_install (prompt, linefunc)
#if defined (HANDLE_SIGNALS)
#define CALLBACK_READ_RETURN() \
do { \
rl_clear_signals (); \
if (rl_persistent_signal_handlers == 0) \
rl_clear_signals (); \
return; \
} while (0)
#else
@@ -140,7 +154,8 @@ rl_callback_read_char ()
#if defined (HANDLE_SIGNALS)
/* Install signal handlers only when readline has control. */
rl_set_signals ();
if (rl_persistent_signal_handlers == 0)
rl_set_signals ();
#endif
do
+6 -4
View File
@@ -119,6 +119,8 @@ static int _rl_col_width PARAMS((const char *, int, int, int));
buffer index in others. This macro is used when deciding whether the
current cursor position is in the middle of a prompt string containing
invisible characters. XXX - might need to take `modmark' into account. */
/* XXX - only valid when tested against _rl_last_c_pos; buffer indices need
to use prompt_last_invisible directly. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
@@ -1674,10 +1676,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (lendiff > nmax)
lendiff = nmax;
od = ofd - old; /* index of first difference in visible line */
nd = nfd - new;
nd = nfd - new; /* nd, od are buffer indexes */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
(((od > 0 || nd > 0) && (od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX)) ||
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
#if defined (__MSDOS__)
@@ -1702,7 +1704,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
was within the prompt, see if we need to recompute where the lines
differ. Check whether where we are now is past the last place where
the old and new lines are the same and short-circuit now if we are. */
if ((od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX) &&
if ((od <= prompt_last_invisible || nd <= prompt_last_invisible) &&
omax == nmax &&
lendiff > (ols-old) && lendiff > (nls-new))
return;
@@ -1714,7 +1716,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
first difference, but you don't know the number of invisible
characters in that case.
This needs a lot of work to be efficient. */
if ((od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX))
if ((od <= prompt_last_invisible || nd <= prompt_last_invisible))
{
nfd = new + lendiff; /* number of characters we output above */
nd = lendiff;
+31 -1
View File
@@ -1531,7 +1531,7 @@ main (int c, char **v)
@{
rl_resize_terminal ();
sigwinch_received = 0;
}@
@}
if (r < 0)
continue;
@@ -1591,6 +1591,22 @@ using the callback interface should be prepared to clean up Readline's
state if they wish to handle the signal before the line handler completes
and restores the terminal state.
If an application using the callback interface wishes to have Readline
install its signal handlers at the time the application calls
@code{rl_callback_handler_install} and remove them only when a complete
line of input has been read, it should set the
@code{rl_persistent_signal_handlers} variable to a non-zero value.
This allows an application to defer all of the handling of the signals
Readline catches to Readline.
Applications should use this variable with care; it can result in Readline
catching signals and not acting on them (or allowing the application to react
to them) until the application calls @code{rl_callback_read_char}. This
can result in an application becoming less responsive to keyboard signals
like SIGINT.
If an application does not want or need to perform any signal handling, or
does not need to do any processing between calls to @code{rl_callback_read_char},
setting this variable may be desirable.
Readline provides two variables that allow application writers to
control whether or not it will catch certain signals and act on them
when they are received. It is important that applications change the
@@ -1612,6 +1628,15 @@ Readline will install a signal handler for @code{SIGWINCH}.
The default value of @code{rl_catch_sigwinch} is 1.
@end deftypevar
@deftypevar int rl_persistent_signal_handlers
If an application using the callback interface wishes Readline's signal
handlers to be installed and active during the set of calls to
@code{rl_callback_read_char} that constitutes an entire single line,
it should set this variable to a non-zero value.
The default value of @code{rl_persistent_signal_handlers} is 0.
@end deftypevar
@deftypevar int rl_change_environment
If this variable is set to a non-zero value,
and Readline is handling @code{SIGWINCH}, Readline will modify the
@@ -1627,6 +1652,11 @@ for example),
Readline provides convenience functions to do the necessary terminal
and internal state cleanup upon receipt of a signal.
@deftypefun int rl_pending_signal (void)
Return the signal number of the most recent signal Readline received but
has not yet handled, or 0 if there is no pending signal.
@end deftypefun
@deftypefun void rl_cleanup_after_signal (void)
This function will reset the state of the terminal to what it was before
@code{readline()} was called, and remove the Readline signal handlers for
+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 20 April 2016
@set UPDATED-MONTH April 2016
@set UPDATED 16 July 2016
@set UPDATED-MONTH July 2016
@set LASTCHANGE Wed Apr 20 13:32:48 PDT 2016
@set LASTCHANGE Sat Jul 16 13:43:15 EDT 2016
+11 -1
View File
@@ -442,6 +442,8 @@ extern void rl_cleanup_after_signal PARAMS((void));
extern void rl_reset_after_signal PARAMS((void));
extern void rl_free_line_state PARAMS((void));
extern int rl_pending_signal PARAMS((void));
extern void rl_echo_signal_char PARAMS((int));
extern int rl_set_paren_blink_timeout PARAMS((int));
@@ -640,7 +642,7 @@ extern rl_compentry_func_t *rl_completion_entry_function;
/* Optional generator for menu completion. Default is
rl_completion_entry_function (rl_filename_completion_function). */
extern rl_compentry_func_t *rl_menu_completion_entry_function;
extern rl_compentry_func_t *rl_menu_completion_entry_function;
/* If rl_ignore_some_completions_function is non-NULL it is the address
of a function to call after all of the possible matches have been
@@ -832,6 +834,14 @@ extern int rl_ignore_completion_duplicates;
completion character will be inserted as any other. */
extern int rl_inhibit_completion;
/* Applications can set this to non-zero to have readline's signal handlers
installed during the entire duration of reading a complete line, as in
readline-6.2. This should be used with care, because it can result in
readline receiving signals and not handling them until it's called again
via rl_callback_read_char, thereby stealing them from the application.
By default, signal handlers are only active while readline is active. */
extern int rl_persistent_signal_handlers;
/* Input error; can be returned by (*rl_getc_function) if readline is reading
a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
#define READERR (-2)
+6 -1
View File
@@ -1,6 +1,6 @@
/* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -585,6 +585,11 @@ rl_free_line_state ()
_rl_reset_argument ();
}
int
rl_pending_signal ()
{
return (_rl_caught_signal);
}
#endif /* HANDLE_SIGNALS */
/* **************************************************************** */
+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;
+72 -35
View File
@@ -90,12 +90,6 @@ extern int errno;
#define ST_SQUOTE 0x04 /* unused yet */
#define ST_DQUOTE 0x08 /* unused yet */
/* Flags for the `pflags' argument to param_expand() */
#define PF_NOCOMSUB 0x01 /* Do not perform command substitution */
#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 */
/* These defs make it easier to use the editor. */
#define LBRACE '{'
#define RBRACE '}'
@@ -109,6 +103,9 @@ extern int errno;
#define WRPAREN L')'
#endif
#define DOLLAR_AT_STAR(c) ((c) == '@' || (c) == '*')
#define STR_DOLLAR_AT_STAR(s) (DOLLAR_AT_STAR ((s)[0]) && (s)[1] == '\0')
/* Evaluates to 1 if C is one of the shell's special parameters whose length
can be taken, but is also one of the special expansion characters. */
#define VALID_SPECIAL_LENGTH_PARAM(c) \
@@ -501,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);
}
@@ -817,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;
@@ -828,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);
@@ -915,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);
@@ -2512,7 +2518,13 @@ string_list_dollar_star (list)
<space><tab><newline>, IFS characters in the words in the list should
also be split. If IFS is null, and the word is not quoted, we need
to quote the words in the list to preserve the positional parameters
exactly. */
exactly.
Valid values for the FLAGS argument are the PF_ flags in command.h,
the only one we care about is PF_ASSIGNRHS. $@ is supposed to expand
to the positional parameters separated by spaces no matter what IFS is
set to if in a context where word splitting is not performed. The only
one that we didn't handle before is assignment statement arguments to
declaration builtins like `declare'. */
char *
string_list_dollar_at (list, quoted, flags)
WORD_LIST *list;
@@ -2538,7 +2550,13 @@ string_list_dollar_at (list, quoted, flags)
# if !defined (__GNUC__)
sep = (char *)xmalloc (MB_CUR_MAX + 1);
# endif /* !__GNUC__ */
if (ifs && *ifs)
/* XXX - bash-4.4/bash-5.0 testing PF_ASSIGNRHS */
if (flags & PF_ASSIGNRHS)
{
sep[0] = ' ';
sep[1] = '\0';
}
else if (ifs && *ifs)
{
if (ifs_firstc_len == 1)
{
@@ -2557,7 +2575,8 @@ string_list_dollar_at (list, quoted, flags)
sep[1] = '\0';
}
#else
sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs;
/* XXX - bash-4.4/bash-5.0 test PF_ASSIGNRHS */
sep[0] = ((flags & PF_ASSIGNRHS) || ifs == 0 || *ifs == 0) ? ' ' : *ifs;
sep[1] = '\0';
#endif
@@ -4741,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;
}
@@ -6424,7 +6443,8 @@ expand_arrayref:
{
/* Only treat as double quoted if array variable */
if (var && (array_p (var) || assoc_p (var)))
temp = array_value (name, quoted|Q_DOUBLE_QUOTES, 0, &atype, &ind);
/* XXX - bash-4.4/bash-5.0 pass AV_ASSIGNRHS */
temp = array_value (name, quoted|Q_DOUBLE_QUOTES, AV_ASSIGNRHS, &atype, &ind);
else
temp = array_value (name, quoted, 0, &atype, &ind);
}
@@ -6606,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;
@@ -6797,7 +6817,7 @@ parameter_brace_expand_length (name)
if (name[1] == '\0') /* ${#} */
number = number_of_args ();
else if ((name[1] == '@' || name[1] == '*') && name[2] == '\0') /* ${#@}, ${#*} */
else if (DOLLAR_AT_STAR (name[1]) && name[2] == '\0') /* ${#@}, ${#*} */
number = number_of_args ();
else if ((sh_syntaxtab[(unsigned char) name[1]] & CSPECVAR) && name[2] == '\0')
{
@@ -7067,7 +7087,7 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
}
/* This sets vtype to VT_VARIABLE or VT_POSPARMS */
vtype = (vname[0] == '@' || vname[0] == '*') && vname[1] == '\0';
vtype = STR_DOLLAR_AT_STAR (vname);
if (vtype == VT_POSPARMS && vname[0] == '*')
vtype |= VT_STARSUB;
*varp = (SHELL_VAR *)NULL;
@@ -7824,7 +7844,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
int want_substring, want_indir, want_patsub, want_casemod;
char *name, *value, *temp, *temp1;
WORD_DESC *tdesc, *ret;
int t_index, sindex, c, tflag, modspec;
int t_index, sindex, c, tflag, modspec, all_element_arrayref;
intmax_t number;
arrayind_t ind;
@@ -7832,6 +7852,8 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
var_is_set = var_is_null = var_is_special = check_nullness = 0;
want_substring = want_indir = want_patsub = want_casemod = 0;
all_element_arrayref = 0;
sindex = *indexp;
t_index = ++sindex;
/* ${#var} doesn't have any of the other parameter expansions on it. */
@@ -8124,6 +8146,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
if (valid_array_reference (name, 0))
{
int qflags;
char *t;
qflags = quoted;
/* If in a context where word splitting will not take place, treat as
@@ -8131,6 +8154,10 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
if (pflags & PF_ASSIGNRHS)
qflags |= Q_DOUBLE_QUOTES;
chk_atstar (name, qflags, quoted_dollar_atp, contains_dollar_at);
/* We duplicate a little code here */
t = mbschr (name, '[');
if (t && ALL_ELEMENT_SUB (t[1]) && t[2] == ']')
all_element_arrayref = 1;
}
#endif
@@ -8160,7 +8187,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
variable error. */
if (want_substring || want_patsub || want_casemod || c == '#' || c == '%' || c == RBRACE)
{
if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]))
if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]) && all_element_arrayref == 0)
{
last_command_exit_value = EXECUTION_FAILURE;
err_unboundvar (name);
@@ -8565,7 +8592,7 @@ param_expand (string, sindex, quoted, expanded_something,
/* If we're not quoted but we still don't want word splitting, make
we quote the IFS characters to protect them from splitting (e.g.,
when $@ is in the string as well). */
else if (quoted == 0 && ifs_is_set && (pflags & PF_ASSIGNRHS))
else if (temp && quoted == 0 && ifs_is_set && (pflags & PF_ASSIGNRHS))
{
temp1 = quote_string (temp);
free (temp);
@@ -8627,7 +8654,8 @@ param_expand (string, sindex, quoted, expanded_something,
performed? Even when IFS is not the default, posix seems to imply
that we behave like unquoted $* ? Maybe we should use PF_NOSPLIT2
here. */
temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted, 0);
/* XXX - bash-4.4/bash-5.0 passing PFLAGS */
temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted, pflags);
tflag |= W_DOLLARAT;
dispose_words (list);
@@ -8669,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,
@@ -9105,11 +9135,11 @@ add_string:
string[sindex+1] == '~')
word->flags |= W_ITILDE;
#endif
#if 0
/* XXX - bash-5.0 */
/* XXX - bash-4.4/bash-5.0 */
if (word->flags & W_ASSIGNARG)
word->flags |= W_ASSIGNRHS;
#endif
word->flags |= W_ASSIGNRHS; /* affects $@ */
if (isexp == 0 && (word->flags & (W_NOSPLIT|W_NOSPLIT2)) == 0 && isifs (c))
goto add_ifs_character;
else
@@ -9191,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);
@@ -9329,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. */
@@ -9341,11 +9373,13 @@ add_twochars:
{
tword = alloc_word_desc ();
tword->word = temp;
#if 0
/* XXX - bash-5.0 */
/* XXX - bash-4.4/bash-5.0 */
if (word->flags & W_ASSIGNARG)
tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS);
#endif
tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS); /* affects $@ */
if (word->flags & W_COMPLETE)
tword->flags |= W_COMPLETE; /* for command substitutions */
temp = (char *)NULL;
temp_has_dollar_at = 0; /* XXX */
@@ -9369,7 +9403,7 @@ add_twochars:
/* "$@" (a double-quoted dollar-at) expands into nothing,
not even a NULL word, when there are no positional
parameters. */
if (list == 0 && has_dollar_at)
if (list == 0 && temp_has_dollar_at) /* XXX - was has_dollar_at */
{
quoted_dollar_at++;
break;
@@ -9389,7 +9423,7 @@ add_twochars:
if (list && list->word && (list->word->flags & W_HASQUOTEDNULL))
had_quoted_null = 1; /* XXX */
if (has_dollar_at)
if (temp_has_dollar_at) /* XXX - was has_dollar_at */
{
quoted_dollar_at++;
if (contains_dollar_at)
@@ -9501,8 +9535,9 @@ add_twochars:
remove_quoted_escapes (temp); /* ??? */
/* We do not want to add quoted nulls to strings that are only
partially quoted; such nulls are discarded. */
if (temp == 0 && (quoted_state == PARTIALLY_QUOTED))
partially quoted; such nulls are discarded. See above for the
exception, which is when the string is going to be split. */
if (temp == 0 && (quoted_state == PARTIALLY_QUOTED) && (word->flags & (W_NOSPLIT|W_NOSPLIT2)))
continue;
/* If we have a quoted null expansion, add a quoted NULL to istring. */
@@ -9604,6 +9639,8 @@ finished_with_string:
/* According to sh, ksh, and Posix.2, if a word expands into nothing
and a double-quoted "$@" appears anywhere in it, then the entire
word is removed. */
/* XXX - exception appears to be that quoted null strings result in
null arguments */
else if (quoted_state == UNQUOTED || quoted_dollar_at)
list = (WORD_LIST *)NULL;
#if 0
+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. */
+5
View File
@@ -220,6 +220,11 @@ ${THIS_SH} ./dollar-at-star5.sub
${THIS_SH} ./dollar-at-star6.sub
${THIS_SH} ./dollar-at-star7.sub
# tests for expansions of $@ and ${a[@]} (vs. $* and ${a[*]}) on the RHS of
# assignment statements with non-default IFS: $@ expands to args or array
# members separated by spaces
${THIS_SH} ./dollar-at-star8.sub
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
+14
View File
@@ -0,0 +1,14 @@
function f {
typeset -a a
a=("$@")
typeset IFS=,
typeset a1="${a[@]} ${a[*]} $@ $* ${@} ${*}"
typeset a2=${a[@]}\ ${a[*]}\ $@\ $*\ ${@}\ ${*} a3 a4
a3="${a[@]} ${a[*]} $@ $* ${@} ${*}"
a4=${a[@]}\ ${a[*]}\ $@\ $*\ ${@}\ ${*}
unset -v IFS
printf '%s\n' "a1=$a1" "a2=$a2" "a3=$a3" "a4=$a4"
}
echo
f a b c
+5
View File
@@ -294,6 +294,11 @@ argv[3] = <'c'>
|is|
|a|
|test|
a1=a b c a,b,c a b c a,b,c a b c a,b,c
a2=a b c a,b,c a b c a,b,c a b c a,b,c
a3=a b c a,b,c a b c a,b,c a b c a,b,c
a4=a b c a,b,c a b c a,b,c a b c a,b,c
xa|xb|xc
xa|xb|xc
a|b|c
+100
View File
@@ -234,3 +234,103 @@ declare -a array=([0]=$'x\001y\177z')
argv[1] = <x^Ay^?z>
declare -a array=([0]=$'x\001y\177z')
declare -A array=([$'x\001y\177z']=$'a\242b\002c' )
abc
def
ghi
jkl
abc def ghi jkl
xxabc
def
ghi
jklyy
xxabc def ghi jklyy
abc
def
ghi
jkl
abc
def ghi
jkl
abc
def ghi
jkl
abc
def ghi
jkl
xxabc
def
ghi
jklyy
xxabc
def ghi
jklyy
abc
def
ghi
jklabc
def
ghi
jkl
abc
def ghi
jklabc
def ghi
jkl
abc:def ghi:jkl
abc:def ghi:jkl
abc:def ghi:jkl
abc
def ghi
jkl
abc:def ghi:jkl
abc:def ghi:jkl
abc
def ghi
jkl
var=abc:def ghi:jkl
abc:def ghi:jkl
var=abc:def ghi:jkl
abcdef ghijkl
abcdef ghijkl
abcdef ghijkl
abcdef ghijkl
abcdef ghijkl
abcdef ghijkl
abcdef ghijkl
var=abcdef ghijkl
abcdef ghijkl
var=abcdef ghijkl
abc
def ghi
jkl
abc def ghi jkl
abc def ghi jkl
abc def ghi jkl
abc
def
ghi
jkl
abc def ghi jkl
abc def ghi jkl
abc
def
ghi
jkl
var=abc def ghi jkl
abc def ghi jkl
var=abc def ghi jkl
abc
def ghi
jkl
[foo]
[]
[foo]
[]
[foo]
[foo]
[foo]
[]
[foo]
[]
[foo]
[]
+1
View File
@@ -404,3 +404,4 @@ ${THIS_SH} ./exp5.sub
${THIS_SH} ./exp6.sub
${THIS_SH} ./exp7.sub
${THIS_SH} ./exp8.sub
${THIS_SH} ./exp9.sub
+69
View File
@@ -0,0 +1,69 @@
# expansion test cases from Posix interp 888
set "abc" "def ghi" "jkl"
unset novar
IFS=' ' # a space
printf '%s\n' $*
printf '%s\n' "$*"
printf '%s\n' xx$*yy
printf '%s\n' "xx$*yy"
printf '%s\n' $@
printf '%s\n' "$@"
printf '%s\n' ${1+"$@"}
printf '%s\n' ${novar-"$@"}
printf '%s\n' xx$@yy
printf '%s\n' "xx$@yy"
printf '%s\n' $@$@
printf '%s\n' "$@$@"
IFS=':'
printf '%s\n' "$*"
var=$*; printf '%s\n' "$var"
var="$*"; printf '%s\n' "$var"
unset var
printf '%s\n' ${var-$*}
printf '%s\n' "${var-$*}"
printf '%s\n' ${var-"$*"}
printf '%s\n' ${var=$*}
printf 'var=%s\n' "$var"
unset var
printf '%s\n' "${var=$*}"
printf 'var=%s\n' "$var"
IFS='' # null
printf '%s\n' "$*"
var=$*; printf '%s\n' "$var"
var="$*"; printf '%s\n' "$var"
unset var
printf '%s\n' ${var-$*}
printf '%s\n' "${var-$*}"
printf '%s\n' ${var-"$*"}
printf '%s\n' ${var=$*}
printf 'var=%s\n' "$var"
unset var
printf '%s\n' "${var=$*}"
printf 'var=%s\n' "$var"
printf '%s\n' "$@"
unset IFS
printf '%s\n' "$*"
var=$*; printf '%s\n' "$var"
var="$*"; printf '%s\n' "$var"
unset var
printf '%s\n' ${var-$*}
printf '%s\n' "${var-$*}"
printf '%s\n' ${var-"$*"}
printf '%s\n' ${var=$*}
printf 'var=%s\n' "$var"
unset var
printf '%s\n' "${var=$*}"
printf 'var=%s\n' "$var"
printf '%s\n' "$@"
set --
printf '[%s]\n' foo "$*"
printf '[%s]\n' foo "$novar$*$(echo)"
printf '[%s]\n' foo $@
printf '[%s]\n' foo "$@"
printf '[%s]\n' foo ''$@
printf '[%s]\n' foo ''"$@"
printf '[%s]\n' foo ''"$novar$@$(echo)"
+9
View File
@@ -286,6 +286,7 @@ run_pending_traps ()
register int sig;
int old_exit_value, x;
WORD_LIST *save_subst_varlist;
HASH_TABLE *save_tempenv;
sh_parser_state_t pstate;
#if defined (ARRAY_VARS)
ARRAY *ps;
@@ -397,6 +398,8 @@ run_pending_traps ()
save_parser_state (&pstate);
save_subst_varlist = subst_assign_varlist;
subst_assign_varlist = 0;
save_tempenv = temporary_env;
temporary_env = 0; /* traps should not run with temporary env */
#if defined (JOB_CONTROL)
save_pipeline (1); /* XXX only provides one save level */
@@ -410,6 +413,7 @@ run_pending_traps ()
subst_assign_varlist = save_subst_varlist;
restore_parser_state (&pstate);
temporary_env = save_tempenv;
}
pending_traps[sig] = 0; /* XXX - move before evalstring? */
@@ -941,6 +945,7 @@ _run_trap_internal (sig, tag)
int flags;
procenv_t save_return_catch;
WORD_LIST *save_subst_varlist;
HASH_TABLE *save_tempenv;
sh_parser_state_t pstate;
#if defined (ARRAY_VARS)
ARRAY *ps;
@@ -977,6 +982,8 @@ _run_trap_internal (sig, tag)
save_parser_state (&pstate);
save_subst_varlist = subst_assign_varlist;
subst_assign_varlist = 0;
save_tempenv = temporary_env;
temporary_env = 0; /* traps should not run with temporary env */
#if defined (JOB_CONTROL)
if (sig != DEBUG_TRAP) /* run_debug_trap does this */
@@ -1014,6 +1021,8 @@ _run_trap_internal (sig, tag)
restore_pipestatus_array (ps);
#endif
temporary_env = save_tempenv;
sigmodes[sig] &= ~SIG_INPROGRESS;
running_trap = 0;
interrupt_state = old_int;