bash-4.4 rc1 release

This commit is contained in:
Chet Ramey
2016-02-23 11:23:40 -05:00
parent 54a5fbe126
commit 690150f9e5
253 changed files with 54541 additions and 51806 deletions
+157 -3
View File
@@ -1,7 +1,158 @@
This document details the changes between this version, bash-4.4-rc1, and
the previous version, bash-4.4-beta.
1. Changes to Bash
a. Fixed several problems with bash completion not special-casing bash syntax
constructs.
b. Fixed a bug that caused the mapfile builtin to not create array variables
when a variable of the same name appears in the temporary environment.
c. Fixed a bug that caused prompt expansion to loop when PS1 contained a
syntax error.
d. Fixed a bug that caused the ${array[@]@A} expansion to split the results even
when double-quoted.
e. There is a new implementation of the code that saves the last CHILD_MAX
exited background pids so their status can be queried later.
f. Bash-4.4 can now be configured and built on very old versions of Solaris 2.
g. Fixed problems with --help support for several builtins.
h. Fixed values added to BASH_SOURCE and BASH_LINENO for functions inherited from
the environment.
i. Fixed a bug that caused background processes run from non-interactive shells
with job control enabled to place the terminal in the wrong process group
under certain circumstances.
j. Fixed a bug that caused `fc' to return an incorrect exit status when
executing commands from the history list.
k. Fixed a bug that caused the shell to exit when a process substitution received
a SIGINT when run in certain terminal emulators.
l. EXECIGNORE now honors the setting of `extglob' when attempting to match
executable names.
m. Fixed a bug where `return' used the wrong exit status when executed in a
DEBUG trap.
n. Fixed a bug that caused a command containing a here-document and an escaped
newline to be stored in the history list incorrectly.
o. Fixed a bug that caused set -e to be honored in cases of builtins invoking
other builtins when it should be ignored.
p. Fixed a bug that caused `readonly' and `export' to create local array
variables when used within shell functions.
q. Fixed a bug that allowed subshells begun to execute process substitutions to
have access to the command's temporary environment.
r. Fixed a bug that could cause the shell to dump core when receiving a SIGCHLD
for which a trap has been set while running in posix mode.
s. Fixed a bug that caused bash to not restore BASH_ARGC, BASH_ARGV, BASH_SOURCE,
BASH_LINENO, and FUNCNAME if the shell received a SIGINT while reading
commands from a file while executing `.'.
t. Fixed a bug that caused the `-o history' option to have no effect when
supplied on the command line when starting a new shell.
u. Fixed a bug that caused history expansions occurring in command substitutions
to not be performed.
v. Fixed a bug that caused `eval' run in a non-interactive shell to disable
history expansion for the remainder of the shell script, even if the script
had previously enabled it.
w. Fixed a bug that caused "$@" to not expand to multiple words when IFS is set
to the empty string.
x. Fixed a bug that caused process and command substitution to inherit output
buffered in the stdio library but not written.
y. Fixed a bug that caused a terminating signal received during `echo' to run
an exit trap in a signal handler context.
z. Fixed a bug that caused a builtin command containing a process substitution to
return the wrong exit status.
aa. Fixed a bug that caused `()' subshells with piped input to incorrectly redirect
the standard input of some of the commands in the subshell from /dev/null.
bb. The history builtin now uses more descriptive error messages for missing or
invalid timestamps.
2. Changes to Readline
a. The history file writing functions only attempt to create and use a backup
history file if the history file exists and is a regular file.
b. Fixed an out-of-bounds read in readline's internal tilde expansion interface.
c. Fixed several redisplay bugs with prompt strings containing multibyte
and non-visible characters whose physical length is longer than the screen
width.
d. Fixed a redisplay bug with prompt strings containing invisible characters
whose physical length exceeds the screen width and using incremental search.
e. Readline prints more descriptive error messages when it encounters errors
while reading an inputrc file.
f. Fixed a bug in the character insertion code that attempts to optimize
typeahead when it reads a character that is not bound to self-insert and
resets the key sequence state.
3. New Features in Bash
a. BASH_COMPAT and FUNCNEST can be inherited and set from the shell's initial
environment.
b. inherit_errexit: a new `shopt' option that, when set, causes command
substitutions to inherit the -e option. By default, those subshells disable
-e. It's enabled as part of turning on posix mode.
c. New prompt string: PS0. Expanded and displayed by interactive shells after
reading a complete command but before executing it.
d. Interactive shells now behave as if SIGTSTP/SIGTTIN/SIGTTOU are set to SIG_DFL
when the shell is started, so they are set to SIG_DFL in child processes.
e. Posix-mode shells now allow double quotes to quote the history expansion
character.
f. OLDPWD can be inherited from the environment if it names a directory.
g. Shells running as root no longer inherit PS4 from the environment, closing a
security hole involving PS4 expansion performing command substitution.
h. 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.
4. New Features in Readline
a. If an incremental search string has its last character removed with DEL, the
resulting empty search string no longer matches the previous line.
b. If readline reads a history file that begins with `#' (or the value of
the history comment character) and has enabled history timestamps, the history
entries are assumed to be delimited by timestamps. This allows multi-line
history entries.
c. Readline now throws an error if it parses a key binding without a terminating
`:' or whitespace.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-beta, and
the previous version, bash-4.4-alpha.
1. Change to Bash
1. Changes to Bash
a. Fixed two bugs that caused out-of-bounds reads when skipping over assignment
statements while finding the word on which to perform programmable
@@ -154,8 +305,11 @@ c. There is a new BASH_LOADABLES_PATH variable containing a list of directories
where the `enable -f' command looks for shared objects containing loadable
builtins.
d. The `kill' builtin now has a `-L' option, equivalent to `-l', for compatibility
with Linux standalone versions of kill.
d. The `complete_fullquote' option to `shopt' changes filename completion to
quote all shell metacharacters in filenames and directory names.
e. The `kill' builtin now has a `-L' option, equivalent to `-l', for
compatibility with Linux standalone versions of kill.
4. New Features in Readline
------------------------------------------------------------------------------
+323 -4
View File
@@ -1,3 +1,318 @@
This document details the changes between this version, bash-4.4-rc1, and
the previous version, bash-4.4-beta.
1. Changes to Bash
a. Fixed several problems with bash completion not special-casing bash syntax
constructs.
b. Fixed a bug that caused the mapfile builtin to not create array variables
when a variable of the same name appears in the temporary environment.
c. Fixed a bug that caused prompt expansion to loop when PS1 contained a
syntax error.
d. Fixed a bug that caused the ${array[@]@A} expansion to split the results even
when double-quoted.
e. There is a new implementation of the code that saves the last CHILD_MAX
exited background pids so their status can be queried later.
f. Bash-4.4 can now be configured and built on very old versions of Solaris 2.
g. Fixed problems with --help support for several builtins.
h. Fixed values added to BASH_SOURCE and BASH_LINENO for functions inherited from
the environment.
i. Fixed a bug that caused background processes run from non-interactive shells
with job control enabled to place the terminal in the wrong process group
under certain circumstances.
j. Fixed a bug that caused `fc' to return an incorrect exit status when
executing commands from the history list.
k. Fixed a bug that caused the shell to exit when a process substitution received
a SIGINT when run in certain terminal emulators.
l. EXECIGNORE now honors the setting of `extglob' when attempting to match
executable names.
m. Fixed a bug where `return' used the wrong exit status when executed in a
DEBUG trap.
n. Fixed a bug that caused a command containing a here-document and an escaped
newline to be stored in the history list incorrectly.
o. Fixed a bug that caused set -e to be honored in cases of builtins invoking
other builtins when it should be ignored.
p. Fixed a bug that caused `readonly' and `export' to create local array
variables when used within shell functions.
q. Fixed a bug that allowed subshells begun to execute process substitutions to
have access to the command's temporary environment.
r. Fixed a bug that could cause the shell to dump core when receiving a SIGCHLD
for which a trap has been set while running in posix mode.
s. Fixed a bug that caused bash to not restore BASH_ARGC, BASH_ARGV, BASH_SOURCE,
BASH_LINENO, and FUNCNAME if the shell received a SIGINT while reading
commands from a file while executing `.'.
t. Fixed a bug that caused the `-o history' option to have no effect when
supplied on the command line when starting a new shell.
u. Fixed a bug that caused history expansions occurring in command substitutions
to not be performed.
v. Fixed a bug that caused `eval' run in a non-interactive shell to disable
history expansion for the remainder of the shell script, even if the script
had previously enabled it.
w. Fixed a bug that caused "$@" to not expand to multiple words when IFS is set
to the empty string.
x. Fixed a bug that caused process and command substitution to inherit output
buffered in the stdio library but not written.
y. Fixed a bug that caused a terminating signal received during `echo' to run
an exit trap in a signal handler context.
z. Fixed a bug that caused a builtin command containing a process substitution to
return the wrong exit status.
aa. Fixed a bug that caused `()' subshells with piped input to incorrectly redirect
the standard input of some of the commands in the subshell from /dev/null.
bb. The history builtin now uses more descriptive error messages for missing or
invalid timestamps.
2. Changes to Readline
a. The history file writing functions only attempt to create and use a backup
history file if the history file exists and is a regular file.
b. Fixed an out-of-bounds read in readline's internal tilde expansion interface.
c. Fixed several redisplay bugs with prompt strings containing multibyte
and non-visible characters whose physical length is longer than the screen
width.
d. Fixed a redisplay bug with prompt strings containing invisible characters
whose physical length exceeds the screen width and using incremental search.
e. Readline prints more descriptive error messages when it encounters errors
while reading an inputrc file.
f. Fixed a bug in the character insertion code that attempts to optimize
typeahead when it reads a character that is not bound to self-insert and
resets the key sequence state.
3. New Features in Bash
a. BASH_COMPAT and FUNCNEST can be inherited and set from the shell's initial
environment.
b. inherit_errexit: a new `shopt' option that, when set, causes command
substitutions to inherit the -e option. By default, those subshells disable
-e. It's enabled as part of turning on posix mode.
c. New prompt string: PS0. Expanded and displayed by interactive shells after
reading a complete command but before executing it.
d. Interactive shells now behave as if SIGTSTP/SIGTTIN/SIGTTOU are set to SIG_DFL
when the shell is started, so they are set to SIG_DFL in child processes.
e. Posix-mode shells now allow double quotes to quote the history expansion
character.
f. OLDPWD can be inherited from the environment if it names a directory.
g. Shells running as root no longer inherit PS4 from the environment, closing a
security hole involving PS4 expansion performing command substitution.
h. 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.
4. New Features in Readline
a. If an incremental search string has its last character removed with DEL, the
resulting empty search string no longer matches the previous line.
b. If readline reads a history file that begins with `#' (or the value of
the history comment character) and has enabled history timestamps, the history
entries are assumed to be delimited by timestamps. This allows multi-line
history entries.
c. Readline now throws an error if it parses a key binding without a terminating
`:' or whitespace.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-beta, and
the previous version, bash-4.4-alpha.
1. Changes to Bash
a. Fixed two bugs that caused out-of-bounds reads when skipping over assignment
statements while finding the word on which to perform programmable
completion.
b. Fixed a memory leak in programmable completion.
c. Fixed a bug that could cause the shell to crash when interrupting the
wait builtin.
d. Fixed a bug that caused ${!vvv@} to be interpreted as introducing the new
`@' operator.
e. Fixed a bug that caused the && and || operators to be incorrectly optimized.
f. The shell now undoes redirections before exiting the shell when the `-e'
option is enabled, and a shell function fails.
g. History expansion now skips over the history expansion character in command
and process substitution.
h. Fixed a bug that caused stray '\001' characters to be added to the output
of `declare -p'.
i. Fixed a memory leak when processing declare commands that perform compound
array assignments.
j. Fixed a bug that could cause the shell to crash when reading input from a
file and the limit on open file descriptors is high.
k. Fixed a bug that caused the ERR and RETURN traps to be unset if they were
set in a shell function but unset previously.
l. Fixed a bug that caused several signals to be ignored if `exec' failed in
an interactive shell.
m. A posix-mode non-interactive shell now considers a parameter expansion error
to be a fatal error.
n. The `time' command now prints timing statistics for failed commands when
the -e option is enabled.
o. Fixed a bug that caused the shell to crash when attempting to indirectly
expand a shell variable with an invalid name.
p. Fixed a bug that caused the shell to crash when running a trap containing
a process substitution.
q. Bash now prints the keyword `function' before a function with the same name
as a reserved word when using `declare -f' to avoid parse errors when
reusing the output as input.
r. Fixed a bug that caused the shell to crash when using declare -g to attempt
to redefine an existing global indexed array variable as an associative
array.
s. Fixed a memory leak that occurred when interrupting brace expansions
generating a sequence.
t. Fixed a bug that resulted in alias expansion in redirections.
u. The `declare -a' and `declare -A' commands now print fewer warnings when
attempting to create and initialize an array at the same time, but
relying on word expansions to construct the compound assignment.
v. The `help' builtin now behaves better in locales where each wide
character occupies more than one display column.
w. The `read' builtin no longer has a possible race condition when a timeout
occurs.
x. Fixed several expansion problems encountered when IFS="'".
y. Fixed a problem with the expansion of $'\c?'.
z. Bash no longer splits the expansion of here-strings, as the documentation
has always said.
aa. Bash now puts `s' in the value of $- if the shell is reading from standard
input, as Posix requires.
bb. Fixed a bug that caused the shell to crash if invoked with a NULL
environment.
cc. The shell now only trusts an inherited value for $PWD if it begins with a
`/'.
dd. Fixed a memory leak when creating local array variables and assigning to
them using compound assignment with the `declare' builtin.
ee. Fixed a bug that could cause the shell to crash when processing nested here
documents inside a command substitution.
ff. Array keys and values are now displayed using $'...' quoting where
appropriate.
gg. Fixed a bug that could cause the shell to crash if the replacement string
in pattern substitution was NULL.
hh. Fixed a bug that could cause the shell to crash if a command substitution
contained a non-fatal syntax error.
ii. Fixed a bug that could cause the shell to crash if variable indirection
resulted in a NULL variable.
jj. Fixed a bug that could cause the shell to crash if a long string contained
multiple unterminated parameter expansion constructs.
kk. Improved the code that acts on SIGINT received while waiting for a child
process only if the child exits due to SIGINT.
ll. $BASH_SUBSHELL now has more consistent values in asynchronous simple
commands.
2. Changes to Readline
a. Colored completion prefixes are now displayed using a different color, less
likely to collide with files.
b. Fixed a bug that caused vi-mode character search to misbehave when
running in callback mode.
c. Fixed a bug that caused output to be delayed when input is coming from a
macro in vi-mode.
d. Fixed a bug that caused the vi-mode `.' command to misbehave when redoing
a multi-key key sequence via a macro.
e. Fixed a bug that caused problems with applications that supply their own
input function when performing completion.
f. When read returns -1/EIO when attempting to read a key, return an error
instead of line termination back to the caller.
g. Updated tty auditing feature based on patch from Red Hat.
h. Fixed a bug that could cause the history library to crash on overflows
introduced by malicious editing of timestamps in the history file.
3. New Features in Bash
a. `make install' now installs the example loadable builtins and a set of
bash headers to use when developing new loadable builtins.
b. `enable -f' now attempts to call functions named BUILTIN_builtin_load when
loading BUILTIN, and BUILTIN_builtin_unload when deleting it. This allows
loadable builtins to run initialization and cleanup code.
c. There is a new BASH_LOADABLES_PATH variable containing a list of directories
where the `enable -f' command looks for shared objects containing loadable
builtins.
d. The `complete_fullquote' option to `shopt' changes filename completion to
quote all shell metacharacters in filenames and directory names.
e. The `kill' builtin now has a `-L' option, equivalent to `-l', for
compatibility with Linux standalone versions of kill.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-alpha, and
the previous version, bash-4.3-release.
@@ -236,7 +551,7 @@ www. Fixes for upper and lower-casing multibyte characters, some locales have
bytes.
xxx. Fixed a bug that caused the ERR trap in a shell function to have the
right value for $LINENO.
wrong value for $LINENO.
yyy. Fixed a bug that resulted in incorrect quoting of regexps for the =~
operator when an open brace appears without a close brace.
@@ -323,6 +638,10 @@ vvvv. Fixed a bug that caused the completion code to read past the end of the
wwww. Fixed a bug that caused case statements within loops contained in a
command substitution to be parsed incorrectly.
xxxx. Fixed a bug that could cause SIGCHLD handling to be delayed after
running `wait' with no arguments and interrupting it with ^C without
a trap handler installed.
2. Changes to Readline
a. A bug that caused vi-mode `.' to be unable to redo `c', `d', and `y'
@@ -371,9 +690,9 @@ o. Fixed a bug that caused history expansion to disregard characters that are
p. Fixed a bug that could cause reading past the end of a string when reading
the value when binding the set of isearch terminators.
q. Fixed a bug that caused readline commands that depend on knowing which
q. Fixed a bug that caused readline commands that depend on knowing which
key invoked them to misbehave when dispatching key sequences that are
prefixes of other key bindings.
prefixes of other key bindings.
r. Paren matching now works in vi insert mode.
@@ -439,7 +758,7 @@ r. Executing the rhs of && and || will no longer cause the shell to fork if
it's not necessary.
s. The `local' builtin takes a new argument: `-', which will cause it to save
and the single-letter shell options and restore their previous values at
the single-letter shell options and restore their previous values at
function return.
t. `complete' and `compgen' have a new `-o nosort' option, which forces
+5 -1
View File
@@ -411,7 +411,7 @@ compat40 set
compat41 set
- interrupting a command list such as "a ; b ; c" causes the execution
of the entire list to be aborted (in versions before bash-4.1,
of the entire list to be aborted (in versions before bash-4.0,
interrupting one command in a list caused the next to be executed)
- when in posix mode, single quotes in the `word' portion of a
double-quoted parameter expansion define a new quoting context and
@@ -427,6 +427,10 @@ compat43 set
(declare -a foo='(1 2)')
- word expansion errors are considered non-fatal errors that cause the
current command to fail, even in Posix mode
- when executing a shell function, the loop state (while/until/etc.) is
not reset, so `break' or `continue' in a shell function will break or
continue loops in the calling context. Bash-4.4 and later reset the
loop state to prevent this.
-------------------------------------------------------------------------------
+740 -26
View File
@@ -6554,7 +6554,7 @@ jobs.c
to 1 if terminal pgrp != shell pgrp
- {stop_pipeline,make_child,wait_for}: if we are running in the
background, don't mess with the terminal's process group; assume that
the parent shell will do that. Fixes bug reprted by Greg Wooledge
the parent shell will do that. Fixes bug reported by Greg Wooledge
<wooledg@eeg.ccf.org>
shell.c
@@ -6880,9 +6880,10 @@ builtins/evalstring.c
10/2
----
jobs.c
- bgp_prune: don't do anything if bgpids.npid == 0 or bgpids.list == NULL.
This can happen if something gets run before the job control framework
is initialized. Bug report from <mancha1@zoho.com>
- bgp_prune: don't do anything if bgpids.npid == 0 or
bgpids.list == NULL. This can happen if something gets run before
the job control framework is initialized. Bug report from
<mancha1@zoho.com>
10/3
----
@@ -9224,14 +9225,15 @@ general.h
enable for load and unload hook functions
builtins/enable.def
- dyn_load_builtin: attempt to execute a function named BUILTIN_builtin_load,
where BUILTIN is the name of the command being loaded. If that
function returns 0, the load fails
- dyn_unload_builtin: attempt to execute a function named BUILTIN_builtin_unload,
where BUILTIN is the name of the command being unloaded. It offers a
dynamic builtin a way to clean up after itself. Inspired by
suggestion from Piotr Grzybowski <narsil.pl@gmail.com> in response
to a bug report from isabella parakiss <izaberina@gmail.com>
- dyn_load_builtin: attempt to execute a function named
BUILTIN_builtin_load, where BUILTIN is the name of the command being
loaded. If that function returns 0, the load fails
- dyn_unload_builtin: attempt to execute a function named
BUILTIN_builtin_unload, where BUILTIN is the name of the command
being unloaded. It offers a dynamic builtin a way to clean up after
itself. Inspired by suggestion from Piotr Grzybowski
<narsil.pl@gmail.com> in response to a bug report from isabella
parakiss <izaberina@gmail.com>
8/6
---
@@ -9319,8 +9321,8 @@ execute_cmd.c
8/10
----
config-top.h
- OPENLOG_OPTS: if SYSLOG_HISTORY is defined, define to LOG_PID, so each
message is tagged with the pid
- OPENLOG_OPTS: if SYSLOG_HISTORY is defined, define to LOG_PID, so
each message is tagged with the pid
bashhist.h
- bash_syslog_history: the first time it's called, call openlog with
@@ -9591,8 +9593,8 @@ variables.c
9/17
----
subst.c
- do_compound_assignment: make sure to dispose of word list generated by
expand_compound_array_assignment; fixes memory leak reported in
- do_compound_assignment: make sure to dispose of word list generated
by expand_compound_array_assignment; fixes memory leak reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1264101
variables.c
@@ -9616,10 +9618,10 @@ array.c
generate the value instead of using sh_double_quote unconditionally
assoc.c
- assoc_to_assign: if either the key or the value of an associative array
element contains non-printable characters (ansic_shouldquote returns
true), use ansic_quote to quote them instead of using double quotes
unconditionally
- assoc_to_assign: if either the key or the value of an associative
array element contains non-printable characters (ansic_shouldquote
returns true), use ansic_quote to quote them instead of using double
quotes unconditionally
9/19
----
@@ -9666,10 +9668,10 @@ lib/readline/rlconf.h
9/24
----
jobs.c
- waitchld: if we get a SIGINT while waiting for a child to exit, but the
kernel doesn't interrupt the waitpid(2) call, assume the child caught
SIGINT if it exited for some reason other than SIGINT. Fix suggested
by Stephane Chazelas <stephane.chazelas@gmail.com>
- waitchld: if we get a SIGINT while waiting for a child to exit, but
the kernel doesn't interrupt the waitpid(2) call, assume the child
caught SIGINT if it exited for some reason other than SIGINT. Fix
suggested by Stephane Chazelas <stephane.chazelas@gmail.com>
input.c
- make_buffered_stream: use B_TEXT in buffered stream flags instead
@@ -9690,8 +9692,8 @@ execute_cmd.c
10/1
----
builtins/kill.def
- kill_builtin: make -L equivalent to -l for compatibility with other (Linux)
versions of kill
- kill_builtin: make -L equivalent to -l for compatibility with other
(Linux) versions of kill
doc/{bash.1,bashref.texi}
- kill: document new `-L' option
@@ -9699,3 +9701,715 @@ doc/{bash.1,bashref.texi}
10/2
----
[bash-4.4-beta frozen]
10/5
----
doc/{bash.1,bashref.texi}
- LC_TIME: document that the shell recognizes it and calls setlocale
when it changes; and that the shell uses it for time formatting
10/6
----
subst.c
- skip_single_quoted: now takes an additional `flags' argument, like
skip_double_quoted; changed callers
- skip_single_quoted: now pays attention to SX_COMPLETE flag, allows
backslash to escape single quote, like $'...' allows
- skip_to_delim: added case where we are completing and we are
skipping over a $'...' string to call skip_single_quoted with
SX_COMPLETE flag to allow backslash to quote single quote. Fixes
bug reported by Daniel Colascione <dancol@dancol.org>
- char_is_quoted: make analogous changes to handle $'...' so we can
accommodate $'ab \' cd'
10/11
-----
subst.c,bashjmp.h
- no_longjmp_on_fatal_error: now global so other parts of the shell can
use it
arrayfunc.c
- expand_array_index: if no_longjmp_on_fatal_error is non-zero, don't
longjmp to top_level, just return 0. Fixes bug reported by
isabella parakiss <izaberina@gmail.com>
subst.c
- CQ_RETURN: restore old value of no_longjmp_on_fatal_error (oldjmp);
make sure all callers (skip_matched_pair, skip_to_delim,
char_is_quoted) save no_longjmp_on_fatal_error to oldjmp before
setting it to 1
expr.c
- expr_streval: if longjmping after an unbound variable error, jump
back to expr toplevel (evalbuf) if no_longjmp_on_fatal_error is set
in an interactive shell
variables.c
- push_func_var: if pushing an array variable, such as when a variable
in the temporary environment is promoted to an array by mapfile when
the shell is in posix mode (so variable assignments preceding special
builtins or shell functions persist in the shell environment after
the builtin returns), make sure to copy the array or hash table so
the variable is duplicated correctly. Fixes seg fault reported by
Linda Walsh <bash@tlinx.org>
10/13
-----
variables.c
- initialize_shell_variables: add call to sv_shcompat, so BASH_COMPAT
can be set in the initial environment
execute_cmd.c
- execute_function: set loop_level to 0 only if shell_compatibility_level
is greater than bash-4.3; this was kind of an incompatible change.
Report from Carlos Pita <carolosjosepita@gmail.com>
COMPAT,doc/{bash.1,bashref.texi}
- compat43: added loop_level changes to description
10/15
-----
lib/sh/casemod.c,lib/readline/display.c
- make sure mb_cur_max variable is defined outside of HANDLE_MULTIBYTE
if it's used outside HANDLE_MULTIBYTE. Fixes from Greg Wooledge
<wooledg@eeg.ccf.org>
support/Makefile.in
- bash.pc: remove as part of distclean, not clean. Report from Andreas
Schwab <schwab@linux-m68k.org>
10/17
-----
subst.c
- array_var_assignment: make sure to call quote_string or quote_escapes
on the assignment string, so spaces in the assignment survive word
splitting. Fixes bug reported by isabella parakiss
<izaberina@gmail.com>
10/20
-----
doc/{bash.1,bashref.texi}
- word splitting: make sure that newline is listed as one of the IFS
whitespace characters. Fixes omission reported by ziyunfei
<446240525@qq.com>
lib/readline/histfile.c
- history_do_write: make sure that we only create and use the tempfile
if the history file exists and is a regular file. Reported several
times, most recent check the result of a report from
<marko.teiste@gmail.com>
10/22
-----
jobs.c
- delete_all_jobs: if running_only == 0, we are eventually going to
clear the bgpids list, so don't bother to add pids to it in
delete_job (call with DEL_NOBGPID flag if running_only == 0)
10/24
-----
jobs.[ch]
- bgpids: new implementation from a patch from John Fremlin
<john@fb.com>, uses an array for the list of the last CHILD_MAX
terminated background pids, and a separate hash table to search it.
The storage can be freed as a unit, and the size of the hash table
(currently 4096) is independent of the size of the bgpids table
subst.c
- inherit_errexit: new variable to control whether or not command
substitution inherits the -e (errexit) option. Disabled by default
general.c
- posix_initialize: set inherit_errexit = 1 when Posix mode is enabled
builtins/shopt.def
- inherit_errexit: new shell option, tracks value of inherit_errexit,
allows command substitution to inherit the setting of errexit without
posix mode. From a request and patch submitted by Christoph Gysin
<christoph.gysin@gmail.com>
{version,version2}.c
- use #if HAVE_SNPRINTF instead of #if defined in case configure
decides to #define it to 0. Fixes problem reported by Klaus Ziegler
<klausz@haus-gisela.de>
configure.ac
- when checking for sys/resource.h, make sure to include <sys/time.h>
for the benefit of both old systems that require it and new versions
of autoconf that require a header file to compile to report its
presence. Reported by Klaus Ziegler <klausz@haus-gisela.de>
10/26
-----
subst.h
- SD_ARITHEXP: new flag value for skip_to_delim, supports parsing
arithmetic expressions in parameter expansions
subst.c
- skip_to_delim: handle SD_ARITHEXP flag by skipping parentheses for
subexpressions and allowing ?: expression to not terminate an
arithmetic expression delimited by `:'
- skiparith: just call skip_to_delim with the SD_ARITHEXP option and
the right delimiter string and return the right result. Fixes bug
reported by <grishalevit@gmail.com>
include/shmbchar.h
- strip out everything except what is needed to support is_basic and
similar functions, since the mbchar_t typedef apparently conflicts
with some AIX-specific type definition. Problem reported by
Michael Felt <aixtools@gmail.com>
10/27
-----
builtins/{set,ulimit}.def
- {set,ulimit}_builtin: make sure that --help is treated the same as
-? and prints a message and returns. Fixes bug reported by ziyunfei
<446240525@qq.com>
builtins/*.def
- make sure to consistently use builtin_help() instead of mix of that
function and builtin_usage()
10/29
-----
doc/{bash.1,bashref.texi}
- BASH_CMDS, BASH_ALIASES: note that removing elements from these
array variables is not currently reflected in the command hash
table and alias list, respectively. Reported by isabella parakiss
<izaberina@gmail.com>
10/30
-----
eval.c
- reader_loop: if PS0 is set in an interactive shell, expand and
display it after reading a (complete) command but before executing
it. This differs from the DEBUG trap because the DEBUG trap is
executed once for each simple command (and some others, like each
time through a for loop). From a patch submitted by Dan Stromberg
<dstromberglists@gmail.com>
parse.y
- prompt_again: set ps0_prompt from $PS0 in an interactive shell
doc/{bash.1,bashref.texi}
- PS0: document new prompt string
11/3
----
subst.c
- cond_expand_node: if special > 0, remove quoted nulls from the word
list, since no word splitting takes place. Fixes bug reported by
Corentin Peuvrel <cpeuvrel@pom-monitoring.com>
11/4
----
doc/{bash.1,builtins.texi}
- inherit_errexit: add to shopt description; modify Posix mode
description
11/9
----
lib/readline/util.c
- rl_tilde_expand: fix out-of-bounds read caused when this function
is invoked with rl_point == 0. Bug reported by Hanno Böck
<hanno@hboeck.de>
11/11
-----
{nojobs,jobs}.c
- get_original_tty_job_signals: force the original signal disposition
for SIGTSTP/SIGTTIN/SIGTTOU to SIG_DFL in interactive shells. This
will force child processes to get SIG_DFL even if the shell is
started with those signals ignored. From a bug report from
Keith Thompson <keithsthompson@gmail.com>
11/13
-----
make_cmd.c
- make_function_def: if a function is being defined without a source
file, and the shell has not been initialized, assume that the
function is being imported from the environment and set the
source_file struct member to "environment". Set to "main" if the
shell has been initialized. Fixes bug reported on savannah by
Arno-Can Uestuensoez
https://savannah.gnu.org/support/index.php?108903
subst.c
- skip_to_delim: if the shell is in posix mode (posixly_correct != 0)
and performing history expansion ((flags & SD_HISTEXP) != 0), allow
double quotes to quote the history expansion character. TENTATIVE
CHANGE, inspired by
https://savannah.gnu.org/support/index.php?108491
11/14
-----
jobs.c
- wait_for: modify change from 4/23 to only give the terminal to
shell_pgrp if not running in the background and subshell_environment
indicates we're not in a pipeline and not an async command. Fixes
bug reported by konsolebox <konsolebox@gmail.com>
11/16
-----
doc/{bash.1,bashref.texi}
- document new posix-mode behavior of not giving ! special meaning
within double quotes, even if histexpand is enabled
11/17
-----
builtins/evalfile.c
- fc_execute_file: pass FEVAL_BUILTIN flag to _evalfile so it returns
the value of parse_and_execute after executing the commands in the
file. Fixes bug reported by Chris Marusich <cmmarusich@gmail.com>
11/20
-----
subst.c
- process_substitute: don't unconditionally set pipeline_pgrp to
shell_pgrp; do that only if pipeline_pgrp == 0 (we haven't forked
yet) or if we know we haven't forked for a command, a pipeline,
or an async command. Fixes bug reported by
<gnu.20.drkshadow@spamgourmet.com>
as https://savannah.gnu.org/support/index.php?108593
11/24
-----
variables.c
- set_pwd: inherit the value of OLDPWD from the initial environment
if it names a directory. From a report from John Wiersba
<jrw32982@yahoo.com>
builtins/set.def
- -T: fix help text to note that the DEBUG and RETURN traps are both
inherited if this is set. Report from Grisha Levin
<grishalevit@gmail.com>
doc/{bash.1,bashref.texi}
- HISTIGNORE,GLOBIGNORE: note that the pattern matching is subject to
the setting of the `extglob' variable. Clarification raised by
Aharon Robbins <arnold@skeeve.com>
builtins/jobs.def,doc/{bash.1,bashref.texi}
- disown: add text to synopsis making it clear that disown takes a
pid argument. From a report from Matthew Stanfield
<matthew@i-dig.info>
findcmd.c,doc/{bash.1,bashref.texi}
- EXECIGNORE: change pattern matching to use FNMATCH_EXTFLAG like other
IGNORE variables. From a report from Aharon Robbins <arnold@skeeve.com>
trap.c
- _run_trap_internal: make sure to catch and use return values supplied
as arguments to `return'; instead of just catching return, make sure
we use return_catch_value as well. Fixes bug reported by
Grisha Levit <grishalevit@gmail.com>, affects RETURN, DEBUG, ERROR
traps
11/30
-----
lib/readline/display.c
- rl_redisplay: fix code that deals with prompts that contain
multibyte characters whose physical length is longer than the screen
width (so the prompt line wraps) to deal with invisible characters
in the prompt and set the inv_lbreaks offsets correctly and set
lpos appropriately
- _rl_move_cursor_relative: always called with either visible line or
invisible line. Decide whether we are being called with the invisible
line (or a portion thereof) as the DATA argument; make sure to account
for invisible characters in the last line of the prompt by offsetting
the desired buffer offset (NEW) by where DATA starts in invisible line
and checking whether that is past the last invisible character in
the prompt
- _rl_move_cursor_relative: do the same for the visible line by using
the visible line lbreaks array instead of _rl_screenwidth, since
that fails in the presence of multibyte characters (buffer offset
vs. physical screen position). These fix bug with prompts with
multibyte characters and invisible characters that are longer than
the screen width reported by Ryo Furue <ryofurue@gmail.com>
12/1
----
parse.y,make_cmd.c
- here_doc_first_line: new variable, set to non-zero to indicate the
first line of possibly multiple here documents associated with the
current command. Set in parse.y:gather_here_documents() before
reading any here documents, set to 0 after reading the first line
of any here document in make_cmd.c:make_here_document().
parse.y
- history_delimiting_chars: if parser_state indicates we are reading
a here document, don't use current_command_line_count to see whether
or not we're on the first line of a here document -- it can be fooled
by multi-line commands (or even backslash-escaped newlines). Use
here_doc_first_line to check that directly. Fixes bug reported by
Geoffrey Allott <geoffrey@allott.email>
shell.h,parse.y
- save and restore here_doc_first_line as part of the shell's parser
state
lib/sh/tmpfile.c
- use ANSI-C rand() interface if random() not available. Fixes problem
with linking on (ancient) Solaris 2.4 reported by Klaus Ziegler
<klausz@haus-gisela.de>
12/2
----
aclocal.m4
- RL_LIB_READLINE_VERSION: if cross-compiling, assume current version
of readline if cross-compiling bash while using an external readline
library. Fix from Barry Davis <barry_davis@stormagic.com>
execute_cmd.c
- execute_builtin: save and restore value of builtin_ignoring_errexit
instead of assuming we can set it back to 0 -- the ignore-errexit
cases might be nested
- execute_builtin: after a builtin executes and eval_unwind is set,
set exit_immediately_on_error to 0 if builtin_ignoring_errexit is
set, and back to the value of errexit otherwise, just like the
code that sets -e does. Fixes short-circuiting bug reported by
Marcin Swigon <swigon.mar@gmail.com>
12/5
----
builtins/setattr.def
- set_or_show_attributes: instead of using a fixed string for the
options argument to `declare', which results in export adding the
readonly attribute, build the option string dynamically like in
subst.c:shell_expand_word_list()
- set_or_show_attributes: don't add the -r option to declare if the
attribute passed as an argument doesn't include att_readonly; add
-x if the attribute includes att_exported
- set_or_show_attributes: add the -g option to declare so readonly
and export in functions that go through this code path don't create
local variables. Part of fix for bug reported by ziyunfei
<446240525@qq.com>
execute_cmd.c
- make_internal_declare: if we have an assignment builtin that isn't
supposed to create local variables (export/readonly), make sure to
add the W_ASSNGLOBAL flag to each assignment statement word.
Part of fix for bug reported by ziyunfei <446240525@qq.com> where
readonly can create local variables when invoked with a compound
array assignment as an argument within a shell function
subst.c
- make_internal_declare: added third argument: command name. Not used
in any useful way yet
- do_compound_assignment: handle attempted assignments to readonly
variables and print error messages, like bind_variable does and the
callers expect. This means that assignments to readonly array
variables can't go through a code path that allows them to fail
silently
doc/Makefile.in
- uninstall: run install-info --delete after removing the installed
info file to update the directory file
execute_cmd.c
- execute_disk_command: since we still (and have always) perform
redirections in child processes, we need to mark that state so
we know that we're in a child process. subshell_performing_redirections
is the new variable; non-zero when executing do_redirections()
subst.c
- process_substitute: if we are executing process substitution in a
redirection expansion context (expanding_redir == 1), the child
process should not have access to any temporary environment the
parent has. Call flush_tempenv() in the child process to get rid
of it. Fix for bug reported by Clint Hepner <clint.hepner@gmail.com>
12/9
----
jobs.c
- waitchld: if in posix mode and attempting to let SIGCHLD interrupt the
wait builtin, make sure wait_intr_flag is non-zero before trying to
longjmp to wait_intr_buf. Fixes bug reported by Aharon Robbins
<arnold@skeeve.com>
12/10
-----
lib/readline/display.c
- update_line: if a prompt containing invisible characters changes,
and the change is within the prompt string, we need to redraw the
entire prompt. After that redraw, if the cursor position is after
the first index where the old and new lines differ, we can short-
circuit the update if the line length stays the same
- update_line: if we redraw the entire prompt string because the prompt
contains invisible characters and the first difference is in the
middle of the prompt, we possibly need to adjust our idea of the
first differing character in the old and new lines. We punt and do
a dumb update in this case. Fixes bug with dynamic vi-mode mode
strings containing invisible characters reported by Dylan Cali
<calid1984@gmail.com>
12/11
-----
lib/readline/display.c
- update_line: if we move up to a new screen line, we need to recompute
the number of invisible characters on the new current line
(visible_wrap_offset). Fixes bug reported to bug-readline by
Per Bothner <per@bothner.com>
- update_line: update code that attempts to compute where we are in
the new line buffer. Fixes `vt100' bug reported to bug-readline by
Per Bothner <per@bothner.com>
12/18
-----
execute_cmd.c
- execute_function: unwind-protect and restore BASH_ARGC and BASH_ARGV
- restore_funcarray_state: now global
execute_cmd.h
- make func_array_state type global, add extern function declaration
for restore_funcarray_state
builtins/evalfile.c
- _evalfile: use restore_funcarray_state and pop_args as unwind-protects
to restore BASH_{SOURCE,LINENO,ARGC,ARGV} and FUNCNAME on interrupts.
Fixes bug reported back on 11/10 by Grisha Levit
<grishalevit@gmail.com>
12/20
-----
lib/readline/isearch.c
- _rl_isearch_dispatch: after removing the only character from the
search string with DEL, leaving the search string empty, don't match
the previous line if we didn't have a match before
12/22
-----
bashhist.c
- enable_history_list,remember_on_history: initialize to 0 instead of 1
shell.c
- init_interactive,init_interactive_script: set enable_history_list and
remember_on_history to 1 (defaults)
12/23
-----
variables.c
- initialize_shell_variables: don't inherit PS4 from the environment
if the shell is running with euid == 0; just reset it to `+'. This
is a known potential vulnerability, since PS4 expansion performs
command substitution in the root shell's context before displaying
it. Discussion started by up201407890@alunos.dcc.fc.up.pt
bashhist.c
- bash_history_reinit: initialize remember_on_history to the value of
enable_history_list (set -o history). Fixes bug reported by
Stephane Chazelas <stephane.chazelas@gmail.com> with command-line
option `-o history' not having any effect
12/28
-----
lib/readline/{history.h,histfile.c}
- history_file_version: new int variable, reserved for future use
- history_multiline_entries: new int variable, can be set by the
calling application to enable reading multi-line history entries
from the history file (currently undocumented)
lib/readline/history.c
- _hs_append_history_line: new function, append a line passed as an
argument to a specified history entry, used to create multi-line
history entries
lib/readline/histfile.c
- read_history_range: implement a heuristic that temporarily sets the
history comment character if the first line read from the history
file looks like it has is a timestamp (#[:digit:]) so we can read
timestamps from the history file properly. Originally reported
back in March 2015 by Christoph Anton Mitterer <calestyo@gmail.com>
- read_history_range: make sure history_multiline_entries is non-zero
if the history file looks like it has timestamps
- read_history_range: if we think we have a history file with timestamps
and we read more than one non-timestamp consecutive history lines,
assume they are part of a single multi-line history entry and paste
them together using _hs_append_history_line. Feature most recently
requested by james harvey <jamespharvey20@gmail.com>, also suggested
by Christoph Anton Mitterer <calestyo@gmail.com>
examples/loadables/setpgid.c
- setpgid: new loadable builtin, originally contributed by Jason
Vas Dias <jason.vas.dias@gmail.com>
12/29
-----
bashhist.c
- bash_history_inhibit_expansion: fix cases where a history expansion
should be skipped because it's in a command or process substitution
but there is another history expansion preceding the substitution
on the command line. Don't let the previous history expansion fool
the function into saying the command substitution history expansion
should be performed
builtins/evalstring.c
- parse_prologue: always unwind-protect history_expansion_inhibited,
since history expansion can be enabled in non-interactive shells,
and calling eval once in a non-interactive shell inhibits history
expansion forever even if `set -o histexpand' was run before the
eval
builtins/common.h
- SEVAL_NOHISTEXP: new flag for parse_and_execute/parse_string; means
to not perform history expansion (decouple from SEVAL_NOHIST, which
now means to not remember commands on history); changed all callers
that had SEVAL_NOHIST to have SEVAL_NOHIST|SEVAL_NOHISTEXP
builtins/evalstring.c
- parse_prologue: instead of calling bash_history_disable, set
remember_on_history to 0 if SEVAL_NOHIST and history_expansion_inhibited
to 1 if SEVAL_NOHISTEXP
12/30
-----
subst.c
- skip_to_histexp: new function, a stripped-down version of skip_to_delim.
Used to skip to the next unquoted instance of the history expansion
character, handles peculiar quoting and command/process substitution
requirements. Better fix for bug reported by
Zigmund.Ozean@zig-home.localdomain back in January, prompted by report
from Keith Thompson <keithsthompson@gmail.com>
bashhist.c
- bash_history_inhibit_expansion: use skip_to_histexp instead of
skip_to_delim
subst.c
- parameter_brace_expand_rhs: if the rhs of an expansion is "$@" and
IFS is null, we need to separate the (quoted) positional parameters
in the returned word with a space, and mark the word as needing to
be split on spaces (W_SPLITSPACE). Fix for issues reported back in
October 2014 as the result of an austin-group discussion, and just
re-reported by Martijn Dekker <martijn@inlv.org>
1/4/2016
--------
execute_cmd.c
- execute_simple_command: if autocd is set, invoke a function named
`cd' if one exists, instead of the shell builtin. Feature requested
by transl8czech@gmail.com
builtins/mkbuiltins.c
- if a command's short description is the same as its name (e.g., `true'),
don't mark the short doc to be translated. Report and fix from
Benno Schulenberg <bensberg@justemail.net>
1/6
---
subst.c
- command_substitute,process_substitute: before replacing the file
descriptor underlying stdout (fd 1), make sure to purge any pending
stdio output that hasn't been written successfully, even after a
call to fflush(). Fixes bug reported by cks@cs.toronto.edu
1/7
---
builtins/{echo,printf}.def
- echo_builtin,printf_builtin: don't use terminate_immediately; use
calls to QUIT in the body of the print loop after writes and flushes.
Fixes problem with running the signal handler and exit trap in a
signal context and other bug reported by cks@cs.toronto.edu
builtins/common.c
- sh_chkwrite: put in calls to QUIT to catch signals that interrupt
writes
shell.c
- get_current_user_info: protect endpwent() with #ifdef HAVE_GETPWENT.
Fixes bug reported by pb <p-bauer-schriesheim@t-online.de>
1/8
---
lib/readline/bind.c
- _rl_init_file_error: now a varargs function so it can take format
strings and arguments and pass them to vfprintf
- rl_parse_and_bind: print a warning if we encounter a key binding
string with one or more hyphens but we don't find a valid modifier
(`control', `meta', etc.). Prompted by a report from Andrew Kurn
<kurn@sfu.ca>
- rl_parse_and_bind: improve several existing error messages now that
_rl_init_file_error takes a variable number of arguments
- rl_variable_bind: print error message upon encountering unknown
variable
1/10
----
lib/readline/bind.c
- rl_parse_and_bind: if a `bare' keybinding is supplied without any
terminating `:' or whitespace separating it from the command to be
bound, signal an error
1/11
----
execute_cmd.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
is what command substitution does. Fixes bug reported by Alastair
Hughes <hobbitalastair@yandex.com>
1/12
----
execute_cmd.c
- execute_in_subshell: if a user subshell (`(command)') or other shell
compound command has an input pipe, note for later by setting
stdin_redir. This will inhibit the implicit redirection of standard
input from /dev/null for async commands executed as part of this
subshell. Fixes bug reported by Martin D Kealey <martin@kurahaupo.gen.nz>
- execute_simple_command: if the shell forks to execute this command
because it has an input pipe, set stdin_redir to inhibit later redirection
from /dev/null for async commands
1/13
----
execute_cmd.c
- HASH_BANG_BUFSIZE: use #define for size of buffer used in
READ_SAMPLE_BUF instead of straight constant 80
- HASH_BANG_BUFSIZ: increase to 128 because Linux allows 128 chars in
exec header. Reported by Ludovic Courtès <ludo@gnu.org>
configure.ac
- remove support for purify and purecoverage
- change release level to `rc1'
1/15
----
builtins/enable.def
- dyn_load_builtin: fix missing argument to builtin_error if load function
returns an error. Fix from Aharon Robbins <arnold@skeeve.com>
1/18
----
builtins/history.def
- histtime: display a better error message for invalid timestamps; use
existing `??' string for empty/missing timestamps or invalid history
entries. Suggestion from Reuben Thomas <rrt@sc3d.org>
1/21
----
lib/readline/text.c
- rl_insert: when trying to optimize typeahead, make sure to reset the
key sequence and key sequence length when we read a character that is
not bound to self-insert. Bug report from Geir Hauge
<geir.hauge@gmail.com>
1/25
----
doc/{bash.1,bashref.texi}
- word splitting: add example showing how -d'' is equivalent to -d
after word splitting and null argument removal
1/27
----
doc/{bash.1,bashref.texi}
- read: modify description to make it more clear that the line is split
using the same rules as word splitting, and use `delimiters' instead
of `separators', which people read the wrong way
2/2
---
variables.c
- initialize_shell_variables: allow FUNCNEST to set funcnest_max when
imported from the environment. Inspired by
https://bugzilla.redhat.com/show_bug.cgi?id=1274553
+13
View File
@@ -664,6 +664,7 @@ examples/loadables/necho.c f
examples/loadables/hello.c f
examples/loadables/print.c f
examples/loadables/realpath.c f
examples/loadables/setpgid.c f
examples/loadables/sleep.c f
examples/loadables/strftime.c f
examples/loadables/truefalse.c f
@@ -820,6 +821,7 @@ tests/arith3.sub f
tests/arith4.sub f
tests/arith5.sub f
tests/arith6.sub f
tests/arith7.sub f
tests/array.tests f
tests/array.right f
tests/array1.sub f
@@ -855,6 +857,10 @@ tests/assoc5.sub f
tests/assoc6.sub f
tests/assoc7.sub f
tests/assoc8.sub f
tests/attr.tests f
tests/attr.right f
tests/attr1.sub f
tests/attr2.sub f
tests/braces.tests f
tests/braces.right f
tests/builtins.tests f
@@ -916,6 +922,7 @@ tests/dollar-at-star3.sub f
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-at1.sub f
tests/dollar-at2.sub f
tests/dollar-at3.sub f
@@ -956,6 +963,7 @@ tests/exec9.sub f
tests/exec10.sub f
tests/exec11.sub f
tests/exec12.sub f
tests/exec13.sub f
tests/exp.tests f
tests/exp.right f
tests/exp1.sub f
@@ -1014,6 +1022,9 @@ tests/herestr.right f
tests/herestr1.sub f
tests/histexp.tests f
tests/histexp1.sub f
tests/histexp2.sub f
tests/histexp3.sub f
tests/histexp4.sub f
tests/histexp.right f
tests/history.tests f
tests/history.right f
@@ -1158,6 +1169,7 @@ tests/run-arith f
tests/run-array f
tests/run-array2 f
tests/run-assoc f
tests/run-attr f
tests/run-braces f
tests/run-builtins f
tests/run-case f
@@ -1274,6 +1286,7 @@ tests/varenv4.sub f
tests/varenv5.sub f
tests/varenv6.sub f
tests/varenv7.sub f
tests/varenv8.sub f
tests/version f
tests/version.mini f
tests/vredir.tests f
+12 -6
View File
@@ -1,4 +1,4 @@
# Makefile for bash-4.4, version 4.17
# Makefile for bash-4.4, version 4.18
#
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
@@ -89,10 +89,8 @@ TESTSCRIPT = @TESTSCRIPT@
DEBUGGER_START_FILE = @DEBUGGER_START_FILE@
#If you have purify, and want to use it, uncomment this definition or
# run the make as `make PURIFY=purify'
# or run configure with the --with-purify argument.
PURIFY = @PURIFY@
#If you have purify, and want to use it, run the make as `make PURIFY=purify'
#PURIFY = @PURIFY@
# Here is a rule for making .o files from .c files that does not
# force the type of the machine (like -M_MACHINE) into the flags.
@@ -567,7 +565,7 @@ LOADABLES_DIR = ${top_builddir}/examples/loadables
# Keep GNU Make from exporting the entire environment for small machines.
.NOEXPORT:
.made: $(Program) bashbug
.made: $(Program) bashbug $(SDIR)/man2html$(EXEEXT)
@echo "$(Program) last made for a $(Machine) running $(OS)" >.made
$(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
@@ -719,6 +717,9 @@ ${DEFDIR}/bashgetopt.o: $(BUILTIN_SRCDIR)/bashgetopt.c
${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) builtext.h ) || exit 1
$(SDIR)/man2html$(EXEEXT): ${SUPPORT_SRC}/man2html.c
@(cd $(SDIR) && $(MAKE) $(MFLAGS) all ) || exit 1
# For the justification of the following Makefile rules, see node
# `Automatic Remaking' in GNU Autoconf documentation.
@@ -1077,6 +1078,7 @@ print_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h comman
print_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h
print_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
print_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h
print_cmd.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
print_cmd.o: ${GRAM_H} $(DEFSRC)/common.h
redir.o: config.h bashtypes.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/filecntl.h
redir.o: ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
@@ -1205,6 +1207,7 @@ pcomplete.o: ${BASHINCDIR}/stdc.h hashlib.h pcomplete.h shell.h syntax.h
pcomplete.o: bashjmp.h command.h general.h xmalloc.h error.h variables.h arrayfunc.h conftypes.h quit.h
pcomplete.o: unwind_prot.h dispose_cmd.h make_cmd.h subst.h sig.h pathnames.h
pcomplete.o: externs.h ${BASHINCDIR}/maxpath.h execute_cmd.h
pcomplete.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
pcomplete.o: ${DEFDIR}/builtext.h
# library support files
@@ -1233,6 +1236,7 @@ bracecomp.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h
bracecomp.o: array.h hashlib.h alias.h builtins.h
bracecomp.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
bracecomp.o: make_cmd.h subst.h sig.h pathnames.h externs.h
bracecomp.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
# library dependencies
@@ -1439,6 +1443,7 @@ builtins/printf.o: config.h ${BASHINCDIR}/memalloc.h bashjmp.h command.h error.h
builtins/printf.o: general.h xmalloc.h quit.h dispose_cmd.h make_cmd.h subst.h
builtins/printf.o: externs.h sig.h pathnames.h shell.h syntax.h unwind_prot.h
builtins/printf.o: variables.h arrayfunc.h conftypes.h ${BASHINCDIR}/stdc.h $(DEFSRC)/bashgetopt.h
builtins/printf.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
builtins/printf.o: ${BASHINCDIR}/chartypes.h
builtins/pushd.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/pushd.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
@@ -1447,6 +1452,7 @@ builtins/pushd.o: $(DEFSRC)/common.h pathnames.h
builtins/read.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/read.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
builtins/read.o: shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h unwind_prot.h variables.h arrayfunc.h conftypes.h
builtins/read.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
builtins/read.o: pathnames.h
builtins/return.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
builtins/return.o: quit.h dispose_cmd.h make_cmd.h subst.h externs.h ${BASHINCDIR}/stdc.h
+40 -2
View File
@@ -107,8 +107,35 @@ ee. There is a new BASH_LOADABLES_PATH variable containing a list of directories
where the `enable -f' command looks for shared objects containing loadable
builtins.
ff. The `kill' builtin now has a `-L' option, equivalent to `-l', for compatibility
with Linux standalone versions of kill.
ff. The `complete_fullquote' option to `shopt' changes filename completion to
quote all shell metacharacters in filenames and directory names.
gg. The `kill' builtin now has a `-L' option, equivalent to `-l', for
compatibility with Linux standalone versions of kill.
hh. BASH_COMPAT and FUNCNEST can be inherited and set from the shell's initial
environment.
ii. inherit_errexit: a new `shopt' option that, when set, causes command
substitutions to inherit the -e option. By default, those subshells disable
-e. It's enabled as part of turning on posix mode.
jj. New prompt string: PS0. Expanded and displayed by interactive shells after
reading a complete command but before executing it.
kk. Interactive shells now behave as if SIGTSTP/SIGTTIN/SIGTTOU are set to SIG_DFL
when the shell is started, so they are set to SIG_DFL in child processes.
ll. Posix-mode shells now allow double quotes to quote the history expansion
character.
mm. OLDPWD can be inherited from the environment if it names a directory.
nn. Shells running as root no longer inherit PS4 from the environment, closing a
security hole involving PS4 expansion performing command substitution.
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.
2. New Features in Readline
@@ -144,6 +171,17 @@ i. rl_callback_sigcleanup: a new application function that can clean up and
unset any state set by readline's callback mode. Intended to be used
after a signal.
j. If an incremental search string has its last character removed with DEL, the
resulting empty search string no longer matches the previous line.
k. If readline reads a history file that begins with `#' (or the value of
the history comment character) and has enabled history timestamps, the history
entries are assumed to be delimited by timestamps. This allows multi-line
history entries.
l. Readline now throws an error if it parses a key binding without a terminating
`:' or whitespace.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-4.3 since
the release of bash-4.2. As always, the manual page (doc/bash.1) is
+72 -67
View File
@@ -22,9 +22,7 @@ The following list is what's changed when 'POSIX mode' is in effect:
is stopped is 'Stopped(SIGNAME)', where SIGNAME is, for example,
'SIGTSTP'.
4. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
4. Alias expansion is always enabled, even in non-interactive shells.
5. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
@@ -40,166 +38,173 @@ The following list is what's changed when 'POSIX mode' is in effect:
8. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
9. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
10. The default history file is '~/.sh_history' (this is the default
9. The default history file is '~/.sh_history' (this is the default
value of '$HISTFILE').
11. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
12. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
13. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
14. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
15. Non-interactive shells exit on word expansion errors.
16. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
17. Redirection operators do not perform filename expansion on the
10. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
18. Redirection operators do not perform word splitting on the word in
11. Redirection operators do not perform word splitting on the word in
the redirection.
19. Function names must be valid shell 'name's. That is, they may not
12. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
20. Function names may not be the same as one of the POSIX special
13. Function names may not be the same as one of the POSIX special
builtins.
21. POSIX special builtins are found before shell functions during
14. POSIX special builtins are found before shell functions during
command lookup.
22. Literal tildes that appear as the first character in elements of
15. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
23. The 'time' reserved word may be used by itself as a command. When
16. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
24. When parsing and expanding a ${...} expansion that appears within
17. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
25. The parser does not recognize 'time' as a reserved word if the
18. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
26. If a POSIX special builtin returns an error status, a
19. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
20. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
27. A non-interactive shell exits with an error status if a variable
21. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
28. A non-interactive shell exits with an error status if a variable
22. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command.
29. A non-interactive shell exits with an error status if the
23. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
30. Process substitution is not available.
24. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
31. While variable indirection is available, it may not be applied to
25. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
26. Non-interactive shells exit on word expansion errors.
27. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
28. Process substitution is not available.
29. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
32. Assignment statements preceding POSIX special builtins persist in
30. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
33. Assignment statements preceding shell function calls persist in
31. Assignment statements preceding shell function calls persist in
the shell environment after the function returns, as if a POSIX
special builtin command had been executed.
34. The 'export' and 'readonly' builtin commands display their output
32. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
33. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
34. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
35. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
36. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
35. The 'trap' builtin displays signal names without the leading
37. The 'trap' builtin displays signal names without the leading
'SIG'.
36. The 'trap' builtin doesn't check the first argument for a possible
38. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
37. The '.' and 'source' builtins do not search the current directory
39. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
38. Subshells spawned to execute command substitutions inherit the
value of the '-e' option from the parent shell. When not in POSIX
mode, Bash clears the '-e' option in such subshells.
40. Enabling POSIX mode has the effect of setting the
'inherit_errexit' option, so subshells spawned to execute command
substitutions inherit the value of the '-e' option from the parent
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
39. Alias expansion is always enabled, even in non-interactive shells.
40. When the 'alias' builtin displays alias definitions, it does not
41. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
41. When the 'set' builtin is invoked without options, it does not
42. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
42. When the 'set' builtin is invoked without options, it displays
43. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
43. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
44. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to PHYSICAL mode.
44. The 'pwd' builtin verifies that the value it prints is the same as
45. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
45. When listing the history, the 'fc' builtin does not include an
46. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
46. The default editor used by 'fc' is 'ed'.
47. The default editor used by 'fc' is 'ed'.
47. The 'type' and 'command' builtins will not report a non-executable
48. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
48. The 'vi' editing mode will invoke the 'vi' editor directly when
49. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
49. When the 'xpg_echo' option is enabled, Bash does not attempt to
50. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
50. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
51. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
51. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
52. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
52. The 'read' builtin may be interrupted by a signal for which a trap
53. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
Vendored
+1 -1
View File
@@ -1856,7 +1856,7 @@ main()
],
ac_cv_rl_version=`cat conftest.rlv`,
ac_cv_rl_version='0.0',
ac_cv_rl_version='4.2')])
ac_cv_rl_version='6.3')])
CFLAGS="$_save_CFLAGS"
LDFLAGS="$_save_LDFLAGS"
+2
View File
@@ -902,6 +902,8 @@ array_expand_index (var, s, len)
{
last_command_exit_value = EXECUTION_FAILURE;
if (no_longjmp_on_fatal_error)
return 0;
top_level_cleanup ();
jump_to_top_level (DISCARD);
}
+20 -8
View File
@@ -1,6 +1,6 @@
/* bashhist.c -- bash interface to the GNU history library. */
/* Copyright (C) 1993-2012 Free Software Foundation, Inc.
/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -83,8 +83,8 @@ static struct ignorevar histignore =
/* Non-zero means to remember lines typed to the shell on the history
list. This is different than the user-controlled behaviour; this
becomes zero when we read lines from a file, for example. */
int remember_on_history = 1;
int enable_history_list = 1; /* value for `set -o history' */
int remember_on_history = 0;
int enable_history_list = 0; /* value for `set -o history' */
/* The number of lines that Bash has added to this history session. The
difference between the number of the top element in the history list
@@ -99,6 +99,8 @@ int history_lines_in_file;
/* Non-zero means do no history expansion on this line, regardless
of what history_expansion says. */
int history_expansion_inhibited;
/* If non-zero, double quotes can quote the history expansion character. */
int double_quotes_inhibit_history_expansion = 0;
#endif
/* With the old default, every line was saved in the history individually.
@@ -229,8 +231,18 @@ bash_history_inhibit_expansion (string, i)
/* Make sure the history expansion should not be skipped by quoting or
command/process substitution. */
else if ((t = skip_to_delim (string, 0, hx, SD_NOJMP|SD_HISTEXP)) > 0 && t > i)
return (1);
else if ((t = skip_to_histexp (string, 0, hx, SD_NOJMP|SD_HISTEXP)) > 0)
{
/* Skip instances of history expansion appearing on the line before
this one. */
while (t < i)
{
t = skip_to_histexp (string, t+1, hx, SD_NOJMP|SD_HISTEXP);
if (t <= 0)
return 0;
}
return (t > i);
}
else
return (0);
}
@@ -252,9 +264,9 @@ bash_history_reinit (interact)
{
#if defined (BANG_HISTORY)
history_expansion = interact != 0;
history_expansion_inhibited = 1;
history_expansion_inhibited = 1; /* XXX */
#endif
remember_on_history = enable_history_list = interact != 0;
remember_on_history = enable_history_list;
history_inhibit_expansion_function = bash_history_inhibit_expansion;
}
@@ -270,7 +282,7 @@ bash_history_disable ()
void
bash_history_enable ()
{
remember_on_history = 1;
remember_on_history = enable_history_list = 1;
#if defined (BANG_HISTORY)
history_expansion_inhibited = 0;
#endif
+2
View File
@@ -27,6 +27,8 @@ extern procenv_t top_level;
extern procenv_t subshell_top_level;
extern procenv_t return_catch; /* used by `return' builtin */
extern int no_longjmp_on_fatal_error;
#define SHFUNC_RETURN() sh_longjmp (return_catch, 1)
#define COPY_PROCENV(old, save) \
+1
View File
@@ -41,6 +41,7 @@
#define SPECIAL_BUILTIN 0x08 /* This is a Posix `special' builtin. */
#define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */
#define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */
#define LOCALVAR_BUILTIN 0x40 /* This builtin creates local variables */
#define BASE_INDENT 4
+2
View File
@@ -531,6 +531,7 @@ printf.o: $(topdir)/subst.h $(topdir)/externs.h $(topdir)/sig.h
printf.o: ../pathnames.h $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h
printf.o: $(topdir)/variables.h $(topdir)/conftypes.h $(BASHINCDIR)/stdc.h $(srcdir)/bashgetopt.h
printf.o: $(topdir)/bashtypes.h ${srcdir}/common.h $(BASHINCDIR)/chartypes.h
printf.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
printf.o: ../pathnames.h
pushd.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
pushd.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
@@ -545,6 +546,7 @@ read.o: $(topdir)/quit.h $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h
read.o: $(topdir)/subst.h $(topdir)/externs.h $(BASHINCDIR)/maxpath.h
read.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/unwind_prot.h $(topdir)/variables.h $(topdir)/conftypes.h
read.o: $(BASHINCDIR)/shtty.h $(topdir)/sig.h
read.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
read.o: $(topdir)/arrayfunc.h ../pathnames.h
return.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
return.o: $(topdir)/error.h $(topdir)/general.h $(topdir)/xmalloc.h
+2 -1
View File
@@ -1,7 +1,7 @@
This file is alias.def, from which is created alias.c
It implements the builtins "alias" and "unalias" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -183,6 +183,7 @@ unalias_builtin (list)
case 'a':
aflag = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1 -1
View File
@@ -1,7 +1,7 @@
This file is bind.def, from which is created bind.c.
It implements the builtin "bind" in Bash.
Copyright (C) 1987-2014 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+3 -1
View File
@@ -1,7 +1,7 @@
This file is cd.def, from which is created cd.c. It implements the
builtins "cd" and "pwd" in Bash.
Copyright (C) 1987-2013 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -298,6 +298,7 @@ cd_builtin (list)
xattrflag = 1;
break;
#endif
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -487,6 +488,7 @@ pwd_builtin (list)
case 'L':
verbatim_pwd = 0;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+3 -1
View File
@@ -1,6 +1,6 @@
/* common.c - utility functions for all builtins */
/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -343,7 +343,9 @@ int
sh_chkwrite (s)
int s;
{
QUIT;
fflush (stdout);
QUIT;
if (ferror (stdout))
{
sh_wrerror ();
+1
View File
@@ -50,6 +50,7 @@ do { \
#define SEVAL_NOLONGJMP 0x040
#define SEVAL_FUNCDEF 0x080 /* only allow function definitions */
#define SEVAL_ONECMD 0x100 /* only allow a single command */
#define SEVAL_NOHISTEXP 0x200 /* inhibit history expansion */
/* Flags for describe_command, shared between type.def and command.def */
#define CDESC_ALL 0x001 /* type -a */
+2 -1
View File
@@ -1,7 +1,7 @@
This file is complete.def, from which is created complete.c.
It implements the builtins "complete", "compgen", and "compopt" in Bash.
Copyright (C) 1999-2014 Free Software Foundation, Inc.
Copyright (C) 1999-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -325,6 +325,7 @@ build_actions (list, flagp, actp, optp)
case 'X':
Xarg = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+2 -1
View File
@@ -65,7 +65,7 @@ $FUNCTION declare_builtin
$SHORT_DOC typeset [-aAfFgilnrtux] [-p] name[=value] ...
Set variable values and attributes.
Obsolete. See `help declare'.
A synonym for `declare'. See `help declare'.
$END
#include <config.h>
@@ -224,6 +224,7 @@ declare_internal (list, local_var)
flags_off |= att_capcase|att_lowercase;
break;
#endif /* CASEMOD_ATTRS */
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+3 -3
View File
@@ -1,7 +1,7 @@
This file is echo.def, from which is created echo.c.
It implements the builtin "echo" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -161,7 +161,6 @@ just_echo:
clearerr (stdout); /* clear error before writing and testing success */
terminate_immediately++;
while (list)
{
i = len = 0;
@@ -180,6 +179,7 @@ just_echo:
fflush (stdout); /* Fix for bug in SunOS 5.5 printf(3) */
#endif
}
QUIT;
if (do_v9 && temp)
free (temp);
list = list->next;
@@ -190,11 +190,11 @@ just_echo:
}
if (list)
putchar(' ');
QUIT;
}
if (display_return)
putchar ('\n');
terminate_immediately--;
return (sh_chkwrite (EXECUTION_SUCCESS));
}
+3 -2
View File
@@ -1,7 +1,7 @@
This file is enable.def, from which is created enable.c.
It implements the builtin "enable" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -151,6 +151,7 @@ enable_builtin (list)
builtin_error (_("dynamic loading not available"));
return (EX_USAGE);
#endif /* HAVE_DLCLOSE */
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -383,7 +384,7 @@ dyn_load_builtin (list, flags, filename)
r = (*loadfunc) (name);
if (r == 0)
{
builtin_error (_("load function for %s returns failure (%d): not loaded"), r);
builtin_error (_("load function for %s returns failure (%d): not loaded"), name, r);
free (funcname);
continue;
}
+1 -1
View File
@@ -1,7 +1,7 @@
This file is eval.def, from which is created eval.c.
It implements the builtin "eval" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+30 -23
View File
@@ -1,6 +1,6 @@
/* evalfile.c - read and evaluate commands from a file or file descriptor */
/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -94,6 +94,7 @@ _evalfile (filename, flags)
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
struct func_array_state *fa;
# if defined (DEBUGGER)
SHELL_VAR *bash_argv_v, *bash_argc_v;
ARRAY *bash_argv_a, *bash_argc_a;
@@ -243,6 +244,17 @@ file_error_and_exit:
array_push (bash_lineno_a, t);
free (t);
array_push (funcname_a, "source"); /* not exactly right */
fa = (struct func_array_state *)xmalloc (sizeof (struct func_array_state));
fa->source_a = bash_source_a;
fa->source_v = bash_source_v;
fa->lineno_a = bash_lineno_a;
fa->lineno_v = bash_lineno_v;
fa->funcname_a = funcname_a;
fa->funcname_v = funcname_v;
if (flags & FEVAL_UNWINDPROT)
add_unwind_protect (restore_funcarray_state, fa);
# if defined (DEBUGGER)
/* Have to figure out a better way to do this when `source' is supplied
arguments */
@@ -251,6 +263,8 @@ file_error_and_exit:
array_push (bash_argv_a, (char *)filename);
tt[0] = '1'; tt[1] = '\0';
array_push (bash_argc_a, tt);
if (flags & FEVAL_UNWINDPROT)
add_unwind_protect (pop_args, 0);
}
# endif
#endif
@@ -280,31 +294,23 @@ file_error_and_exit:
{
if (flags & FEVAL_NONINT)
interactive = old_interactive;
#if defined (ARRAY_VARS)
restore_funcarray_state (fa);
# if defined (DEBUGGER)
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
/* Don't need to call pop_args here until we do something better
when source is passed arguments (see above). */
array_pop (bash_argc_a);
array_pop (bash_argv_a);
}
# endif
#endif
return_catch_flag--;
sourcelevel--;
COPY_PROCENV (old_return_catch, return_catch);
}
#if defined (ARRAY_VARS)
/* These two variables cannot be unset, and cannot be affected by the
sourced file. */
array_pop (bash_source_a);
array_pop (bash_lineno_a);
/* FUNCNAME can be unset, and so can potentially be changed by the
sourced file. */
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
if (nfv == funcname_v)
array_pop (funcname_a);
# if defined (DEBUGGER)
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
array_pop (bash_argc_a);
array_pop (bash_argv_a);
}
# endif
#endif
/* If we end up with EOF after sourcing a file, which can happen when the file
doesn't end with a newline, pretend that it did. */
if (current_token == yacc_EOF)
@@ -355,8 +361,9 @@ fc_execute_file (filename)
int flags;
/* We want these commands to show up in the history list if
remember_on_history is set. */
flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE;
remember_on_history is set. We use FEVAL_BUILTIN to return
the result of parse_and_execute. */
flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE|FEVAL_BUILTIN;
return (_evalfile (filename, flags));
}
#endif /* HISTORY */
+6 -2
View File
@@ -168,8 +168,7 @@ parse_prologue (string, flags, tag)
else
unwind_protect_int (remember_on_history); /* can be used in scripts */
# if defined (BANG_HISTORY)
if (interactive_shell)
unwind_protect_int (history_expansion_inhibited);
unwind_protect_int (history_expansion_inhibited);
# endif /* BANG_HISTORY */
#endif /* HISTORY */
@@ -199,6 +198,10 @@ parse_prologue (string, flags, tag)
#if defined (HISTORY)
if (flags & SEVAL_NOHIST)
bash_history_disable ();
# if defined (BANG_HISTORY)
if (flags & SEVAL_NOHISTEXP)
history_expansion_inhibited = 1;
# endif /* BANG_HISTORY */
#endif /* HISTORY */
}
@@ -211,6 +214,7 @@ parse_prologue (string, flags, tag)
(flags & SEVAL_NOHIST) -> call bash_history_disable ()
(flags & SEVAL_NOFREE) -> don't free STRING when finished
(flags & SEVAL_RESETLINE) -> reset line_number to 1
(flags & SEVAL_NOHISTEXP) -> history_expansion_inhibited -> 1
*/
int
+2 -1
View File
@@ -1,7 +1,7 @@
This file is exec.def, from which is created exec.c.
It implements the builtin "exec" in Bash.
Copyright (C) 1987-2012 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -119,6 +119,7 @@ exec_builtin (list)
case 'a':
argv0 = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+2 -2
View File
@@ -1,7 +1,7 @@
This file is fc.def, from which is created fc.c.
It implements the builtin "fc" in Bash.
Copyright (C) 1987-2011 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -218,6 +218,7 @@ fc_builtin (list)
ename = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -461,7 +462,6 @@ fc_builtin (list)
echo_input_at_read = 1;
retval = fc_execute_file (fn);
run_unwind_frame ("fc builtin");
return (retval);
+6 -3
View File
@@ -1,7 +1,7 @@
This file is getopts.def, from which is created getopts.c.
It implements the builtin "getopts" in Bash.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -316,9 +316,12 @@ getopts_builtin (list)
}
reset_internal_getopt ();
if (internal_getopt (list, "") != -1)
if ((ret = internal_getopt (list, "")) != -1)
{
builtin_usage ();
if (ret == GETOPT_HELP)
builtin_help ();
else
builtin_usage ();
return (EX_USAGE);
}
list = loptend;
+2 -1
View File
@@ -1,7 +1,7 @@
This file is hash.def, from which is created hash.c.
It implements the builtin "hash" in Bash.
Copyright (C) 1987-2013 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -115,6 +115,7 @@ hash_builtin (list)
case 't':
list_targets = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+2 -1
View File
@@ -1,7 +1,7 @@
This file is help.def, from which is created help.c.
It implements the builtin "help" in Bash.
Copyright (C) 1987-2013 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -113,6 +113,7 @@ help_builtin (list)
case 's':
sflag = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+7 -3
View File
@@ -1,7 +1,7 @@
This file is history.def, from which is created history.c.
It implements the builtin "history" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -31,14 +31,14 @@ entry with a `*'. An argument of N lists only the last N entries.
Options:
-c clear the history list by deleting all of the entries
-d offset delete the history entry at offset OFFSET.
-d offset delete the history entry at position OFFSET.
-a append history lines from this session to the history file
-n read all history lines not already read from the history file
and append them to the history list
-r read the history file and append the contents to the history
list
-w write the current history to the history file
and append them to the history list
-p perform history expansion on each ARG and display the result
without storing it in the history list
@@ -141,6 +141,7 @@ history_builtin (list)
flags |= PFLAG;
#endif
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -259,6 +260,9 @@ histtime (hlist, histtimefmt)
t = history_get_time (hlist);
if (t)
strftime (timestr, sizeof (timestr), histtimefmt, localtime (&t));
else if (hlist->timestamp && hlist->timestamp[0])
snprintf (timestr, sizeof (timestr), _("%s: invalid timestamp"),
(hlist->timestamp[0] == '#') ? hlist->timestamp + 1: hlist->timestamp);
else
strcpy (timestr, "??");
return timestr;
+3 -2
View File
@@ -1,7 +1,7 @@
This file is jobs.def, from which is created jobs.c.
It implements the builtins "jobs" and "disown" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -118,6 +118,7 @@ jobs_builtin (list)
state = JSTATE_STOPPED;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -212,7 +213,7 @@ execute_list_with_replacements (list)
$BUILTIN disown
$FUNCTION disown_builtin
$DEPENDS_ON JOB_CONTROL
$SHORT_DOC disown [-h] [-ar] [jobspec ...]
$SHORT_DOC disown [-h] [-ar] [jobspec ... | pid ...]
Remove jobs from current shell.
Removes each JOBSPEC argument from the table of active jobs. Without
+1
View File
@@ -330,6 +330,7 @@ mapfile_builtin (list)
else
nskip = intval;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+43 -12
View File
@@ -1,7 +1,7 @@
/* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from
a single source file called builtins.def. */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
/* Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -71,7 +71,8 @@ extern char *strcpy ();
/* Flag values that builtins can have. */
#define BUILTIN_FLAG_SPECIAL 0x01
#define BUILTIN_FLAG_ASSIGNMENT 0x02
#define BUILTIN_FLAG_POSIX_BUILTIN 0x04
#define BUILTIN_FLAG_LOCALVAR 0x04
#define BUILTIN_FLAG_POSIX_BUILTIN 0x08
#define BASE_INDENT 4
@@ -159,6 +160,11 @@ char *assignment_builtins[] =
(char *)NULL
};
char *localvar_builtins[] =
{
"declare", "local", "typeset", (char *)NULL
};
/* The builtin commands that are special to the POSIX search order. */
char *posix_builtins[] =
{
@@ -170,6 +176,7 @@ char *posix_builtins[] =
/* Forward declarations. */
static int is_special_builtin ();
static int is_assignment_builtin ();
static int is_localvar_builtin ();
static int is_posix_builtin ();
#if !defined (HAVE_RENAME)
@@ -820,6 +827,8 @@ builtin_handler (self, defs, arg)
new->flags |= BUILTIN_FLAG_SPECIAL;
if (is_assignment_builtin (name))
new->flags |= BUILTIN_FLAG_ASSIGNMENT;
if (is_localvar_builtin (name))
new->flags |= BUILTIN_FLAG_LOCALVAR;
if (is_posix_builtin (name))
new->flags |= BUILTIN_FLAG_POSIX_BUILTIN;
@@ -1132,6 +1141,8 @@ char *structfile_header[] = {
" the list of shell reserved control structures, like `if' and `while'.",
" The end of the list is denoted with a NULL name field. */",
"",
"/* TRANSLATORS: Please do not translate command names in descriptions */",
"",
"#include \"../builtins.h\"",
(char *)NULL
};
@@ -1239,23 +1250,36 @@ write_builtins (defs, structfile, externfile)
else
fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
fprintf (structfile, "%s%s%s%s, %s_doc,\n",
fprintf (structfile, "%s%s%s%s%s, %s_doc,\n",
"BUILTIN_ENABLED | STATIC_BUILTIN",
(builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_LOCALVAR) ? " | LOCALVAR_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "",
document_name (builtin));
if (inhibit_functions)
fprintf
(structfile, " N_(\"%s\"), \"%s\" },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name,
document_name (builtin));
/* Don't translate short document summaries that are identical
to command names */
if (builtin->shortdoc && strcmp (builtin->name, builtin->shortdoc) == 0)
{
if (inhibit_functions)
fprintf (structfile, " \"%s\", \"%s\" },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name,
document_name (builtin));
else
fprintf (structfile, " \"%s\", (char *)NULL },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name);
}
else
fprintf
(structfile, " N_(\"%s\"), (char *)NULL },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name);
{
if (inhibit_functions)
fprintf (structfile, " N_(\"%s\"), \"%s\" },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name,
document_name (builtin));
else
fprintf (structfile, " N_(\"%s\"), (char *)NULL },\n",
builtin->shortdoc ? builtin->shortdoc : builtin->name);
}
}
if (structfile || separate_helpfiles)
@@ -1607,6 +1631,13 @@ is_assignment_builtin (name)
return (_find_in_table (name, assignment_builtins));
}
static int
is_localvar_builtin (name)
char *name;
{
return (_find_in_table (name, localvar_builtins));
}
static int
is_posix_builtin (name)
char *name;
+7 -4
View File
@@ -1,7 +1,7 @@
This file is printf.def, from which is created printf.c.
It implements the builtin "printf" in Bash.
Copyright (C) 1997-2010 Free Software Foundation, Inc.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -116,6 +116,7 @@ extern int errno;
vbadd (b, 1); \
else \
putchar (c); \
QUIT; \
} while (0)
#define PF(f, func) \
@@ -131,6 +132,7 @@ extern int errno;
else \
nw = vflag ? vbprintf (f, func) : printf (f, func); \
tw += nw; \
QUIT; \
if (ferror (stdout)) \
{ \
sh_wrerror (); \
@@ -143,6 +145,7 @@ extern int errno;
#define PRETURN(value) \
do \
{ \
QUIT; \
if (vflag) \
{ \
bind_printf_variable (vname, vbuf, 0); \
@@ -162,9 +165,9 @@ extern int errno;
} \
else if (vbuf) \
vbuf[0] = 0; \
terminate_immediately--; \
if (ferror (stdout) == 0) \
fflush (stdout); \
QUIT; \
if (ferror (stdout)) \
{ \
sh_wrerror (); \
@@ -273,6 +276,7 @@ printf_builtin (list)
return (EX_USAGE);
}
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -306,8 +310,6 @@ printf_builtin (list)
if (format == 0 || *format == 0)
return (EXECUTION_SUCCESS);
terminate_immediately++;
/* Basic algorithm is to scan the format string for conversion
specifications -- once one is found, find out if the field
width or precision is a '*'; if it is, gather up value. Note,
@@ -417,6 +419,7 @@ printf_builtin (list)
modstart[0] = convch;
modstart[1] = '\0';
QUIT;
switch(convch)
{
case 'c':
+1 -1
View File
@@ -1,7 +1,7 @@
This file is pushd.def, from which is created pushd.c. It implements the
builtins "pushd", "popd", and "dirs" in Bash.
Copyright (C) 1987-2013 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+2 -1
View File
@@ -1,7 +1,7 @@
This file is read.def, from which is created read.c.
It implements the builtin "read" in Bash.
Copyright (C) 1987-2012 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -317,6 +317,7 @@ read_builtin (list)
case 'd':
delim = *list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+3 -1
View File
@@ -141,7 +141,7 @@ Options:
#endif /* BANG_HISTORY */
-P If set, do not resolve symbolic links when executing commands
such as cd which change the current directory.
-T If set, the DEBUG trap is inherited by shell functions.
-T If set, the DEBUG and RETURN traps are inherited by shell functions.
-- Assign any remaining arguments to the positional parameters.
If there are no remaining arguments, the positional parameters
are unset.
@@ -660,6 +660,7 @@ set_builtin (list)
sh_invalidopt (s);
builtin_usage ();
return (EX_USAGE);
CASE_HELPOPT;
case '?':
builtin_usage ();
return (list_optopt == '?' ? EXECUTION_SUCCESS : EX_USAGE);
@@ -816,6 +817,7 @@ unset_builtin (list)
case 'n':
nameref = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+21 -2
View File
@@ -1,7 +1,7 @@
This file is setattr.def, from which is created setattr.c.
It implements the builtins "export" and "readonly", in Bash.
Copyright (C) 1987-2014 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -134,6 +134,8 @@ set_or_show_attributes (list, attribute, nodefs)
#if defined (ARRAY_VARS)
WORD_LIST *nlist, *tlist;
WORD_DESC *w;
char optw[8];
int opti;
#endif
functions_only = arrays_only = assoc_only = 0;
@@ -160,6 +162,7 @@ set_or_show_attributes (list, attribute, nodefs)
#endif
case 'p':
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
@@ -237,8 +240,24 @@ set_or_show_attributes (list, attribute, nodefs)
{
tlist = list->next;
list->next = (WORD_LIST *)NULL;
w = arrays_only ? make_word ("-ra") : make_word ("-rA");
/* Add -g to avoid readonly/export creating local variables:
only local/declare/typeset create local variables */
opti = 0;
optw[opti++] = '-';
optw[opti++] = 'g';
if (attribute & att_readonly)
optw[opti++] = 'r';
if (attribute & att_exported)
optw[opti++] = 'x';
if (arrays_only)
optw[opti++] = 'a';
else
optw[opti++] = 'A';
optw[opti] = '\0';
w = make_word (optw);
nlist = make_word_list (w, list);
opt = declare_builtin (nlist);
if (opt != EXECUTION_SUCCESS)
assign_error++;
+4 -1
View File
@@ -1,7 +1,7 @@
This file is shopt.def, from which is created shopt.c.
It implements the Bash `shopt' builtin.
Copyright (C) 1994-2012 Free Software Foundation, Inc.
Copyright (C) 1994-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -90,6 +90,7 @@ extern int autocd;
extern int glob_star;
extern int glob_asciirange;
extern int lastpipe_opt;
extern int inherit_errexit;
#if defined (EXTENDED_GLOB)
extern int extended_glob;
@@ -196,6 +197,7 @@ static struct {
{ "hostcomplete", &perform_hostname_completion, shopt_enable_hostname_completion },
#endif
{ "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL },
{ "inherit_errexit", &inherit_errexit, (shopt_set_func_t *)NULL },
{ "interactive_comments", &interactive_comments, set_shellopts_after_change },
{ "lastpipe", &lastpipe_opt, (shopt_set_func_t *)NULL },
#if defined (HISTORY)
@@ -271,6 +273,7 @@ shopt_builtin (list)
case 'p':
flags |= PFLAG;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1 -1
View File
@@ -1,7 +1,7 @@
This file is source.def, from which is created source.c.
It implements the builtins "." and "source" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+2 -1
View File
@@ -1,7 +1,7 @@
This file is suspend.def, from which is created suspend.c.
It implements the builtin "suspend" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -89,6 +89,7 @@ suspend_builtin (list)
case 'f':
force++;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1 -1
View File
@@ -1,7 +1,7 @@
This file is test.def, from which is created test.c.
It implements the builtin "test" in Bash.
Copyright (C) 1987-2010 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+2 -1
View File
@@ -1,7 +1,7 @@
This file is trap.def, from which is created trap.c.
It implements the builtin "trap" in Bash.
Copyright (C) 1987-2010 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -119,6 +119,7 @@ trap_builtin (list)
case 'p':
display++;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -168,6 +168,7 @@ type_builtin (list)
dflags |= (CDESC_PATH_ONLY|CDESC_FORCE_PATH);
dflags &= ~(CDESC_TYPE|CDESC_SHORTDESC);
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+2 -1
View File
@@ -1,7 +1,7 @@
This file is ulimit.def, from which is created ulimit.c.
It implements the builtin "ulimit" in Bash.
Copyright (C) 1987-2010 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -373,6 +373,7 @@ ulimit_builtin (list)
mode |= LIMIT_HARD;
break;
CASE_HELPOPT;
case '?':
builtin_usage ();
return (EX_USAGE);
+2 -1
View File
@@ -1,7 +1,7 @@
This file is umask.def, from which is created umask.c.
It implements the builtin "umask" in Bash.
Copyright (C) 1987-2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -91,6 +91,7 @@ umask_builtin (list)
case 'p':
pflag++;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+1
View File
@@ -113,6 +113,7 @@ wait_builtin (list)
nflag = 1;
break;
#endif
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
+3
View File
@@ -748,6 +748,9 @@
/* Define if you have the raise function. */
#undef HAVE_RAISE
/* Define if you have the random function. */
#undef HAVE_RANDOM
/* Define if you have the readlink function. */
#undef HAVE_READLINK
Vendored
+29 -46
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 4.4, version 4.073.
# From configure.ac for Bash 4.4, version 4.078.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-beta.
# Generated by GNU Autoconf 2.69 for bash 4.4-rc1.
#
# 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-beta'
PACKAGE_STRING='bash 4.4-beta'
PACKAGE_VERSION='4.4-rc1'
PACKAGE_STRING='bash 4.4-rc1'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -729,7 +729,6 @@ MALLOC_LIBRARY
MALLOC_LIB
MALLOC_SRC
MALLOC_TARGET
PURIFY
TESTSCRIPT
CPPFLAGS_FOR_BUILD
LDFLAGS_FOR_BUILD
@@ -790,8 +789,6 @@ with_bash_malloc
with_curses
with_gnu_malloc
with_installed_readline
with_purecov
with_purify
enable_minimal_config
enable_alias
enable_arith_for_command
@@ -1396,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-beta to adapt to many kinds of systems.
\`configure' configures bash 4.4-rc1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1461,7 +1458,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 4.4-beta:";;
short | recursive ) echo "Configuration of bash 4.4-rc1:";;
esac
cat <<\_ACEOF
@@ -1552,8 +1549,6 @@ Optional Packages:
--with-installed-readline
use a version of the readline library that is
already installed
--with-purecov configure to postprocess with pure coverage
--with-purify configure to postprocess with purify
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
@@ -1656,7 +1651,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 4.4-beta
bash configure 4.4-rc1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2365,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-beta, which was
It was created by bash $as_me 4.4-rc1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2759,7 +2754,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=4.4
RELSTATUS=beta
RELSTATUS=rc1
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -2840,8 +2835,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
opt_bash_malloc=yes
opt_purify=no
opt_purecov=no
opt_afs=no
opt_curses=no
opt_with_installed_readline=no
@@ -2917,18 +2910,6 @@ if test "${with_installed_readline+set}" = set; then :
fi
# Check whether --with-purecov was given.
if test "${with_purecov+set}" = set; then :
withval=$with_purecov; opt_purecov=$withval
fi
# Check whether --with-purify was given.
if test "${with_purify+set}" = set; then :
withval=$with_purify; opt_purify=$withval
fi
if test "$opt_bash_malloc" = yes; then
MALLOC_TARGET=malloc
MALLOC_SRC=malloc.c
@@ -2947,18 +2928,6 @@ else
MALLOC_DEP=
fi
if test "$opt_purify" = yes; then
PURIFY="purify "
$as_echo "#define DISABLE_MALLOC_WRAPPERS 1" >>confdefs.h
else
PURIFY=
fi
if test "$opt_purecov" = yes; then
PURIFY="${PURIFY}purecov"
fi
if test "$opt_afs" = yes; then
$as_echo "#define AFS 1" >>confdefs.h
@@ -3403,7 +3372,6 @@ fi
if test -z "$CFLAGS"; then
AUTO_CFLAGS="-g ${GCC+-O2} ${GCC+-Wno-parentheses}"
AUTO_LDFLAGS="-g ${GCC+-O2}"
@@ -5299,7 +5267,7 @@ if ${ac_cv_rl_version+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_rl_version='4.2'
ac_cv_rl_version='6.3'
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -9301,7 +9269,7 @@ fi
done
for ac_header in sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
sys/resource.h sys/param.h sys/socket.h sys/stat.h \
sys/param.h sys/socket.h sys/stat.h \
sys/time.h sys/times.h sys/types.h sys/wait.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -9341,6 +9309,19 @@ fi
ac_fn_c_check_header_compile "$LINENO" "sys/resource.h" "ac_cv_header_sys_resource_h" "
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
"
if test "x$ac_cv_header_sys_resource_h" = xyes; then :
$as_echo "#define HAVE_SYS_RESOURCE_H 1" >>confdefs.h
fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
@@ -9852,7 +9833,7 @@ fi
for ac_func in bcopy bzero confstr faccessat fnmatch \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
imaxdiv memmove pathconf putenv raise regcomp regexec \
imaxdiv memmove pathconf putenv raise random regcomp regexec \
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
sysconf syslog tcgetattr times ttyname tzset unsetenv
do :
@@ -16049,6 +16030,8 @@ case "${host_os}-${CC}" in
aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
bsdi5*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
hpux11*-gcc*) LOCAL_LDFLAGS="-Wl,-E" ;; # allow dynamic loading
esac
case "${host_os}" in
@@ -16672,7 +16655,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-beta, which was
This file was extended by bash $as_me 4.4-rc1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16738,7 +16721,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-beta
bash config.status 4.4-rc1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+14 -20
View File
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 4.4, version 4.073])dnl
AC_REVISION([for Bash 4.4, version 4.078])dnl
define(bashvers, 4.4)
define(relstatus, beta)
define(relstatus, rc1)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -53,8 +53,6 @@ AC_CANONICAL_BUILD
dnl configure defaults
opt_bash_malloc=yes
opt_purify=no
opt_purecov=no
opt_afs=no
opt_curses=no
opt_with_installed_readline=no
@@ -113,8 +111,6 @@ AC_ARG_WITH(bash-malloc, AC_HELP_STRING([--with-bash-malloc], [use the Bash vers
AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
AC_ARG_WITH(gnu-malloc, AC_HELP_STRING([--with-gnu-malloc], [synonym for --with-bash-malloc]), opt_bash_malloc=$withval)
AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval)
AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval)
AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
if test "$opt_bash_malloc" = yes; then
MALLOC_TARGET=malloc
@@ -133,17 +129,6 @@ else
MALLOC_DEP=
fi
if test "$opt_purify" = yes; then
PURIFY="purify "
AC_DEFINE(DISABLE_MALLOC_WRAPPERS)
else
PURIFY=
fi
if test "$opt_purecov" = yes; then
PURIFY="${PURIFY}purecov"
fi
if test "$opt_afs" = yes; then
AC_DEFINE(AFS)
fi
@@ -391,7 +376,6 @@ fi
dnl now substitute in the values generated by arguments
AC_SUBST(TESTSCRIPT)
AC_SUBST(PURIFY)
AC_SUBST(MALLOC_TARGET)
AC_SUBST(MALLOC_SRC)
@@ -717,7 +701,7 @@ AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
regex.h syslog.h ulimit.h)
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
sys/resource.h sys/param.h sys/socket.h sys/stat.h \
sys/param.h sys/socket.h sys/stat.h \
sys/time.h sys/times.h sys/types.h sys/wait.h)
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
@@ -729,6 +713,14 @@ AC_CHECK_HEADER(sys/ptem.h, , ,[[
#endif
]])
dnl SunOS 4 needs to include <sys/time.h> before <sys/resource.h> to compile
dnl autoconf complains about presence but inability to compile
AC_CHECK_HEADER(sys/resource.h, AC_DEFINE(HAVE_SYS_RESOURCE_H), [], [[
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
]])
dnl special checks for libc functions
AC_FUNC_ALLOCA
AC_FUNC_CHOWN
@@ -784,7 +776,7 @@ AC_REPLACE_FUNCS(rename)
dnl checks for c library functions
AC_CHECK_FUNCS(bcopy bzero confstr faccessat fnmatch \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
imaxdiv memmove pathconf putenv raise regcomp regexec \
imaxdiv memmove pathconf putenv raise random regcomp regexec \
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
sysconf syslog tcgetattr times ttyname tzset unsetenv)
@@ -1112,6 +1104,8 @@ case "${host_os}-${CC}" in
aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
bsdi5*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
hpux11*-gcc*) LOCAL_LDFLAGS="-Wl,-E" ;; # allow dynamic loading
esac
dnl FreeBSD-3.x can have either a.out or ELF
+17 -7
View File
@@ -1,6 +1,6 @@
# This Makefile is for the Bash/documentation directory -*- text -*-.
#
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
# Copyright (C) 2003-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -154,13 +154,13 @@ BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/fdl.texi $(srcdir)/version.texi
# $(RM) $@
# -${TEXI2PDF} $<
all: ps info dvi text html
all: ps info dvi text html $(MAN2HTML)
nodvi: ps info text html
everything: all pdf
PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps
DVIFILES = bashref.dvi bashref.ps
INFOFILES = bashref.info
INFOFILES = bashref.info bash.info
MAN0FILES = bash.0 bashbug.0 builtins.0 rbash.0
HTMLFILES = bashref.html bash.html
PDFFILES = bash.pdf bashref.pdf article.pdf rose94.pdf
@@ -184,16 +184,16 @@ bashref.pdf: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
# can also use:
# $(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
# $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
bashref.html: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
$(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
bash.info: bashref.info
${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
bash.txt: bash.1
bash.ps: bash.1
bash.html: bash.1 $(MAN2HTML)
bash.html: bash.1
bashbug.ps: bashbug.1
builtins.ps: builtins.1 bash.1
rbash.ps: rbash.1 bash.1
@@ -247,7 +247,7 @@ installdirs:
$(SHELL) $(SUPPORT_SRCDIR)/mkinstalldirs $(DESTDIR)$(htmldir) ; \
fi
install: info installdirs bash.info
install: info installdirs
-$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext}
-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
-$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
@@ -274,10 +274,20 @@ install_builtins: installdirs
install_everything: install install_builtins
install-html: html
-if test -n "${htmldir}" ; then \
$(INSTALL_DATA) $(srcdir)/bash.html $(DESTDIR)$(htmldir) ; \
$(INSTALL_DATA) $(srcdir)/bashref.html $(DESTDIR)$(htmldir) ; \
fi
uninstall:
-$(RM) $(DESTDIR)$(man1dir)/bash${man1ext} $(DESTDIR)$(man1dir)/bashbug${man1ext}
-$(RM) $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
$(RM) $(DESTDIR)$(infodir)/bash.info
# run install-info if it is present to update the info directory
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --delete --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \
else true; fi
-( cd $(DESTDIR)$(docdir) && $(RM) $(OTHER_INSTALLED_DOCS) )
-if test -n "$(htmldir)" ; then \
$(RM) $(DESTDIR)$(htmldir)/bash.html ; \
+1378 -1343
View File
File diff suppressed because it is too large Load Diff
+98 -38
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Fri Oct 2 07:15:57 EDT 2015
.\" Last Change: Mon Feb 8 10:15:48 EST 2016
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2015 October 2" "GNU Bash 4.4"
.TH BASH 1 "2016 February 8" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -50,8 +50,8 @@ bash \- GNU Bourne-Again SHell
[options]
[command_string | file]
.SH COPYRIGHT
.if n Bash is Copyright (C) 1989-2015 by the Free Software Foundation, Inc.
.if t Bash is Copyright \(co 1989-2015 by the Free Software Foundation, Inc.
.if n Bash is Copyright (C) 1989-2016 by the Free Software Foundation, Inc.
.if t Bash is Copyright \(co 1989-2016 by the Free Software Foundation, Inc.
.SH DESCRIPTION
.B Bash
is an \fBsh\fR-compatible command language interpreter that
@@ -487,8 +487,8 @@ A \fItoken\fP that performs a control function. It is one of the following
symbols:
.RS
.PP
.if t \fB|| & && ; ;; ( ) | |& <newline>\fP
.if n \fB|| & && ; ;; ( ) | |& <newline>\fP
.if t \fB|| & && ; ;; ;& ;;& ( ) | |& <newline>\fP
.if n \fB|| & && ; ;; ;& ;;& ( ) | |& <newline>\fP
.RE
.PD
.SH "RESERVED WORDS"
@@ -909,7 +909,7 @@ last command executed, or zero if no condition tested true.
The \fBwhile\fP command continuously executes the list
\fIlist-2\fP as long as the last command in the list \fIlist-1\fP returns
an exit status of zero. The \fBuntil\fP command is identical
to the \fBwhile\fP command, except that the test is negated;
to the \fBwhile\fP command, except that the test is negated:
.I list-2
is executed as long as the last command in
.I list-1
@@ -1061,6 +1061,8 @@ of all characters within the quotes, with the exception of
.BR \e ,
and, when history expansion is enabled,
.BR ! .
When the shell is in \fIposix mode\fP, the \fB!\fP has no special meaning
within double quotes, even when history expansion is enabled.
The characters
.B $
and
@@ -1454,8 +1456,13 @@ that do not require \fBbash\fP to be re-initialized.
.B BASH_ALIASES
An associative array variable whose members correspond to the internal
list of aliases as maintained by the \fBalias\fP builtin.
Elements added to this array appear in the alias list; unsetting array
elements cause aliases to be removed from the alias list.
Elements added to this array appear in the alias list; however,
unsetting array elements currently does not cause aliases to be removed
from the alias list.
If
.B BASH_ALIASES
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
.B BASH_ARGC
An array variable whose values are the number of parameters in each
@@ -1496,8 +1503,13 @@ builtin below)
.B BASH_CMDS
An associative array variable whose members correspond to the internal
hash table of commands as maintained by the \fBhash\fP builtin.
Elements added to this array appear in the hash table; unsetting array
elements cause commands to be removed from the hash table.
Elements added to this array appear in the hash table; however,
unsetting array elements currently does not cause command names to be removed
from the hash table.
If
.B BASH_CMDS
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
.B BASH_COMMAND
The command currently being executed or about to be executed, unless the
@@ -2001,7 +2013,7 @@ Similar to
used when the shell is invoked in POSIX mode.
.TP
.B EXECIGNORE
A colon-separated list of extended glob patterns (see \fBPattern Matching\fP)
A colon-separated list of shell patterns (see \fBPattern Matching\fP)
defining the list of filenames to be ignored by command search.
Files whose full pathnames match one of these patterns are not considered
executable files for the purposes of completion and command execution.
@@ -2009,6 +2021,8 @@ This does not affect the behavior of the \fB[\fP, \fBtest\fP, and \fB[[\fP
commands.
Use this variable to ignore shared library files that have the executable
bit set, but are not executable files.
The pattern matching honors the setting of the \fBextglob\fP shell
option.
.TP
.B FCEDIT
The default editor for the
@@ -2110,6 +2124,8 @@ The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
.SM
.BR HISTIGNORE .
The pattern matching honors the setting of the \fBextglob\fP shell
option.
.TP
.B HISTSIZE
The number of commands to remember in the command history (see
@@ -2225,6 +2241,10 @@ strings preceded by a \fB$\fP.
.B LC_NUMERIC
This variable determines the locale category used for number formatting.
.TP
.B LC_TIME
This variable determines the locale category used for data and time
formatting.
.TP
.B LINES
Used by the \fBselect\fP compound command to determine the column length
for printing selection lists.
@@ -2324,6 +2344,13 @@ trailing directory components to retain when expanding the \fB\ew\fP and
.B PROMPTING
below). Characters removed are replaced with an ellipsis.
.TP
.B PS0
The value of this parameter is expanded (see
.SM
.B PROMPTING
below) and displayed by interactive shells after reading a command
and before the command is executed.
.TP
.B PS1
The value of this parameter is expanded (see
.SM
@@ -3213,8 +3240,8 @@ or
.RE
.PP
.B Bash
performs the expansion by executing \fIcommand\fP and
replacing the command substitution with the standard output of the
performs the expansion by executing \fIcommand\fP in a subshell environment
and replacing the command substitution with the standard output of the
command, with any trailing newlines deleted.
Embedded newlines are not deleted, but they may be removed during
word splitting.
@@ -3265,19 +3292,23 @@ is invalid,
prints a message indicating failure and no substitution occurs.
.SS Process Substitution
.PP
\fIProcess substitution\fP is supported on systems that support named
pipes (\fIFIFOs\fP) or the \fB/dev/fd\fP method of naming open files.
\fIProcess substitution\fP allows a process's input or output to be
referred to using a filename.
It takes the form of
\fB<(\fP\fIlist\^\fP\fB)\fP
or
\fB>(\fP\fIlist\^\fP\fB)\fP.
The process \fIlist\fP is run with its input or output connected to a
\fIFIFO\fP or some file in \fB/dev/fd\fP. The name of this file is
The process \fIlist\fP is run asynchronously, and its input or output
appears as a filename.
This filename is
passed as an argument to the current command as the result of the
expansion. If the \fB>(\fP\fIlist\^\fP\fB)\fP form is used, writing to
expansion.
If the \fB>(\fP\fIlist\^\fP\fB)\fP form is used, writing to
the file will provide input for \fIlist\fP. If the
\fB<(\fP\fIlist\^\fP\fB)\fP form is used, the file passed as an
argument should be read to obtain the output of \fIlist\fP.
Process substitution is supported on systems that support named
pipes (\fIFIFOs\fP) or the \fB/dev/fd\fP method of naming open files.
.PP
When available, process substitution is performed
simultaneously with parameter and variable expansion,
@@ -3321,9 +3352,10 @@ If
.B IFS
has a value other than the default, then sequences of
the whitespace characters
.B space
.BR space ,
.BR tab ,
and
.B tab
.B newline
are ignored at the beginning and end of the
word, as long as the whitespace character is in the
value of
@@ -3352,11 +3384,18 @@ If the value of
.B IFS
is null, no word splitting occurs.
.PP
Explicit null arguments (\^\f3"\^"\fP or \^\f3\(aq\^\(aq\fP\^) are retained.
Explicit null arguments (\^\f3"\^"\fP or \^\f3\(aq\^\(aq\fP\^) are retained
and passed to commands as empty strings.
Unquoted implicit null arguments, resulting from the expansion of
parameters that have no values, are removed.
If a parameter with no value is expanded within double quotes, a
null argument results and is retained.
null argument results and is retained
and passed to a command as an empty string.
When a quoted null argument appears as part of a word whose expansion is
non-null, the null argument is removed.
That is, the word
\f(CW\-d\(aq\^\(aq\fP becomes \f(CW\-d\fP after word splitting and
null argument removal.
.PP
Note that if no expansion occurs, no splitting
is performed.
@@ -3466,6 +3505,8 @@ option is disabled when
.SM
.B GLOBIGNORE
is unset.
The pattern matching honors the setting of the \fBextglob\fP shell
option.
.PP
\fBPattern Matching\fP
.PP
@@ -3899,10 +3940,10 @@ The \fIword\fP undergoes
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote removal.
Pathname expansion and word splitting are not performed.
The result is supplied as a single string to the command on its
The result is supplied as a single string, with a newline appended,
to the command on its
standard input (or file descriptor \fIn\fP if \fIn\fP is specified).
.SS "Duplicating File Descriptors"
.PP
The redirection operator
.RS
@@ -4980,6 +5021,10 @@ when it is ready to read a command, and the secondary prompt
.B PS2
when it needs more input to complete a command.
.B Bash
displays
.B PS0
after it reads a command but before executing it.
.B Bash
allows these prompt strings to be customized by inserting a number of
backslash-escaped special characters that are decoded as follows:
.RS
@@ -7087,7 +7132,8 @@ names are
\fIemacs, emacs\-standard, emacs\-meta, emacs\-ctlx, vi,
vi\-move, vi\-command\fP, and
.IR vi\-insert .
\fIvi\fP is equivalent to \fIvi\-command\fP; \fIemacs\fP is
\fIvi\fP is equivalent to \fIvi\-command\fP (\fIvi\-move\fP is also
a synonym); \fIemacs\fP is
equivalent to \fIemacs\-standard\fP.
.TP
.B \-l
@@ -7748,7 +7794,7 @@ invalid option is supplied or \fIn\fP indexes beyond the end
of the directory stack.
.RE
.TP
\fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] [\fIjobspec\fP ...]
\fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] [\fIjobspec\fP ... | \fIpid\fP ... ]
Without options, remove each
.I jobspec
from the table of active jobs.
@@ -8340,7 +8386,7 @@ associated with each history entry is written to the history file,
marked with the history comment character.
When the history file is read, lines beginning with the history
comment character followed immediately by a digit are interpreted
as timestamps for the previous history line.
as timestamps for the following history entry.
The return value is 0 unless an invalid option is encountered, an
error occurs while reading or writing the history file, an invalid
\fIoffset\fP is supplied as an argument to \fB\-d\fP, or the
@@ -8634,9 +8680,8 @@ In addition to the standard \fIprintf\fP(1) format specifications,
.B %b
causes
\fBprintf\fP to expand backslash escape sequences in the corresponding
\fIargument\fP (except that \fB\ec\fP terminates output, backslashes in
\fB\e\(aq\fP, \fB\e"\fP, and \fB\e?\fP are not removed, and octal escapes
beginning with \fB\e0\fP may contain up to four digits).
\fIargument\fP
in the same way as \fBecho \-e\fP.
.TP
.B %q
causes \fBprintf\fP to output the corresponding
@@ -8738,13 +8783,16 @@ invalid option is supplied.
.TP
\fBread\fP [\fB\-ers\fP] [\fB\-a\fP \fIaname\fP] [\fB\-d\fP \fIdelim\fP] [\fB\-i\fP \fItext\fP] [\fB\-n\fP \fInchars\fP] [\fB\-N\fP \fInchars\fP] [\fB\-p\fP \fIprompt\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-u\fP \fIfd\fP] [\fIname\fP ...]
One line is read from the standard input, or from the file descriptor
\fIfd\fP supplied as an argument to the \fB\-u\fP option, and the first word
\fIfd\fP supplied as an argument to the \fB\-u\fP option,
split into words as described above under \fBWord Splitting\fP,
and the first word
is assigned to the first
.IR name ,
the second word to the second
.IR name ,
and so on, with leftover words and their intervening separators assigned
to the last
and so on.
If there are more words than names, the remaining words and their
intervening delimiters are assigned to the last
.IR name .
If there are fewer words read from the input stream than names,
the remaining names are assigned empty values.
@@ -9451,7 +9499,10 @@ If set,
.B bash
changes its behavior to that of version 3.2 with respect to
locale-specific string comparison when using the \fB[[\fP
conditional command's \fB<\fP and \fB>\fP operators (see previous item).
conditional command's \fB<\fP and \fB>\fP operators (see previous item)
and the effect of interrupting a command list.
Bash versions 3.2 and earlier continue with the next command in the list
after one terminates due to an interrupt.
.TP 8
.B compat40
If set,
@@ -9483,9 +9534,13 @@ expansion using quote removal.
If set,
.B bash
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to \fBdeclare\fP, and makes word expansion errors
array assignment as an argument to \fBdeclare\fP,
makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit).
to make them fatal errors that cause the shell to exit),
and does not reset the
loop state when a shell function is executed (this allows \fBbreak\fP or
\fBcontinue\fP in a shell function to affect loops in the caller's context).
.TP 8
.B complete_fullquote
If set,
@@ -9670,6 +9725,11 @@ If set, \fBbash\fP will send
.B SIGHUP
to all jobs when an interactive login shell exits.
.TP 8
.B inherit_errexit
If set, command substitution inherits the value of the \fBerrexit\fP option,
instead of unsetting it in the subshell environment.
This option is enabled when \fIposix mode\fP is enabled.
.TP 8
.B interactive_comments
If set, allow a word beginning with
.B #
@@ -9982,7 +10042,7 @@ is
.BR ERR ,
the command
.I arg
is executed whenever a
is executed whenever
a pipeline (which may consist of a single simple
command), a list, or a compound command returns a
non\-zero exit status,
+106 -37
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2015 October 2<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2016 February 8<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -42,7 +42,7 @@ bash - GNU Bourne-Again SHell
<H3>COPYRIGHT</H3>
Bash is Copyright &#169; 1989-2015 by the Free Software Foundation, Inc.
Bash is Copyright &#169; 1989-2016 by the Free Software Foundation, Inc.
<A NAME="lbAE">&nbsp;</A>
<H3>DESCRIPTION</H3>
@@ -638,7 +638,7 @@ symbols:
<DL COMPACT><DT><DD>
<P>
<B>|| &amp; &amp;&amp; ; ;; ( ) | |&amp; &lt;newline&gt;</B>
<B>|| &amp; &amp;&amp; ; ;; ;&amp; ;;&amp; ( ) | |&amp; &lt;newline&gt;</B>
</DL>
@@ -1157,7 +1157,7 @@ last command executed, or zero if no condition tested true.
The <B>while</B> command continuously executes the list
<I>list-2</I> as long as the last command in the list <I>list-1</I> returns
an exit status of zero. The <B>until</B> command is identical
to the <B>while</B> command, except that the test is negated;
to the <B>while</B> command, except that the test is negated:
<I>list-2</I>
is executed as long as the last command in
@@ -1354,6 +1354,8 @@ of all characters within the quotes, with the exception of
and, when history expansion is enabled,
<B>!</B>.
When the shell is in <I>posix mode</I>, the <B>!</B> has no special meaning
within double quotes, even when history expansion is enabled.
The characters
<B>$</B>
@@ -1870,8 +1872,14 @@ that do not require <B>bash</B> to be re-initialized.
<DD>
An associative array variable whose members correspond to the internal
list of aliases as maintained by the <B>alias</B> builtin.
Elements added to this array appear in the alias list; unsetting array
elements cause aliases to be removed from the alias list.
Elements added to this array appear in the alias list; however,
unsetting array elements currently does not cause aliases to be removed
from the alias list.
If
<B>BASH_ALIASES</B>
is unset, it loses its special properties, even if it is
subsequently reset.
<DT><B>BASH_ARGC</B>
<DD>
@@ -1923,8 +1931,14 @@ builtin below)
<DD>
An associative array variable whose members correspond to the internal
hash table of commands as maintained by the <B>hash</B> builtin.
Elements added to this array appear in the hash table; unsetting array
elements cause commands to be removed from the hash table.
Elements added to this array appear in the hash table; however,
unsetting array elements currently does not cause command names to be removed
from the hash table.
If
<B>BASH_CMDS</B>
is unset, it loses its special properties, even if it is
subsequently reset.
<DT><B>BASH_COMMAND</B>
<DD>
@@ -2551,7 +2565,7 @@ used when the shell is invoked in POSIX mode.
<DT><B>EXECIGNORE</B>
<DD>
A colon-separated list of extended glob patterns (see <B>Pattern Matching</B>)
A colon-separated list of shell patterns (see <B>Pattern Matching</B>)
defining the list of filenames to be ignored by command search.
Files whose full pathnames match one of these patterns are not considered
executable files for the purposes of completion and command execution.
@@ -2559,6 +2573,8 @@ This does not affect the behavior of the <B>[</B>, <B>test</B>, and <B>[[</B>
commands.
Use this variable to ignore shared library files that have the executable
bit set, but are not executable files.
The pattern matching honors the setting of the <B>extglob</B> shell
option.
<DT><B>FCEDIT</B>
<DD>
@@ -2683,6 +2699,8 @@ not tested, and are added to the history regardless of the value of
<FONT SIZE=-1><B>HISTIGNORE</B>.
</FONT>
The pattern matching honors the setting of the <B>extglob</B> shell
option.
<DT><B>HISTSIZE</B>
<DD>
@@ -2829,6 +2847,11 @@ strings preceded by a <B>$</B>.
<DD>
This variable determines the locale category used for number formatting.
<DT><B>LC_TIME</B>
<DD>
This variable determines the locale category used for data and time
formatting.
<DT><B>LINES</B>
<DD>
@@ -2955,6 +2978,15 @@ trailing directory components to retain when expanding the <B>\w</B> and
</FONT>
below). Characters removed are replaced with an ellipsis.
<DT><B>PS0</B>
<DD>
The value of this parameter is expanded (see
<FONT SIZE=-1><B>PROMPTING</B>
</FONT>
below) and displayed by interactive shells after reading a command
and before the command is executed.
<DT><B>PS1</B>
<DD>
@@ -4044,8 +4076,8 @@ or
<B>Bash</B>
performs the expansion by executing <I>command</I> and
replacing the command substitution with the standard output of the
performs the expansion by executing <I>command</I> in a subshell environment
and replacing the command substitution with the standard output of the
command, with any trailing newlines deleted.
Embedded newlines are not deleted, but they may be removed during
word splitting.
@@ -4116,19 +4148,23 @@ prints a message indicating failure and no substitution occurs.
<P>
<I>Process substitution</I> is supported on systems that support named
pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
<I>Process substitution</I> allows a process's input or output to be
referred to using a filename.
It takes the form of
<B>&lt;(</B><I>list</I><B>)</B>
or
<B>&gt;(</B><I>list</I><B>)</B>.
The process <I>list</I> is run with its input or output connected to a
<I>FIFO</I> or some file in <B>/dev/fd</B>. The name of this file is
The process <I>list</I> is run asynchronously, and its input or output
appears as a filename.
This filename is
passed as an argument to the current command as the result of the
expansion. If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
expansion.
If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
the file will provide input for <I>list</I>. If the
<B>&lt;(</B><I>list</I><B>)</B> form is used, the file passed as an
argument should be read to obtain the output of <I>list</I>.
Process substitution is supported on systems that support named
pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
<P>
When available, process substitution is performed
@@ -4186,10 +4222,12 @@ If
</FONT>
has a value other than the default, then sequences of
the whitespace characters
<B>space</B>
<B>space</B>,
<B>tab</B>,
and
<B>tab</B>
<B>newline</B>
are ignored at the beginning and end of the
word, as long as the whitespace character is in the
@@ -4227,11 +4265,18 @@ If the value of
is null, no word splitting occurs.
<P>
Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained.
Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained
and passed to commands as empty strings.
Unquoted implicit null arguments, resulting from the expansion of
parameters that have no values, are removed.
If a parameter with no value is expanded within double quotes, a
null argument results and is retained.
null argument results and is retained
and passed to a command as an empty string.
When a quoted null argument appears as part of a word whose expansion is
non-null, the null argument is removed.
That is, the word
<TT>-daqaq</TT> becomes <TT>-d</TT> after word splitting and
null argument removal.
<P>
Note that if no expansion occurs, no splitting
@@ -4382,6 +4427,8 @@ option is disabled when
</FONT>
is unset.
The pattern matching honors the setting of the <B>extglob</B> shell
option.
<P>
<B>Pattern Matching</B>
@@ -4975,12 +5022,12 @@ The <I>word</I> undergoes
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote removal.
Pathname expansion and word splitting are not performed.
The result is supplied as a single string to the command on its
The result is supplied as a single string, with a newline appended,
to the command on its
standard input (or file descriptor <I>n</I> if <I>n</I> is specified).
<A NAME="lbBQ">&nbsp;</A>
<H4>Duplicating File Descriptors</H4>
<P>
<P>
The redirection operator
@@ -6376,6 +6423,12 @@ when it is ready to read a command, and the secondary prompt
when it needs more input to complete a command.
<B>Bash</B>
displays
<B>PS0</B>
after it reads a command but before executing it.
<B>Bash</B>
allows these prompt strings to be customized by inserting a number of
backslash-escaped special characters that are decoded as follows:
<DL COMPACT><DT><DD>
@@ -9081,7 +9134,8 @@ names are
vi-move, vi-command</I>, and
<I>vi-insert</I>.
<I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
<I>vi</I> is equivalent to <I>vi-command</I> (<I>vi-move</I> is also
a synonym); <I>emacs</I> is
equivalent to <I>emacs-standard</I>.
<DT><B>-l</B>
@@ -9876,7 +9930,7 @@ invalid option is supplied or <I>n</I> indexes beyond the end
of the directory stack.
</DL>
<DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ...]<DD>
<DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ... | <I>pid</I> ... ]<DD>
Without options, remove each
<I>jobspec</I>
@@ -10611,7 +10665,7 @@ associated with each history entry is written to the history file,
marked with the history comment character.
When the history file is read, lines beginning with the history
comment character followed immediately by a digit are interpreted
as timestamps for the previous history line.
as timestamps for the following history entry.
The return value is 0 unless an invalid option is encountered, an
error occurs while reading or writing the history file, an invalid
<I>offset</I> is supplied as an argument to <B>-d</B>, or the
@@ -10980,9 +11034,8 @@ In addition to the standard <I>printf</I>(1) format specifications,
<DD>
causes
<B>printf</B> to expand backslash escape sequences in the corresponding
<I>argument</I> (except that <B>\c</B> terminates output, backslashes in
<B>\aq</B>, <B>\&quot;</B>, and <B>\?</B> are not removed, and octal escapes
beginning with <B>\0</B> may contain up to four digits).
<I>argument</I>
in the same way as <B>echo -e</B>.
<DT><B>%q</B>
<DD>
@@ -11102,15 +11155,18 @@ reading the name of the current directory or an
invalid option is supplied.
<DT><B>read</B> [<B>-ers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-i</B> <I>text</I>] [<B>-n</B> <I>nchars</I>] [<B>-N</B> <I>nchars</I>] [<B>-p</B> <I>prompt</I>] [<B>-t</B> <I>timeout</I>] [<B>-u</B> <I>fd</I>] [<I>name</I> ...]<DD>
One line is read from the standard input, or from the file descriptor
<I>fd</I> supplied as an argument to the <B>-u</B> option, and the first word
<I>fd</I> supplied as an argument to the <B>-u</B> option,
split into words as described above under <B>Word Splitting</B>,
and the first word
is assigned to the first
<I>name</I>,
the second word to the second
<I>name</I>,
and so on, with leftover words and their intervening separators assigned
to the last
and so on.
If there are more words than names, the remaining words and their
intervening delimiters are assigned to the last
<I>name</I>.
If there are fewer words read from the input stream than names,
@@ -12019,7 +12075,10 @@ If set,
changes its behavior to that of version 3.2 with respect to
locale-specific string comparison when using the <B>[[</B>
conditional command's <B>&lt;</B> and <B>&gt;</B> operators (see previous item).
conditional command's <B>&lt;</B> and <B>&gt;</B> operators (see previous item)
and the effect of interrupting a command list.
Bash versions 3.2 and earlier continue with the next command in the list
after one terminates due to an interrupt.
<DT><B>compat40</B>
<DD>
@@ -12059,9 +12118,13 @@ If set,
<B>bash</B>
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to <B>declare</B>, and makes word expansion errors
array assignment as an argument to <B>declare</B>,
makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit).
to make them fatal errors that cause the shell to exit),
and does not reset the
loop state when a shell function is executed (this allows <B>break</B> or
<B>continue</B> in a shell function to affect loops in the caller's context).
<DT><B>complete_fullquote</B>
<DD>
@@ -12295,6 +12358,12 @@ If set, <B>bash</B> will send
</FONT>
to all jobs when an interactive login shell exits.
<DT><B>inherit_errexit</B>
<DD>
If set, command substitution inherits the value of the <B>errexit</B> option,
instead of unsetting it in the subshell environment.
This option is enabled when <I>posix mode</I> is enabled.
<DT><B>interactive_comments</B>
<DD>
@@ -12682,7 +12751,7 @@ is
the command
<I>arg</I>
is executed whenever a
is executed whenever
a pipeline (which may consist of a single simple
command), a list, or a compound command returns a
non-zero exit status,
@@ -13408,7 +13477,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash 4.4<TH ALIGN=CENTER width=33%>2015 October 2<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash 4.4<TH ALIGN=CENTER width=33%>2016 February 8<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -13514,6 +13583,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 02 October 2015 07:16:35 EDT
Time: 08 February 2016 10:17:49 EST
</BODY>
</HTML>
BIN
View File
Binary file not shown.
+6008 -5949
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+11599 -14012
View File
File diff suppressed because it is too large Load Diff
+444 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+6776 -6723
View File
File diff suppressed because it is too large Load Diff
+130 -69
View File
@@ -14,7 +14,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU Bash Reference Manual},
for @code{Bash}, Version @value{VERSION}.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -212,7 +212,7 @@ than by an executable program somewhere in the file system.
@cindex control operator
A @code{token} that performs a control function. It is a @code{newline}
or one of the following:
@samp{||}, @samp{&&}, @samp{&}, @samp{;}, @samp{;;},
@samp{||}, @samp{&&}, @samp{&}, @samp{;}, @samp{;;}, @samp{;&}, @samp{;;&},
@samp{|}, @samp{|&}, @samp{(}, or @samp{)}.
@item exit status
@@ -450,6 +450,10 @@ Enclosing characters in double quotes (@samp{"}) preserves the literal value
of all characters within the quotes, with the exception of
@samp{$}, @samp{`}, @samp{\},
and, when history expansion is enabled, @samp{!}.
When the shell is in
@sc{posix} mode (@pxref{Bash POSIX Mode}),
the @samp{!} has no special meaning
within double quotes, even when history expansion is enabled.
The characters @samp{$} and @samp{`}
retain their special meaning within double quotes (@pxref{Shell Expansions}).
The backslash retains its special meaning only when followed by one of
@@ -2246,8 +2250,8 @@ or
@end example
@noindent
Bash performs the expansion by executing @var{command} and
replacing the command substitution with the standard output of the
Bash performs the expansion by executing @var{command} in a subshell environment
and replacing the command substitution with the standard output of the
command, with any trailing newlines deleted.
Embedded newlines are not deleted, but they may be removed during
word splitting.
@@ -2296,8 +2300,8 @@ failure to the standard error and no substitution occurs.
@subsection Process Substitution
@cindex process substitution
Process substitution is supported on systems that support named
pipes (@sc{fifo}s) or the @file{/dev/fd} method of naming open files.
Process substitution allows a process's input or output to be
referred to using a filename.
It takes the form of
@example
<(@var{list})
@@ -2308,16 +2312,20 @@ or
>(@var{list})
@end example
@noindent
The process @var{list} is run with its input or output connected to a
@sc{fifo} or some file in @file{/dev/fd}. The name of this file is
The process @var{list} is run asynchronously, and its input or output
appears as a filename.
This filename is
passed as an argument to the current command as the result of the
expansion. If the @code{>(@var{list})} form is used, writing to
expansion.
If the @code{>(@var{list})} form is used, writing to
the file will provide input for @var{list}. If the
@code{<(@var{list})} form is used, the file passed as an
argument should be read to obtain the output of @var{list}.
Note that no space may appear between the @code{<} or @code{>}
and the left parenthesis, otherwise the construct would be interpreted
as a redirection.
Process substitution is supported on systems that support named
pipes (@sc{fifo}s) or the @file{/dev/fd} method of naming open files.
When available, process substitution is performed simultaneously with
parameter and variable expansion, command substitution, and arithmetic
@@ -2341,7 +2349,7 @@ at the beginning and end of the results of the previous
expansions are ignored, and any sequence of @env{IFS}
characters not at the beginning or end serves to delimit words.
If @env{IFS} has a value other than the default, then sequences of
the whitespace characters @code{space} and @code{tab}
the whitespace characters @code{space}, @code{tab}, and @code{newline}
are ignored at the beginning and end of the
word, as long as the whitespace character is in the
value of @env{IFS} (an @env{IFS} whitespace character).
@@ -2351,11 +2359,18 @@ whitespace characters, delimits a field. A sequence of @env{IFS}
whitespace characters is also treated as a delimiter.
If the value of @env{IFS} is null, no word splitting occurs.
Explicit null arguments (@code{""} or @code{''}) are retained.
Explicit null arguments (@code{""} or @code{''}) are retained
and passed to commands as empty strings.
Unquoted implicit null arguments, resulting from the expansion of
parameters that have no values, are removed.
If a parameter with no value is expanded within double quotes, a
null argument results and is retained.
null argument results and is retained
and passed to a command as an empty string.
When a quoted null argument appears as part of a word whose expansion is
non-null, the null argument is removed.
That is, the word
@code{-d''} becomes @code{-d} after word splitting and
null argument removal.
Note that if no expansion occurs, no splitting
is performed.
@@ -2741,7 +2756,9 @@ The @var{word} undergoes
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote removal.
Pathname expansion and word splitting are not performed.
The result is supplied as a single string to the command on its
The result is supplied as a single string,
with a newline appended,
to the command on its
standard input (or file descriptor @var{n} if @var{n} is specified).
@subsection Duplicating File Descriptors
@@ -3856,8 +3873,8 @@ names are
@code{vi-move},
@code{vi-command}, and
@code{vi-insert}.
@code{vi} is equivalent to @code{vi-command};
@code{emacs} is equivalent to @code{emacs-standard}.
@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a
synonym); @code{emacs} is equivalent to @code{emacs-standard}.
@item -l
List the names of all Readline functions.
@@ -4311,10 +4328,8 @@ interprets the following extensions:
@table @code
@item %b
Causes @code{printf} to expand backslash escape sequences in the
corresponding @var{argument},
except that @samp{\c} terminates output, backslashes in
@samp{\'}, @samp{\"}, and @samp{\?} are not removed, and octal escapes
beginning with @samp{\0} may contain up to four digits.
corresponding @var{argument} in the same way as @code{echo -e}
(@pxref{Bash Builtins}).
@item %q
Causes @code{printf} to output the
corresponding @var{argument} in a format that can be reused as shell input.
@@ -4349,9 +4364,13 @@ read [-ers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}]
@end example
One line is read from the standard input, or from the file descriptor
@var{fd} supplied as an argument to the @option{-u} option, and the first word
@var{fd} supplied as an argument to the @option{-u} option,
split into words as described above in @ref{Word Splitting},
and the first word
is assigned to the first @var{name}, the second word to the second @var{name},
and so on, with leftover words and their intervening separators assigned
and so on.
If there are more words than names,
the remaining words and their intervening delimiters are assigned
to the last @var{name}.
If there are fewer words read from the input stream than names,
the remaining names are assigned empty values.
@@ -5042,7 +5061,10 @@ bash-4.1 and later use the current locale's collation sequence and strcoll(3).
If set, Bash
changes its behavior to that of version 3.2 with respect to locale-specific
string comparison when using the @code{[[}
conditional command's @samp{<} and @samp{>} operators (see previous item).
conditional command's @samp{<} and @samp{>} operators (see previous item)
and the effect of interrupting a command list.
Bash versions 3.2 and earlier continue with the next command in the list
after one terminates due to an interrupt.
@item compat40
If set, Bash
@@ -5069,9 +5091,13 @@ expansion using quote removal.
@item compat43
If set, Bash
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to @code{declare}, and makes word expansion errors
array assignment as an argument to @code{declare},
makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit).
to make them fatal errors that cause the shell to exit),
and does not reset the
loop state when a shell function is executed (this allows @code{break} or
@code{continue} in a shell function to affect loops in the caller's context).
@item complete_fullquote
If set, Bash
@@ -5216,6 +5242,11 @@ by default.
If set, Bash will send @code{SIGHUP} to all jobs when an interactive
login shell exits (@pxref{Signals}).
@item inherit_errexit
If set, command substitution inherits the value of the @code{errexit} option,
instead of unsetting it in the subshell environment.
This option is enabled when @sc{posix} mode is enabled.
@item interactive_comments
Allow a word beginning with @samp{#}
to cause that word and all remaining characters on that
@@ -5397,7 +5428,6 @@ current directory.
A null directory name may appear as two adjacent colons, or as an initial
or trailing colon.
@item PS1
The primary prompt string. The default value is @samp{\s-\v\$ }.
@xref{Controlling the Prompt}, for the complete list of escape
@@ -5442,8 +5472,12 @@ that do not require Bash to be re-initialized.
An associative array variable whose members correspond to the internal
list of aliases as maintained by the @code{alias} builtin.
(@pxref{Bourne Shell Builtins}).
Elements added to this array appear in the alias list; unsetting array
elements cause aliases to be removed from the alias list.
Elements added to this array appear in the alias list; however,
unsetting array elements currently does not cause aliases to be removed
from the alias list.
If @code{BASH_ALIASES}
is unset, it loses its special properties, even if it is
subsequently reset.
@item BASH_ARGC
An array variable whose values are the number of parameters in each
@@ -5472,8 +5506,12 @@ builtin).
An associative array variable whose members correspond to the internal
hash table of commands as maintained by the @code{hash} builtin
(@pxref{Bourne Shell Builtins}).
Elements added to this array appear in the hash table; unsetting array
elements cause commands to be removed from the hash table.
Elements added to this array appear in the hash table; however,
unsetting array elements currently does not cause command names to be removed
from the hash table.
If @code{BASH_CMDS}
is unset, it loses its special properties, even if it is
subsequently reset.
@item BASH_COMMAND
The command currently being executed or about to be executed, unless the
@@ -5684,7 +5722,7 @@ The numeric effective user id of the current user. This variable
is readonly.
@item EXECIGNORE
A colon-separated list of extended glob patterns (@pxref{Pattern Matching})
A colon-separated list of shell patterns (@pxref{Pattern Matching})
defining the list of filenames to be ignored by command search.
Files whose full pathnames match one of these patterns are not considered
executable files for the purposes of completion and command execution.
@@ -5692,6 +5730,8 @@ This does not affect the behavior of the @code{[}, @code{test}, and @code{[[}
commands.
Use this variable to ignore shared library files that have the executable
bit set, but are not executable files.
The pattern matching honors the setting of the @code{extglob} shell
option.
@item FCEDIT
The editor used as a default by the @option{-e} option to the @code{fc}
@@ -5736,6 +5776,8 @@ be ignored by filename expansion.
If a filename matched by a filename expansion pattern also matches one
of the patterns in @env{GLOBIGNORE}, it is removed from the list
of matches.
The pattern matching honors the setting of the @code{extglob} shell
option.
@item GROUPS
An array variable containing the list of groups of which the current
@@ -5812,6 +5854,8 @@ before attempting a match.
The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
@env{HISTIGNORE}.
The pattern matching honors the setting of the @code{extglob} shell
option.
@env{HISTIGNORE} subsumes the function of @env{HISTCONTROL}. A
pattern of @samp{&} is identical to @code{ignoredups}, and a
@@ -5895,6 +5939,10 @@ strings preceded by a @samp{$} (@pxref{Locale Translation}).
@item LC_NUMERIC
This variable determines the locale category used for number formatting.
@item LC_TIME
This variable determines the locale category used for data and time
formatting.
@item LINENO
The line number in the script or shell function currently executing.
@@ -5963,6 +6011,11 @@ trailing directory components to retain when expanding the @code{\w} and
@code{\W} prompt string escapes (@pxref{Controlling the Prompt}).
Characters removed are replaced with an ellipsis.
@item PS0
The value of this parameter is expanded like @var{PS1}
and displayed by interactive shells after reading a command
and before the command is executed.
@item PS3
The value of this variable is used as the prompt for the
@code{select} command. If this variable is not set, the
@@ -6461,6 +6514,7 @@ signals @code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}.
Bash expands and displays @env{PS1} before reading the first line
of a command, and expands and displays @env{PS2} before reading the
second and subsequent lines of a multi-line command.
Bash displays @env{PS0} after it reads a command but before executing it.
@item
Bash executes the value of the @env{PROMPT_COMMAND} variable as a command
@@ -7275,9 +7329,7 @@ is stopped is `Stopped(@var{signame})', where @var{signame} is, for
example, @code{SIGTSTP}.
@item
The @code{bg} builtin uses the required format to describe each job placed
in the background, which does not include an indication of whether the job
is the current or previous job.
Alias expansion is always enabled, even in non-interactive shells.
@item
Reserved words appearing in a context where reserved words are recognized
@@ -7297,40 +7349,10 @@ the normal Bash files.
Tilde expansion is only performed on assignments preceding a command
name, rather than on all assignment statements on the line.
@item
The @code{command} builtin does not prevent builtins that take assignment
statements as arguments from expanding them as assignment statements;
when not in @sc{posix} mode, assignment builtins lose their assignment
statement expansion properties when preceded by @code{command}.
@item
The default history file is @file{~/.sh_history} (this is the
default value of @env{$HISTFILE}).
@item
The output of @samp{kill -l} prints all the signal names on a single line,
separated by spaces, without the @samp{SIG} prefix.
@item
The @code{kill} builtin does not accept signal names with a @samp{SIG}
prefix.
@item
Non-interactive shells exit if @var{filename} in @code{.} @var{filename}
is not found.
@item
Non-interactive shells exit if a syntax error in an arithmetic expansion
results in an invalid expression.
@item
Non-interactive shells exit on word expansion errors.
@item
Non-interactive shells exit if there is a syntax error in a script read
with the @code{.} or @code{source} builtins, or in a string processed by
the @code{eval} builtin.
@item
Redirection operators do not perform filename expansion on the word
in the redirection unless the shell is interactive.
@@ -7375,6 +7397,10 @@ not have to appear as matched pairs.
The parser does not recognize @code{time} as a reserved word if the next
token begins with a @samp{-}.
@item
The @samp{!} character does not introduce history expansion within a
double-quoted string, even if the @code{histexpand} option is enabled.
@item
If a @sc{posix} special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
@@ -7399,6 +7425,22 @@ A non-interactive shell exits with an error status if the iteration
variable in a @code{for} statement or the selection variable in a
@code{select} statement is a readonly variable.
@item
Non-interactive shells exit if @var{filename} in @code{.} @var{filename}
is not found.
@item
Non-interactive shells exit if a syntax error in an arithmetic expansion
results in an invalid expression.
@item
Non-interactive shells exit on word expansion errors.
@item
Non-interactive shells exit if there is a syntax error in a script read
with the @code{.} or @code{source} builtins, or in a string processed by
the @code{eval} builtin.
@item
Process substitution is not available.
@@ -7415,6 +7457,25 @@ Assignment statements preceding shell function calls persist in the
shell environment after the function returns, as if a @sc{posix}
special builtin command had been executed.
@item
The @code{command} builtin does not prevent builtins that take assignment
statements as arguments from expanding them as assignment statements;
when not in @sc{posix} mode, assignment builtins lose their assignment
statement expansion properties when preceded by @code{command}.
@item
The @code{bg} builtin uses the required format to describe each job placed
in the background, which does not include an indication of whether the job
is the current or previous job.
@item
The output of @samp{kill -l} prints all the signal names on a single line,
separated by spaces, without the @samp{SIG} prefix.
@item
The @code{kill} builtin does not accept signal names with a @samp{SIG}
prefix.
@item
The @code{export} and @code{readonly} builtin commands display their
output in the format required by @sc{posix}.
@@ -7436,13 +7497,13 @@ The @code{.} and @code{source} builtins do not search the current directory
for the filename argument if it is not found by searching @env{PATH}.
@item
Subshells spawned to execute command substitutions inherit the value of
the @option{-e} option from the parent shell. When not in @sc{posix} mode,
Enabling @sc{posix} mode has the effect of setting the
@code{inherit_errexit} option, so
subshells spawned to execute command substitutions inherit the value of
the @option{-e} option from the parent shell.
When the @code{inherit_errexit} option is not enabled,
Bash clears the @option{-e} option in such subshells.
@item
Alias expansion is always enabled, even in non-interactive shells.
@item
When the @code{alias} builtin displays alias definitions, it does not
display them with a leading @samp{alias } unless the @option{-p} option
@@ -7760,7 +7821,7 @@ of the shell, the return status is 127.
@item disown
@btindex disown
@example
disown [-ar] [-h] [@var{jobspec} @dots{}]
disown [-ar] [-h] [@var{jobspec} @dots{} | @var{pid} @dots{} ]
@end example
Without options, remove each @var{jobspec} from the table of
+693 -681
View File
File diff suppressed because it is too large Load Diff
+1075 -1063
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Fri Oct 2 07:16:22 2015
%%CreationDate: Mon Feb 8 10:16:54 2016
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+1483 -583
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,11 +1,11 @@
@ignore
Copyright (C) 1988-2015 Free Software Foundation, Inc.
Copyright (C) 1988-2016 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Oct 2 07:15:33 EDT 2015
@set LASTCHANGE Mon Feb 8 10:16:20 EST 2016
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 2 October 2015
@set UPDATED-MONTH October 2015
@set UPDATED 8 February 2016
@set UPDATED-MONTH February 2016
+1
View File
@@ -284,6 +284,7 @@ internal_inform (format, va_alist)
va_list args;
error_prolog (1);
/* TRANSLATORS: this is a prefix for informational messages. */
fprintf (stderr, _("INFORM: "));
SH_VA_START (args, format);
+17
View File
@@ -55,6 +55,7 @@ extern int last_command_exit_value, stdin_redir;
extern int need_here_doc;
extern int current_command_number, current_command_line_count, line_number;
extern int expand_aliases;
extern char *ps0_prompt;
#if defined (HAVE_POSIX_SIGNALS)
extern sigset_t top_level_mask;
@@ -160,6 +161,22 @@ reader_loop ()
executing = 1;
stdin_redir = 0;
/* If the shell is interactive, expand and display $PS0 after reading a
command (possibly a list or pipeline) and before executing it. */
if (interactive && ps0_prompt)
{
char *ps0_string;
ps0_string = decode_prompt_string (ps0_prompt);
if (ps0_string && *ps0_string)
{
fprintf (stderr, "%s", ps0_string);
fflush (stderr);
}
free (ps0_string);
}
execute_command (current_command);
exec_done:
+6 -2
View File
@@ -102,7 +102,7 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins -I${srcdir} \
ALLPROG = print truefalse sleep finfo logname basename dirname \
tty pathchk tee head mkdir rmdir printenv id whoami \
uname sync push ln unlink realpath strftime mypid
uname sync push ln unlink realpath strftime mypid setpgid
OTHERPROG = necho hello cat pushd
all: $(SHOBJ_STATUS)
@@ -202,6 +202,10 @@ strftime: strftime.o
mypid: mypid.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ mypid.o $(SHOBJ_LIBS)
setpgid: setpgid.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ setpgid.o $(SHOBJ_LIBS)
# pushd is a special case. We use the same source that the builtin version
# uses, with special compilation options.
#
@@ -278,4 +282,4 @@ push.o: push.c
mkdir.o: mkdir.c
realpath.o: realpath.c
strftime.o: strftime.c
mypid.o: mypid.c
setpgid.o: setpgid.c
-1
View File
@@ -94,4 +94,3 @@ struct builtin hello_struct = {
"hello", /* usage synopsis; becomes short_doc */
0 /* reserved for internal use */
};
+121
View File
@@ -0,0 +1,121 @@
/* setpgid.c: bash loadable wrapper for setpgid system call
An example of how to wrap a system call with a loadable builtin.
Originally contributed by Jason Vas Dias <jason.vas.dias@gmail.com>
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include <errno.h>
#include <string.h>
#include "bashtypes.h"
#include "posixtime.h"
#include <stdio.h>
#include "builtins.h"
#include "shell.h"
#include "common.h"
#include "bashgetopt.h"
#if !defined (_POSIX_VERSION)
# define setpgid(pid, pgrp) setpgrp (pid, pgrp)
#endif
int
setpgid_builtin (list)
WORD_LIST *list;
{
register WORD_LIST *wl;
intmax_t pid_arg, pgid_arg;
pid_t pid, pgid;
char *pidstr, *pgidstr;
wl = list;
pid = pgid = 0;
if (wl == 0 || wl->next == 0)
{
builtin_usage ();
return (EX_USAGE);
}
pidstr = wl->word ? wl->word->word : 0;
pgidstr = wl->next->word ? wl->next->word->word : 0;
if (pidstr == 0 || pgidstr == 0)
{
builtin_usage ();
return (EX_USAGE);
}
if (legal_number (pidstr, &pid_arg) == 0)
{
builtin_error ("%s: pid argument must be numeric", pidstr);
return (EXECUTION_FAILURE);
}
if (pid_arg < 0)
{
builtin_error("%s: negative pid values not allowed", pidstr);
return (EXECUTION_FAILURE);
}
pid = pid_arg;
if (legal_number (pgidstr, &pgid_arg) == 0)
{
builtin_error ("%s: pgrp argument must be numeric", pgidstr);
return (EXECUTION_FAILURE);
}
if (pgid_arg < 0)
{
builtin_error ("%s: negative pgrp values not allowed", pgidstr);
return (EXECUTION_FAILURE);
}
pgid = pgid_arg;
errno = 0;
if (setpgid(pid, pgid) < 0)
{
builtin_error("setpgid failed: %s", strerror (errno));
return (EXECUTION_FAILURE);
}
return (EXECUTION_SUCCESS);
}
const char *setpgid_doc[] = {
"invoke the setpgid(2) system call",
"",
"Arguments:",
" pid : numeric process identifer, >= 0",
" pgrpid: numeric process group identifier, >=0",
"See the setpgid(2) manual page.",
(const char *)NULL
};
struct builtin setpgid_struct = {
"setpgid",
setpgid_builtin,
BUILTIN_ENABLED,
(char **)setpgid_doc,
"setpgid pid pgrpid",
0
};
+50 -39
View File
@@ -58,6 +58,7 @@ extern int errno;
#endif
#define NEED_FPURGE_DECL
#define NEED_SH_SETLINEBUF_DECL
#include "bashansi.h"
#include "bashintl.h"
@@ -104,18 +105,6 @@ extern int errno;
# include <mbstr.h> /* mbschr */
#endif
#if defined (ARRAY_VARS)
struct func_array_state
{
ARRAY *funcname_a;
SHELL_VAR *funcname_v;
ARRAY *source_a;
SHELL_VAR *source_v;
ARRAY *lineno_a;
SHELL_VAR *lineno_v;
};
#endif
extern int dollar_dollar_pid;
extern int posixly_correct;
extern int expand_aliases;
@@ -630,7 +619,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (paren_pid == 0)
{
/* We want to run the exit trap for forced {} subshells, and we
want to note this before execute_in_subshell[B modifies the
want to note this before execute_in_subshell modifies the
COMMAND struct. Need to keep in mind that execute_in_subshell
runs the exit trap for () subshells itself. */
/* This handles { command; } & */
@@ -1555,14 +1544,19 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
/* If this is a user subshell, set a flag if stdin was redirected.
This is used later to decide whether to redirect fd 0 to
/dev/null for async commands in the subshell. This adds more
sh compatibility, but I'm not sure it's the right thing to do. */
sh compatibility, but I'm not sure it's the right thing to do.
Note that an input pipe to a compound command suffices to inhibit
the implicit /dev/null redirection for asynchronous commands
executed as part of that compound command. */
if (user_subshell)
{
stdin_redir = stdin_redirects (command->redirects);
stdin_redir = stdin_redirects (command->redirects) || pipe_in != NO_PIPE;
#if 0
restore_default_signal (EXIT_TRAP); /* XXX - reset_signal_handlers above */
#endif
}
else if (shell_control_structure (command->type) && pipe_in != NO_PIPE)
stdin_redir = 1;
/* If this is an asynchronous command (command &), we want to
redirect the standard input from /dev/null in the absence of
@@ -3868,19 +3862,20 @@ fix_assignment_words (words)
for (wcmd = words; wcmd; wcmd = wcmd->next)
if ((wcmd->word->flags & W_ASSIGNMENT) == 0)
break;
/* Posix (post-2008) says that `command' doesn't change whether
or not the builtin it shadows is a `declaration command', even
though it removes other special builtin properties. In Posix
mode, we skip over one or more instances of `command' and
deal with the next word as the assignment builtin. */
while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command"))
wcmd = wcmd->next;
for (w = wcmd; w; w = w->next)
if (w->word->flags & W_ASSIGNMENT)
{
/* Lazy builtin lookup, only do it if we find an assignment */
if (b == 0)
{
/* Posix (post-2008) says that `command' doesn't change whether
or not the builtin it shadows is a `declaration command', even
though it removes other special builtin properties. In Posix
mode, we skip over one or more instances of `command' and
deal with the next word as the assignment builtin. */
while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command"))
wcmd = wcmd->next;
b = builtin_address_internal (wcmd->word->word, 0);
if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0)
return;
@@ -3896,6 +3891,12 @@ fix_assignment_words (words)
#endif
if (global)
w->word->flags |= W_ASSNGLOBAL;
/* If we have an assignment builtin that does not create local variables,
make sure we create global variables even if we internally call
`declare' */
if (b && ((b->flags & (ASSIGNMENT_BUILTIN|LOCALVAR_BUILTIN)) == ASSIGNMENT_BUILTIN))
w->word->flags |= W_ASSNGLOBAL;
}
#if defined (ARRAY_VARS)
/* Note that we saw an associative array option to a builtin that takes
@@ -3907,8 +3908,6 @@ fix_assignment_words (words)
{
if (b == 0)
{
while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command"))
wcmd = wcmd->next;
b = builtin_address_internal (wcmd->word->word, 0);
if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0)
return;
@@ -4037,6 +4036,10 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
if (fds_to_close)
close_fd_bitmap (fds_to_close);
/* If we fork because of an input pipe, note input pipe for later to
inhibit async commands from redirecting stdin from /dev/null */
stdin_redir |= pipe_in != NO_PIPE;
do_piping (pipe_in, pipe_out);
pipe_in = pipe_out = NO_PIPE;
#if defined (COPROCESS_SUPPORT)
@@ -4300,6 +4303,7 @@ run_builtin:
words = make_word_list (make_word ("--"), words);
words = make_word_list (make_word ("cd"), words);
xtrace_print_word_list (words, 0);
func = find_function ("cd");
goto run_builtin;
}
@@ -4363,12 +4367,11 @@ execute_builtin (builtin, words, flags, subshell)
WORD_LIST *words;
int flags, subshell;
{
int old_e_flag, result, eval_unwind;
int result, eval_unwind, ignexit_flag, old_e_flag;
int isbltinenv;
char *error_trap;
error_trap = 0;
old_e_flag = exit_immediately_on_error;
/* The eval builtin calls parse_and_execute, which does not know about
the setting of flags, and always calls the execution functions with
@@ -4392,6 +4395,7 @@ execute_builtin (builtin, words, flags, subshell)
restore_default_signal (ERROR_TRAP);
}
exit_immediately_on_error = 0;
ignexit_flag = builtin_ignoring_errexit;
builtin_ignoring_errexit = 1;
eval_unwind = 1;
}
@@ -4444,7 +4448,6 @@ execute_builtin (builtin, words, flags, subshell)
sourcenest++; /* execute_subshell_builtin_or_function sets this to 0 */
}
/* `return' does a longjmp() back to a saved environment in execute_function.
If a variable assignment list preceded the command, and the shell is
running in POSIX mode, we need to merge that into the shell_variables
@@ -4469,8 +4472,8 @@ execute_builtin (builtin, words, flags, subshell)
if (eval_unwind)
{
exit_immediately_on_error = errexit_flag;
builtin_ignoring_errexit = 0;
builtin_ignoring_errexit = ignexit_flag;
exit_immediately_on_error = builtin_ignoring_errexit ? 0 : errexit_flag;
if (error_trap)
{
set_error_trap (error_trap);
@@ -4499,7 +4502,7 @@ maybe_restore_getopt_state (gs)
}
#if defined (ARRAY_VARS)
static void
void
restore_funcarray_state (fa)
struct func_array_state *fa;
{
@@ -4669,7 +4672,11 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
/* Update BASH_ARGV and BASH_ARGC */
if (debugging_mode)
push_args (words->next);
{
push_args (words->next);
if (subshell == 0)
add_unwind_protect (pop_args, 0);
}
/* Number of the line on which the function body starts. */
line_number = function_line_number = tc->line;
@@ -4679,7 +4686,8 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
stop_pipeline (async, (COMMAND *)NULL);
#endif
loop_level = 0;
if (shell_compatibility_level > 43)
loop_level = 0;
fc = tc;
@@ -4728,10 +4736,6 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
showing_function_line = 0;
}
/* Restore BASH_ARGC and BASH_ARGV */
if (debugging_mode)
pop_args ();
/* If we have a local copy of OPTIND, note it in the saved getopts state. */
gv = find_variable ("OPTIND");
if (gv && gv->context == variable_context)
@@ -4741,7 +4745,12 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
run_unwind_frame ("function_calling");
#if defined (ARRAY_VARS)
else
restore_funcarray_state (fa);
{
restore_funcarray_state (fa);
/* Restore BASH_ARGC and BASH_ARGV */
if (debugging_mode)
pop_args ();
}
#endif
if (variable_context == 0 || this_shell_function == 0)
@@ -5349,13 +5358,15 @@ initialize_subshell ()
# define SETOSTYPE(x)
#endif
#define HASH_BANG_BUFSIZ 128
#define READ_SAMPLE_BUF(file, buf, len) \
do \
{ \
fd = open(file, O_RDONLY); \
if (fd >= 0) \
{ \
len = read (fd, buf, 80); \
len = read (fd, buf, HASH_BANG_BUFSIZ); \
close (fd); \
} \
else \
@@ -5371,7 +5382,7 @@ shell_execve (command, args, env)
char **args, **env;
{
int larray, i, fd;
char sample[80];
char sample[HASH_BANG_BUFSIZ];
int sample_len;
SETOSTYPE (0); /* Some systems use for USG/POSIX semantics */
+15 -1
View File
@@ -1,6 +1,6 @@
/* execute_cmd.h - functions from execute_cmd.c. */
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -23,6 +23,18 @@
#include "stdc.h"
#if defined (ARRAY_VARS)
struct func_array_state
{
ARRAY *funcname_a;
SHELL_VAR *funcname_v;
ARRAY *source_a;
SHELL_VAR *source_v;
ARRAY *lineno_a;
SHELL_VAR *lineno_v;
};
#endif
extern struct fd_bitmap *new_fd_bitmap __P((int));
extern void dispose_fd_bitmap __P((struct fd_bitmap *));
extern void close_fd_bitmap __P((struct fd_bitmap *));
@@ -65,4 +77,6 @@ extern void coproc_unsetvars __P((struct coproc *));
extern void close_all_files __P((void));
#endif
extern void restore_funcarray_state __P((struct func_array_state *));
#endif /* _EXECUTE_CMD_H_ */
+3
View File
@@ -1123,6 +1123,9 @@ expr_streval (tok, e, lvalue)
FREE (value); /* array_variable_name returns new memory */
#endif
if (no_longjmp_on_fatal_error && interactive_shell)
sh_longjmp (evalbuf, 1);
if (interactive_shell)
{
expr_unwind ();
+1 -1
View File
@@ -104,7 +104,7 @@ exec_name_should_ignore (name)
struct ign *p;
for (p = execignore.ignores; p && p->val; p++)
if (strmatch (p->val, (char *)name, FNM_EXTMATCH|FNM_CASEFOLD) != FNM_NOMATCH)
if (strmatch (p->val, (char *)name, FNMATCH_EXTFLAG|FNM_CASEFOLD) != FNM_NOMATCH)
return 1;
return 0;
}
+2
View File
@@ -58,6 +58,7 @@ extern int check_hashed_filenames;
extern int source_uses_path;
extern int source_searches_cwd;
extern int posixly_correct;
extern int inherit_errexit;
static char *bash_special_tilde_expansions __P((char *));
static int unquoted_tilde_word __P((const char *));
@@ -75,6 +76,7 @@ posix_initialize (on)
if (on != 0)
{
interactive_comments = source_uses_path = expand_aliases = 1;
inherit_errexit = 1;
source_searches_cwd = 0;
}
-241
View File
@@ -16,132 +16,6 @@
/* Written by Bruno Haible <bruno@clisp.org>. */
/* A multibyte character is a short subsequence of a char* string,
representing a single wide character.
We use multibyte characters instead of wide characters because of
the following goals:
1) correct multibyte handling, i.e. operate according to the LC_CTYPE
locale,
2) ease of maintenance, i.e. the maintainer needs not know all details
of the ISO C 99 standard,
3) don't fail grossly if the input is not in the encoding set by the
locale, because often different encodings are in use in the same
countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...),
4) fast in the case of ASCII characters,
5) portability, i.e. don't make unportable assumptions about wchar_t.
Multibyte characters are only accessed through the mb* macros.
mb_ptr (mbc)
return a pointer to the beginning of the multibyte sequence.
mb_len (mbc)
returns the number of bytes occupied by the multibyte sequence.
Always > 0.
mb_iseq (mbc, sc)
returns true if mbc is the standard ASCII character sc.
mb_isnul (mbc)
returns true if mbc is the nul character.
mb_cmp (mbc1, mbc2)
returns a positive, zero, or negative value depending on whether mbc1
sorts after, same or before mbc2.
mb_casecmp (mbc1, mbc2)
returns a positive, zero, or negative value depending on whether mbc1
sorts after, same or before mbc2, modulo upper/lowercase conversion.
mb_equal (mbc1, mbc2)
returns true if mbc1 and mbc2 are equal.
mb_caseequal (mbc1, mbc2)
returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion.
mb_isalnum (mbc)
returns true if mbc is alphanumeric.
mb_isalpha (mbc)
returns true if mbc is alphabetic.
mb_isascii(mbc)
returns true if mbc is plain ASCII.
mb_isblank (mbc)
returns true if mbc is a blank.
mb_iscntrl (mbc)
returns true if mbc is a control character.
mb_isdigit (mbc)
returns true if mbc is a decimal digit.
mb_isgraph (mbc)
returns true if mbc is a graphic character.
mb_islower (mbc)
returns true if mbc is lowercase.
mb_isprint (mbc)
returns true if mbc is a printable character.
mb_ispunct (mbc)
returns true if mbc is a punctuation character.
mb_isspace (mbc)
returns true if mbc is a space character.
mb_isupper (mbc)
returns true if mbc is uppercase.
mb_isxdigit (mbc)
returns true if mbc is a hexadecimal digit.
mb_width (mbc)
returns the number of columns on the output device occupied by mbc.
Always >= 0.
mb_putc (mbc, stream)
outputs mbc on stream, a byte oriented FILE stream opened for output.
mb_setascii (&mbc, sc)
assigns the standard ASCII character sc to mbc.
mb_copy (&destmbc, &srcmbc)
copies srcmbc to destmbc.
Here are the function prototypes of the macros.
typedef int bool;
extern const char * mb_ptr (const mbchar_t mbc);
extern size_t mb_len (const mbchar_t mbc);
extern bool mb_iseq (const mbchar_t mbc, char sc);
extern bool mb_isnul (const mbchar_t mbc);
extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2);
extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2);
extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2);
extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2);
extern bool mb_isalnum (const mbchar_t mbc);
extern bool mb_isalpha (const mbchar_t mbc);
extern bool mb_isascii (const mbchar_t mbc);
extern bool mb_isblank (const mbchar_t mbc);
extern bool mb_iscntrl (const mbchar_t mbc);
extern bool mb_isdigit (const mbchar_t mbc);
extern bool mb_isgraph (const mbchar_t mbc);
extern bool mb_islower (const mbchar_t mbc);
extern bool mb_isprint (const mbchar_t mbc);
extern bool mb_ispunct (const mbchar_t mbc);
extern bool mb_isspace (const mbchar_t mbc);
extern bool mb_isupper (const mbchar_t mbc);
extern bool mb_isxdigit (const mbchar_t mbc);
extern int mb_width (const mbchar_t mbc);
extern void mb_putc (const mbchar_t mbc, FILE *stream);
extern void mb_setascii (mbchar_t *new, char sc);
extern void mb_copy (mbchar_t *new, const mbchar_t *old);
*/
#ifndef _SHMBCHAR_H
#define _SHMBCHAR_H 1
@@ -158,121 +32,6 @@
#include <wchar.h>
#include <wctype.h>
#define MBCHAR_BUF_SIZE 24
struct mbchar
{
const char *ptr; /* pointer to current character */
size_t bytes; /* number of bytes of current character, > 0 */
int wc_valid; /* true if wc is a valid wide character */
wchar_t wc; /* if wc_valid: the current character */
char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */
};
/* EOF (not a real character) is represented with bytes = 0 and
wc_valid = false. */
typedef struct mbchar mbchar_t;
/* Access the current character. */
#define mb_ptr(mbc) ((mbc).ptr)
#define mb_len(mbc) ((mbc).bytes)
/* Comparison of characters. */
#define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc))
#define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0)
#define mb_cmp(mbc1, mbc2) \
((mbc1).wc_valid \
? ((mbc2).wc_valid \
? (int) (mbc1).wc - (int) (mbc2).wc \
: -1) \
: ((mbc2).wc_valid \
? 1 \
: (mbc1).bytes == (mbc2).bytes \
? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
: (mbc1).bytes < (mbc2).bytes \
? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
: (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
#define mb_casecmp(mbc1, mbc2) \
((mbc1).wc_valid \
? ((mbc2).wc_valid \
? (int) towlower ((mbc1).wc) - (int) towlower ((mbc2).wc) \
: -1) \
: ((mbc2).wc_valid \
? 1 \
: (mbc1).bytes == (mbc2).bytes \
? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
: (mbc1).bytes < (mbc2).bytes \
? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
: (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
#define mb_equal(mbc1, mbc2) \
((mbc1).wc_valid && (mbc2).wc_valid \
? (mbc1).wc == (mbc2).wc \
: (mbc1).bytes == (mbc2).bytes \
&& memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
#define mb_caseequal(mbc1, mbc2) \
((mbc1).wc_valid && (mbc2).wc_valid \
? towlower ((mbc1).wc) == towlower ((mbc2).wc) \
: (mbc1).bytes == (mbc2).bytes \
&& memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
/* <ctype.h>, <wctype.h> classification. */
#define mb_isascii(mbc) \
((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127)
#define mb_isalnum(mbc) ((mbc).wc_valid && iswalnum ((mbc).wc))
#define mb_isalpha(mbc) ((mbc).wc_valid && iswalpha ((mbc).wc))
#define mb_isblank(mbc) ((mbc).wc_valid && iswblank ((mbc).wc))
#define mb_iscntrl(mbc) ((mbc).wc_valid && iswcntrl ((mbc).wc))
#define mb_isdigit(mbc) ((mbc).wc_valid && iswdigit ((mbc).wc))
#define mb_isgraph(mbc) ((mbc).wc_valid && iswgraph ((mbc).wc))
#define mb_islower(mbc) ((mbc).wc_valid && iswlower ((mbc).wc))
#define mb_isprint(mbc) ((mbc).wc_valid && iswprint ((mbc).wc))
#define mb_ispunct(mbc) ((mbc).wc_valid && iswpunct ((mbc).wc))
#define mb_isspace(mbc) ((mbc).wc_valid && iswspace ((mbc).wc))
#define mb_isupper(mbc) ((mbc).wc_valid && iswupper ((mbc).wc))
#define mb_isxdigit(mbc) ((mbc).wc_valid && iswxdigit ((mbc).wc))
/* Extra <wchar.h> function. */
/* Unprintable characters appear as a small box of width 1. */
#define MB_UNPRINTABLE_WIDTH 1
static inline int
mb_width_aux (wint_t wc)
{
int w = wcwidth (wc);
/* For unprintable characters, arbitrarily return 0 for control characters
and MB_UNPRINTABLE_WIDTH otherwise. */
return (w >= 0 ? w : iswcntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
}
#define mb_width(mbc) \
((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH)
/* Output. */
#define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream))
/* Assignment. */
#define mb_setascii(mbc, sc) \
((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \
(mbc)->wc = (mbc)->buf[0] = (sc))
/* Copying a character. */
static inline void
mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc)
{
if (old_mbc->ptr == &old_mbc->buf[0])
{
memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
new_mbc->ptr = &new_mbc->buf[0];
}
else
new_mbc->ptr = old_mbc->ptr;
new_mbc->bytes = old_mbc->bytes;
if ((new_mbc->wc_valid = old_mbc->wc_valid))
new_mbc->wc = old_mbc->wc;
}
/* is_basic(c) tests whether the single-byte character c is in the
ISO C "basic character set".
+184 -76
View File
@@ -97,6 +97,10 @@ extern int killpg __P((pid_t, int));
#define MAX_JOBS_IN_ARRAY 128 /* testing */
#endif
/* XXX for now */
#define PIDSTAT_TABLE_SZ 4096
#define BGPIDS_TABLE_SZ 512
/* Flag values for second argument to delete_job */
#define DEL_WARNSTOPPED 1 /* warn about deleting stopped jobs */
#define DEL_NOBGPID 2 /* don't add pgrp leader to bgpids */
@@ -174,6 +178,7 @@ extern SigHandler **original_signals;
static struct jobstats zerojs = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
struct jobstats js = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
ps_index_t pidstat_table[PIDSTAT_TABLE_SZ];
struct bgpids bgpids = { 0, 0, 0 };
/* The array of known jobs. */
@@ -293,12 +298,19 @@ static void restore_sigint_handler __P((void));
static void pipe_read __P((int *));
#endif
static struct pidstat *bgp_alloc __P((pid_t, int));
/* Hash table manipulation */
static ps_index_t *pshash_getbucket __P((pid_t));
static void pshash_delindex __P((ps_index_t));
/* Saved background process status management */
static struct pidstat *bgp_add __P((pid_t, int));
static int bgp_delete __P((pid_t));
static void bgp_clear __P((void));
static int bgp_search __P((pid_t));
static void bgp_prune __P((void));
static ps_index_t bgp_getindex __P((void));
static void bgp_resize __P((void)); /* XXX */
#if defined (ARRAY_VARS)
static int *pstatuses; /* list of pipeline statuses */
@@ -693,20 +705,82 @@ stop_pipeline (async, deferred)
}
/* Functions to manage the list of exited background pids whose status has
been saved. */
been saved.
static struct pidstat *
bgp_alloc (pid, status)
pid_t pid;
int status;
pidstat_table:
The current implementation is a hash table using a single (separate) arena
for storage that can be allocated and freed as a unit. The size of the hash
table is a multiple of PIDSTAT_TABLE_SZ (4096) and multiple PIDs that hash
to the same value are chained through the bucket_next and bucket_prev
pointers (basically coalesced hashing for collision resolution).
bgpids.storage:
All pid/status storage is done using the circular buffer bgpids.storage.
This must contain at least js.c_childmax entries. The circular buffer is
used to supply the ordered list Posix requires ("the last CHILD_MAX
processes"). To avoid searching the entire storage table for a given PID,
the hash table (pidstat_table) holds pointers into the storage arena and
uses a doubly-linked list of cells (bucket_next/bucket_prev, also pointers
into the arena) to implement collision resolution. */
/* The number of elements in bgpids.storage always has to be > js.c_childmax for
the circular buffer to work right. */
static void
bgp_resize ()
{
struct pidstat *ps;
ps_index_t nsize;
ps_index_t psi;
ps = (struct pidstat *)xmalloc (sizeof (struct pidstat));
ps->pid = pid;
ps->status = status;
ps->next = (struct pidstat *)0;
return ps;
if (bgpids.nalloc == 0)
{
/* invalidate hash table when bgpids table is reallocated */
for (psi = 0; psi < PIDSTAT_TABLE_SZ; psi++)
pidstat_table[psi] = NO_PIDSTAT;
nsize = BGPIDS_TABLE_SZ; /* should be power of 2 */
bgpids.head = 0;
}
else
nsize = bgpids.nalloc;
while (nsize < js.c_childmax)
nsize *= 2;
if (bgpids.nalloc < js.c_childmax)
{
bgpids.storage = (struct pidstat *)xrealloc (bgpids.storage, nsize * sizeof (struct pidstat));
for (psi = bgpids.nalloc; psi < nsize; psi++)
bgpids.storage[psi].pid = NO_PID;
bgpids.nalloc = nsize;
}
else if (bgpids.head >= bgpids.nalloc) /* wrap around */
bgpids.head = 0;
}
static ps_index_t
bgp_getindex ()
{
ps_index_t psi;
if (bgpids.nalloc < js.c_childmax || bgpids.head >= bgpids.nalloc)
bgp_resize ();
pshash_delindex (bgpids.head); /* XXX - clear before reusing */
return bgpids.head++;
}
static ps_index_t *
pshash_getbucket (pid)
pid_t pid;
{
unsigned long hash; /* XXX - u_bits32_t */
hash = pid * 0x9e370001UL;
return (&pidstat_table[hash % PIDSTAT_TABLE_SZ]);
}
static struct pidstat *
@@ -714,61 +788,75 @@ bgp_add (pid, status)
pid_t pid;
int status;
{
ps_index_t *bucket, psi;
struct pidstat *ps;
ps = bgp_alloc (pid, status);
bucket = pshash_getbucket (pid);
psi = bgp_getindex ();
ps = &bgpids.storage[psi];
ps->pid = pid;
ps->status = status;
ps->bucket_next = *bucket;
ps->bucket_prev = NO_PIDSTAT;
if (bgpids.list == 0)
{
bgpids.list = bgpids.end = ps;
bgpids.npid = 0; /* just to make sure */
}
else
{
bgpids.end->next = ps;
bgpids.end = ps;
}
bgpids.npid++;
#if 0
if (bgpids.npid > js.c_childmax)
bgp_prune ();
#endif
if (ps->bucket_next != NO_PIDSTAT)
bgpids.storage[ps->bucket_next].bucket_prev = psi;
*bucket = psi; /* set chain head in hash table */
return ps;
}
static void
pshash_delindex (psi)
ps_index_t psi;
{
struct pidstat *ps;
ps = &bgpids.storage[psi];
if (ps->pid == NO_PID)
return;
if (ps->bucket_next != NO_PID)
bgpids.storage[ps->bucket_next].bucket_prev = ps->bucket_prev;
if (ps->bucket_prev != NO_PID)
bgpids.storage[ps->bucket_prev].bucket_next = ps->bucket_next;
else
*(pshash_getbucket (ps->pid)) = ps->bucket_next;
}
static int
bgp_delete (pid)
pid_t pid;
{
struct pidstat *prev, *p;
ps_index_t psi;
for (prev = p = bgpids.list; p; prev = p, p = p->next)
if (p->pid == pid)
{
prev->next = p->next; /* remove from list */
break;
}
if (bgpids.storage == 0 || bgpids.nalloc == 0 || bgpids.npid == 0)
return 0;
if (p == 0)
/* Search chain using hash to find bucket in pidstat_table */
for (psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)
if (bgpids.storage[psi].pid == pid)
break;
if (psi == NO_PIDSTAT)
return 0; /* not found */
#if defined (DEBUG)
itrace("bgp_delete: deleting %d", pid);
#endif
/* Housekeeping in the border cases. */
if (p == bgpids.list)
bgpids.list = bgpids.list->next;
else if (p == bgpids.end)
bgpids.end = prev;
pshash_delindex (psi); /* hash table management */
bgpids.npid--;
if (bgpids.npid == 0)
bgpids.list = bgpids.end = 0;
else if (bgpids.npid == 1)
bgpids.end = bgpids.list; /* just to make sure */
free (p);
return 1;
}
@@ -776,48 +864,45 @@ bgp_delete (pid)
static void
bgp_clear ()
{
struct pidstat *ps, *p;
if (bgpids.storage == 0 || bgpids.nalloc == 0)
return;
free (bgpids.storage);
bgpids.storage = 0;
bgpids.nalloc = 0;
bgpids.head = 0;
for (ps = bgpids.list; ps; )
{
p = ps;
ps = ps->next;
free (p);
}
bgpids.list = bgpids.end = 0;
bgpids.npid = 0;
}
/* Search for PID in the list of saved background pids; return its status if
found. If not found, return -1. */
found. If not found, return -1. We hash to the right spot in pidstat_table
and follow the bucket chain to the end. */
static int
bgp_search (pid)
pid_t pid;
{
struct pidstat *ps;
ps_index_t psi;
if (bgpids.storage == 0 || bgpids.nalloc == 0 || bgpids.npid == 0)
return -1;
/* Search chain using hash to find bucket in pidstat_table */
for (psi = *(pshash_getbucket (pid)); psi != NO_PIDSTAT; psi = bgpids.storage[psi].bucket_next)
if (bgpids.storage[psi].pid == pid)
return (bgpids.storage[psi].status);
for (ps = bgpids.list ; ps; ps = ps->next)
if (ps->pid == pid)
return ps->status;
return -1;
}
#if 0
static void
bgp_prune ()
{
struct pidstat *ps;
if (bgpids.npid == 0 || bgpids.list == 0)
return; /* just paranoia */
while (bgpids.npid > js.c_childmax)
{
ps = bgpids.list;
bgpids.list = bgpids.list->next;
free (ps);
bgpids.npid--;
}
return;
}
#endif
/* Reset the values of js.j_lastj and js.j_firstj after one or both have
been deleted. The caller should check whether js.j_njobs is 0 before
@@ -2040,9 +2125,18 @@ get_original_tty_job_signals ()
if (fetched == 0)
{
get_original_signal (SIGTSTP);
get_original_signal (SIGTTIN);
get_original_signal (SIGTTOU);
if (interactive_shell)
{
set_original_signal (SIGTSTP, SIG_DFL);
set_original_signal (SIGTTIN, SIG_DFL);
set_original_signal (SIGTTOU, SIG_DFL);
}
else
{
get_original_signal (SIGTSTP);
get_original_signal (SIGTTIN);
get_original_signal (SIGTTOU);
}
fetched = 1;
}
}
@@ -2366,7 +2460,7 @@ wait_sigint_handler (sig)
{
trap_handler (SIGINT); /* set pending_traps[SIGINT] */
wait_signal_received = SIGINT;
if (interrupt_immediately)
if (interrupt_immediately && wait_intr_flag)
{
interrupt_immediately = 0;
sh_longjmp (wait_intr_buf, 1);
@@ -2694,7 +2788,7 @@ if (job == NO_JOB)
itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp);
#endif
/* Don't modify terminal pgrp if we are running in background or a subshell */
if (running_in_background == 0 && subshell_environment == 0)
if (running_in_background == 0 && (subshell_environment&(SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
give_terminal_to (shell_pgrp, 0);
}
@@ -3478,7 +3572,7 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc
wait_signal_received = SIGCHLD;
/* If we're in a signal handler, let CHECK_WAIT_INTR pick it up;
run_pending_traps will call run_sigchld_trap later */
if (sigchld == 0)
if (sigchld == 0 && wait_intr_flag)
sh_longjmp (wait_intr_buf, 1);
}
/* If not in posix mode and not executing the wait builtin, queue the
@@ -3641,7 +3735,6 @@ set_job_status_and_cleanup (job)
{
int old_frozen;
itrace("waitchld: special handling for SIGINT");
wait_sigint_received = 0;
/* If SIGINT is trapped, set the exit status so that the trap
@@ -4051,6 +4144,11 @@ initialize_job_control (force)
if (js.c_childmax < 0)
js.c_childmax = DEFAULT_CHILD_MAX;
#if 0
if (js.c_childmax > MAX_CHILD_MAX)
js.c_childmax = MAX_CHILD_MAX;
#endif
return job_control;
}
@@ -4271,7 +4369,12 @@ delete_all_jobs (running_only)
itrace("delete_all_jobs: job %d non-null after js.j_lastj (%d)", i, js.j_lastj);
#endif
if (jobs[i] && (running_only == 0 || (running_only && RUNNING(i))))
delete_job (i, DEL_WARNSTOPPED);
/* We don't want to add any of these pids to bgpids. If running_only
is non-zero, we don't want to add running jobs to the list.
If we are interested in all jobs, not just running jobs, and
we are going to clear the bgpids list below (bgp_clear()), we
don't need to bother. */
delete_job (i, DEL_WARNSTOPPED|DEL_NOBGPID);
}
if (running_only == 0)
{
@@ -4422,6 +4525,11 @@ mark_dead_jobs_as_notified (force)
if (js.c_childmax < 0)
js.c_childmax = DEFAULT_CHILD_MAX;
#if 0
if (js.c_childmax > MAX_CHILD_MAX)
js.c_childmax = MAX_CHILD_MAX;
#endif
/* Don't do anything if the number of dead processes is less than CHILD_MAX
and we're not forcing a cleanup. */
if (ndeadproc <= js.c_childmax)
+16 -6
View File
@@ -1,6 +1,6 @@
/* jobs.h -- structures and definitions used by the jobs.c file. */
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -142,18 +142,28 @@ struct jobstats {
JOB *j_lastasync; /* last async job allocated by stop_pipeline */
};
/* Revised to accommodate new hash table bgpids implementation. */
typedef pid_t ps_index_t;
struct pidstat {
struct pidstat *next;
pid_t pid;
int status;
ps_index_t bucket_next;
ps_index_t bucket_prev;
pid_t pid;
bits16_t status; /* only 8 bits really needed */
};
struct bgpids {
struct pidstat *list;
struct pidstat *end;
struct pidstat *storage; /* storage arena */
ps_index_t head;
ps_index_t nalloc;
int npid;
};
#define NO_PIDSTAT (ps_index_t)-1
#define NO_JOB -1 /* An impossible job array index. */
#define DUP_JOB -2 /* A possible return value for get_job_spec (). */
#define BAD_JOBSPEC -3 /* Bad syntax for job spec. */
+1 -1
View File
@@ -110,7 +110,7 @@ _print_malloc_stats (s, fp)
}
fprintf (fp, "\nTotal bytes in use: %lu, total bytes free: %lu\n",
totused, totfree);
fprintf (fp, "\nTotal bytes requested by application: %lu\n", _mstats.bytesreq);
fprintf (fp, "\nTotal bytes requested by application: %lu\n", (unsigned long)_mstats.bytesreq);
fprintf (fp, "Total mallocs: %d, total frees: %d, total reallocs: %d (%d copies)\n",
_mstats.nmal, _mstats.nfre, _mstats.nrealloc, _mstats.nrcopy);
fprintf (fp, "Total sbrks: %d, total bytes via sbrk: %d\n",
+1 -1
View File
@@ -290,7 +290,7 @@ _register_dump_table(fp)
{
entry = mem_table[i];
if (entry.mem)
fprintf (fp, "%s[%d] %p:%d:%s:%s:%s:%d:%d:%d\n",
fprintf (fp, "%s[%d] %p:%zu:%s:%s:%s:%d:%d:%d\n",
(i == table_bucket_index) ? "*" : "",
i,
entry.mem, entry.size,
+2 -2
View File
@@ -52,10 +52,10 @@ mtrace_alloc (tag, mem, size, file, line)
_mtrace_fp = stderr;
if (_mtrace_verbose)
fprintf (_mtrace_fp, "alloc: %s: %p (%d bytes) from '%s:%d'\n",
fprintf (_mtrace_fp, "alloc: %s: %p (%zu bytes) from '%s:%d'\n",
tag, mem, size, file ? file : "unknown", line);
else
fprintf (_mtrace_fp, "alloc:%p:%d:%s:%d\n",
fprintf (_mtrace_fp, "alloc:%p:%zu:%s:%d\n",
mem, size, file ? file : "unknown", line);
}
+68 -16
View File
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2012 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.
@@ -74,8 +74,13 @@ Keymap rl_binding_keymap;
static int _rl_skip_to_delim PARAMS((char *, int, int));
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
static void _rl_init_file_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
static void _rl_init_file_error ();
#endif
static char *_rl_read_file PARAMS((char *, size_t *));
static void _rl_init_file_error PARAMS((const char *));
static int _rl_read_init_file PARAMS((const char *, int));
static int glean_key_from_name PARAMS((char *));
@@ -989,14 +994,35 @@ _rl_read_init_file (filename, include_level)
}
static void
_rl_init_file_error (msg)
const char *msg;
#if defined (PREFER_STDARG)
_rl_init_file_error (const char *format, ...)
#else
_rl_init_file_error (va_alist)
va_dcl
#endif
{
va_list args;
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
fprintf (stderr, "readline: ");
if (currently_reading_init_file)
_rl_errmsg ("%s: line %d: %s\n", current_readline_init_file,
current_readline_init_lineno, msg);
else
_rl_errmsg ("%s", msg);
fprintf (stderr, "%s: line %d: ", current_readline_init_file,
current_readline_init_lineno);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
va_end (args);
}
/* **************************************************************** */
@@ -1216,7 +1242,7 @@ handle_parser_directive (statement)
}
/* display an error message about the unknown parser directive */
_rl_init_file_error ("unknown parser directive");
_rl_init_file_error ("%s: unknown parser directive", directive);
return (1);
}
@@ -1262,7 +1288,7 @@ rl_parse_and_bind (string)
{
char *funname, *kname;
register int c, i;
int key, equivalency;
int key, equivalency, foundmod, foundsep;
while (string && whitespace (*string))
string++;
@@ -1292,7 +1318,7 @@ rl_parse_and_bind (string)
/* If we didn't find a closing quote, abort the line. */
if (string[i] == '\0')
{
_rl_init_file_error ("no closing `\"' in key binding");
_rl_init_file_error ("%s: no closing `\"' in key binding", string);
return 1;
}
else
@@ -1304,6 +1330,8 @@ rl_parse_and_bind (string)
equivalency = (c == ':' && string[i + 1] == '=');
foundsep = c != 0;
/* Mark the end of the command (or keyname). */
if (string[i])
string[i++] = '\0';
@@ -1393,6 +1421,12 @@ remove_trailing:
return 0;
}
if (foundsep == 0)
{
_rl_init_file_error ("%s: no key sequence terminator", string);
return 1;
}
/* If this is a new-style key-binding, then do the binding with
rl_bind_keyseq (). Otherwise, let the older code deal with it. */
if (*string == '"')
@@ -1449,11 +1483,24 @@ remove_trailing:
key = glean_key_from_name (kname);
/* Add in control and meta bits. */
foundmod = 0;
if (substring_member_of_array (string, _rl_possible_control_prefixes))
key = CTRL (_rl_to_upper (key));
{
key = CTRL (_rl_to_upper (key));
foundmod = 1;
}
if (substring_member_of_array (string, _rl_possible_meta_prefixes))
key = META (key);
{
key = META (key);
foundmod = 1;
}
if (foundmod == 0 && kname != string)
{
_rl_init_file_error ("%s: unknown key modifier", string);
return 1;
}
/* Temporary. Handle old-style keyname with macro-binding. */
if (*funname == '\'' || *funname == '"')
@@ -1480,6 +1527,7 @@ remove_trailing:
#endif /* PREFIX_META_HACK */
else
rl_bind_key (key, rl_named_function (funname));
return 0;
}
@@ -1681,10 +1729,14 @@ rl_variable_bind (name, value)
i = find_string_var (name);
/* For the time being, unknown variable names or string names without a
handler function are simply ignored. */
/* For the time being, string names without a handler function are simply
ignored. */
if (i < 0 || string_varlist[i].set_func == 0)
return 0;
{
if (i < 0)
_rl_init_file_error ("%s: unknown variable name", name);
return 0;
}
v = (*string_varlist[i].set_func) (value);
return v;
+1 -1
View File
@@ -1,6 +1,6 @@
/* callback.c -- functions to use readline as an X `callback' mechanism. */
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
/* Copyright (C) 1987-2015 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.
+1 -1
View File
@@ -1,6 +1,6 @@
/* chardefs.h -- Character definitions for readline. */
/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
/* Copyright (C) 1994-2015 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.
+2 -2
View File
@@ -2,8 +2,8 @@
Modified by Chet Ramey for Readline.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 Free Software Foundation,
Inc.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+2 -2
View File
@@ -2,8 +2,8 @@
Modified by Chet Ramey for Readline.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 Free Software Foundation,
Inc.
Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+111 -13
View File
@@ -1,6 +1,6 @@
/* display.c -- readline redisplay facility. */
/* Copyright (C) 1987-2013 Free Software Foundation, Inc.
/* Copyright (C) 1987-2015 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.
@@ -192,6 +192,8 @@ static int prompt_multibyte_chars;
/* Number of lines currently on screen minus 1. */
int _rl_vis_botlin = 0;
static int _rl_inv_botlin = 0;
/* Variables used only in this file. */
/* The last left edge of text that was displayed. This is used when
doing horizontal scrolling. It shifts in thirds of a screenwidth. */
@@ -580,13 +582,13 @@ rl_redisplay ()
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, n0, num, prompt_lines_estimate;
char *prompt_this_line;
int mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
size_t wc_bytes;
int wc_width;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
int mb_cur_max = MB_CUR_MAX;
#endif
if (_rl_echoing_p == 0)
@@ -737,6 +739,8 @@ rl_redisplay ()
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
/* lpos is a physical cursor position, so it needs to be adjusted by the
number of invisible characters in the prompt, per line */
lpos = prompt_physical_chars + modmark;
#if defined (HANDLE_MULTIBYTE)
@@ -757,6 +761,16 @@ rl_redisplay ()
while (lpos >= _rl_screenwidth)
{
int z, p;
int nocorrect, wadjust;
nocorrect = 0;
/* Adjust depending on the invisible characters in the line. We use a
heuristic based on experience: invisible characters nearly always
appear in the first and last lines of the prompt */
wadjust = (newlines == 0)
? prompt_invis_chars_first_line
: ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
invisible characters that is longer than the screen width. The
prompt_invis_chars_first_line variable could be made into an array
@@ -767,11 +781,14 @@ rl_redisplay ()
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
{
nocorrect = 1;
n0 = num;
temp = local_prompt_len;
while (num < temp)
{
z = _rl_col_width (local_prompt, n0, num, 1);
/* This has to take invisible characters in the prompt into
account. */
z = _rl_col_width (local_prompt, n0, num, 1) - wadjust;
if (z > _rl_screenwidth)
{
num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
@@ -798,16 +815,18 @@ rl_redisplay ()
/* Now account for invisible characters in the current line. */
/* XXX - this assumes that the invisible characters may be split, but only
between the first and the last lines. */
temp += (newlines == 0) ? prompt_invis_chars_first_line
: ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
if (nocorrect == 0)
temp += wadjust;
inv_lbreaks[++newlines] = temp;
#if defined (HANDLE_MULTIBYTE)
/* lpos is a physical cursor position, so it needs to take the invisible
characters into account. */
if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
lpos -= _rl_col_width (local_prompt, n0, num, 1);
lpos -= _rl_col_width (local_prompt, n0, num, 1) - wadjust;
else
#endif
lpos -= _rl_screenwidth;
lpos -= _rl_screenwidth - wadjust;
}
prompt_last_screen_line = newlines;
@@ -999,7 +1018,7 @@ rl_redisplay ()
lb_linenum = newlines;
}
inv_botlin = lb_botlin = newlines;
inv_botlin = lb_botlin = _rl_inv_botlin = newlines;
CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
cursor_linenum = lb_linenum;
@@ -1029,9 +1048,11 @@ rl_redisplay ()
not the first. */
if (out >= _rl_screenchars)
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY);
else
#endif
out = _rl_screenchars - 1;
}
@@ -1616,6 +1637,11 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (_rl_last_v_pos != current_line)
{
_rl_move_vert (current_line);
/* We have moved up to a new screen line. This line may or may not have
invisible characters on it, but we do our best to recalculate
visible_wrap_offset based on what we know. */
if (current_line == 0)
visible_wrap_offset = prompt_invis_chars_first_line; /* XXX */
if ((MB_CUR_MAX == 1 || rl_byte_oriented) && current_line == 0 && visible_wrap_offset)
_rl_last_c_pos += visible_wrap_offset;
}
@@ -1627,16 +1653,31 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
string, then redraw the entire prompt string. We can only do this
reliably if the terminal supports a `cr' capability.
This can also happen if the prompt string has changed, and the first
difference in the line is in the middle of the prompt string, after a
sequence of invisible characters (worst case) and before the end of
the prompt. In this case, we have to redraw the entire prompt string
so that the entire sequence of invisible characters is drawn. We need
to handle the worst case, when the difference is after (or in the middle
of) a sequence of invisible characters that changes the text color and
before the sequence that restores the text color to normal. Then we have
to make sure that the lines still differ -- if they don't, we can
return immediately.
This is not an efficiency hack -- there is a problem with redrawing
portions of the prompt string if they contain terminal escape
sequences (like drawing the `unbold' sequence without a corresponding
`bold') that manifests itself on certain terminals. */
lendiff = local_prompt_len;
if (lendiff > nmax)
lendiff = nmax;
od = ofd - old; /* index of first difference in visible line */
nd = nfd - new;
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
od >= lendiff && _rl_last_c_pos < PROMPT_ENDING_INDEX)
(((od > 0 || nd > 0) && (od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
@@ -1655,6 +1696,43 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
}
else
_rl_last_c_pos = lendiff + modmark;
/* Now if we have printed the prompt string because the first difference
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) &&
omax == nmax &&
lendiff > (ols-old) && lendiff > (nls-new))
return;
/* XXX - we need to fix up our calculations if we are now past the
old ofd/nfd and the prompt length (or line length) has changed.
We punt on the problem and do a dumb update. We'd like to be able
to just output the prompt from the beginning of the line up to the
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))
{
nfd = new + lendiff; /* number of characters we output above */
nd = lendiff;
/* Do a dumb update and return */
temp = ne - nfd;
if (temp > 0)
{
_rl_output_some_chars (nfd, temp);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
else
_rl_last_c_pos += temp;
}
if (nmax < omax)
goto clear_rest_of_line; /* XXX */
else
return;
}
}
o_cpos = _rl_last_c_pos;
@@ -1816,11 +1894,15 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
char in the current line (which implies we just output some invisible
characters) we need to adjust _rl_last_c_pos, since it represents
a physical character position. */
/* The current_line*rl_screenwidth+prompt_invis_chars_first_line is a
crude attempt to compute how far into the new line buffer we are.
It doesn't work well in the face of multibyte characters and needs
to be rethought. XXX */
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
current_line == prompt_last_screen_line && wrap_offset &&
displaying_prompt_first_line &&
wrap_offset != prompt_invis_chars_first_line &&
((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth))))
((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth+prompt_invis_chars_first_line))))
{
_rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
cpos_adjusted = 1;
@@ -2039,7 +2121,8 @@ rl_redraw_prompt_last_line ()
(Well, when we don't have multibyte characters, _rl_last_c_pos is a
buffer index.)
DATA is the contents of the screen line of interest; i.e., where
the movement is being done. */
the movement is being done.
DATA is always the visible line or the invisible line */
void
_rl_move_cursor_relative (new, data)
int new;
@@ -2049,6 +2132,7 @@ _rl_move_cursor_relative (new, data)
int woff; /* number of invisible chars on current line */
int cpos, dpos; /* current and desired cursor positions */
int adjust;
int in_invisline;
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
@@ -2087,14 +2171,28 @@ _rl_move_cursor_relative (new, data)
if (displaying_prompt_first_line == 0)
adjust = 0;
/* yet another special case: printing the last line of a prompt with
multibyte characters and invisible characters whose printable length
exceeds the screen width with the last invisible character
(prompt_last_invisible) in the last line. IN_INVISLINE is the
offset of DATA in invisible_line */
in_invisline = 0;
if (data > invisible_line && data < invisible_line+inv_lbreaks[_rl_inv_botlin+1])
in_invisline = data - invisible_line;
/* Use NEW when comparing against the last invisible character in the
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
/* NEW is relative to the current displayed line, while
PROMPT_LAST_INVISIBLE is relative to the entire (wrapped) line.
Need a way to reconcile these two variables by turning NEW into a
buffer position relative to the start of the line */
if (adjust && ((new > prompt_last_invisible) || /* XXX - don't use woff here */
(prompt_physical_chars >= _rl_screenwidth &&
(new+in_invisline > prompt_last_invisible) || /* invisible line */
(prompt_physical_chars >= _rl_screenwidth && /* visible line */
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset >= woff && dpos >= woff &&
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset))))
new > (prompt_last_invisible-(vis_lbreaks[_rl_last_v_pos])-wrap_offset))))
/* XXX last comparison might need to be >= */
{
dpos -= woff;
+1 -1
View File
@@ -12,7 +12,7 @@ This document describes the GNU History library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+2 -1
View File
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988-2014 Free Software Foundation, Inc.
Copyright (C) 1988-2016 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -242,6 +242,7 @@ is greater than the history length, return a @code{NULL} pointer.
@deftypefun time_t history_get_time (HIST_ENTRY *entry)
Return the time stamp associated with the history entry @var{entry}.
If the timestamp is missing or invalid, return 0.
@end deftypefun
@deftypefun int history_total_bytes (void)
+2 -2
View File
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988--2014 Free Software Foundation, Inc.
Copyright (C) 1988--2016 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -102,7 +102,7 @@ associated with each history entry is written to the history file,
marked with the history comment character.
When the history file is read, lines beginning with the history
comment character followed immediately by a digit are interpreted
as timestamps for the previous history line.
as timestamps for the following history entry.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
+1 -1
View File
@@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+1 -1
View File
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
in the consistency of user interface across discrete programs that need
to provide a command line interface.
Copyright (C) 1988--2014 Free Software Foundation, Inc.
Copyright (C) 1988--2016 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
+4 -3
View File
@@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the
GNU Readline Library.
Copyright (C) 1988--2014 Free Software Foundation, Inc.
Copyright (C) 1988--2016 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -608,8 +608,9 @@ Acceptable @code{keymap} names are
@code{vi-move},
@code{vi-command}, and
@code{vi-insert}.
@code{vi} is equivalent to @code{vi-command}; @code{emacs} is
equivalent to @code{emacs-standard}. The default value is @code{emacs}.
@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a
synonym); @code{emacs} is equivalent to @code{emacs-standard}.
The default value is @code{emacs}.
The value of the @code{editing-mode} variable also affects the
default keymap.
+1 -1
View File
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
Copyright @copyright{} 1988--2014 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+6 -6
View File
@@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2015 Free Software Foundation, Inc.
Copyright (C) 1988-2016 Free Software Foundation, Inc.
@end ignore
@set EDITION 6.4
@set VERSION 6.4
@set UPDATED 28 May 2015
@set UPDATED-MONTH May 2015
@set EDITION 7.0
@set VERSION 7.0
@set UPDATED 25 January 2016
@set UPDATED-MONTH January 2016
@set LASTCHANGE Thu May 28 16:58:07 EDT 2015
@set LASTCHANGE Mon Jan 25 10:08:41 EST 2016
+1 -1
View File
@@ -1,6 +1,6 @@
/* funmap.c -- attach names to functions. */
/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
/* Copyright (C) 1987-2015 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.

Some files were not shown because too many files have changed in this diff Show More