commit bash-20121228 snapshot

This commit is contained in:
Chet Ramey
2013-01-03 10:48:31 -05:00
parent 36eb585cfa
commit 7175a77f3a
56 changed files with 52723 additions and 10878 deletions
+494
View File
@@ -0,0 +1,494 @@
This document details the changes between this version, bash-4.3-alpha,
and the previous version, bash-4.2-release.
1. Changes to Bash
a. Fixed several bugs concerning incomplete bracket expressions in filename
generation (globbing) patterns.
b. Fixed a bug with single quotes and WORD in ${param op WORD} when running
in Posix mode.
c. Fixed a bug that caused the pattern removal and pattern substitution word
expansions and case statement word expansion to not match the empty string.
d. Fixed a bug that caused the tzset() function to not work after changing
the TZ enviroment variable.
e. Fixed a bug that caused the RHS of an assignment statement to undergo
word splitting when it contained an unquoted $@.
f. Fixed bugs that caused the shell to not react to a SIGINT sent while
waiting for a child process to exit.
g. Bash doesn't try to run things in a signal handler context when it gets a
signal (SIGINT/SIGHUP/etc) while reading input using readline but still
be responsive to terminating signals.
h. Fixed a bug that caused bash to go into an infinite loop if a filename
to be matched contained an invalid multibyte character.
i. Fixed a bug that caused PS4 to end up being truncated if it is longer
than 128 bytes.
j. Fixed a bug that caused brace expansion to not skip over double-quoted
command substitution.
k. System-specific updates for: DJGPP, HP/UX, Mac OS X
l. Fixed a bug in displaying commands that caused redirections to be associated
with the wrong part of the command.
m. Fixed the coproc cleanup to unset the appropriate shell variables when a
coproc terminates.
n. Fixed a bug that caused `fc' to dump core due to incorrect calculation of
the last history entry.
o. Added workarounds for FreeBSD's implementation of faccessat/eaccess and
`test -x'.
p. Fixed a bug that caused the shell to not match patterns containing
control-A.
q. Fixed a bug that could result in doubled error messages when the `printf'
builtin got a write error.
r. Fixed a bug that caused the shell to not correctly expand words containing
multiple consecutive quoted empty strings (""""""aa).
s. Fixed a bug that caused the shell to not correctly parse multi-line
process substitutions containing comments and quoted strings.
t. Fixed a problem with the bash malloc's internal idea of the top of the
memory heap that resulted in incorrect decisions to try to reduce the
break and give memory back to the kernel.
u. There are changes to the expansions peformed on compound array assignments,
in an effort to make foo=( [ind1]=bar [ind2]=baz ) identical to
foo[ind1]=bar foo[ind2]=baz.
v. Bash now reports an error if `read -a name' is used when `name' is an
existing associative array.
w. Fixed a bug that allowed an attempted assignment to a readonly variable
in an arithmetic expression to not return failure.
x. Fixed several bugs that caused completion functions to be invoked even when
the cursor was before the first word in the command.
y. Fixed a bug that caused parsing a command substitution to overwrite the
parsing state associated with the complete input line.
z. Fixed several bugs with the built-in snprintf replacement and field widths
and floating point.
aa. Fixed a bug that caused incorrect offset calculations and input buffer
corruption when reading files longer than 2^31 bytes.
bb. Fixed several bugs where bash performed arithmetic evaluation in contexts
where evaluation is suppressed.
cc. Fixed a bug that caused bash to close FIFOs used for process substitution
too early when a shell function was executing, but protect against using
all file descriptors when the shell functions are invoked inside loops.
dd. Added checks for printable (and non-printable) multibyte characters for
use in error messages.
ee. Fixed a bug that caused ^O (operate-and-get-next) to not work correctly
at the end of the history list.
ff. Fixed a bug that caused command-oriented history to incorrectly combine
here documents into one line.
gg. Fixed a bug that caused importing SHELLOPTS from the environment into a
Posix-mode shell to print an error message and refuse to parse it.
hh. Fixed a bug that caused the shell to delete an extra history entry when
using `history -s'.
ii. Fixed a bug that caused floating-point exceptions and overflow errors
for the / and % arithmetic operators when using INTMAX_MIN and -1.
jj. Fixed a bug that caused parsing errors when reading an arithmetic for
loop inside a command substitution.
kk. Fixed a bug that caused a readonly function to be unset when unset was
called without the -f or -v option.
ll. Fixed several bugs in the code that quotes characters special to regular
expressions when used in a quoted string on the RHS of the =~ operator
to the [[ command.
mm. Fixed a bug that caused redirections to fail because the file descriptor
limit was set to a value less than 10.
nn. Fixed a bug that caused the `read' builtin to execute code in a signal
handler context if read timed out.
oo. Fixed a bug that caused extended globbing patterns to not match files
beginning with `.' correctly when a `.' was explicitly supplied in the
pattern.
pp. Fixed a bug that caused key sequences longer than two characters to not
work when used with `bind -x'.
qq. Fixed a bug that resulted in redefined functions having the wrong source
file names in BASH_SOURCE.
rr. Fixed a bug that caused the read builtin to assign null strings to variables
when using `read -N', which caused core dumps when referenced
ss. Fixed a bug that caused `bash -m script' to not enable job control while
running the script.
tt. Fixed a bug that caused `printf -v var' to dump core when used with the
%b format code.
uu. Fixed a bug that caused the shell to exit with the wrong status if -e was
active and the shell exited on a substitution error.
vv. Fixed a bug that caused the shell to seg fault if an array variable with
the same name as an existing associative array was implicitly created by
an assignment (declare a[n]=b).
ww. Fixed a bug that caused a redirection to misbehave if the number specified
for a file descriptor overflows an intmax_t.
xx. Fixed several bugs with the handling of valid and invalid unicode character
values when used with the \u and \U escape sequences to printf and $'...'.
yy. Fixed a bug that caused tildes to not be escaped in expanded filenames,
making them subject to later expansion.
zz. When using the pattern substitution word expansion, bash now runs the
replacement string through quote removal, since it allows quotes in that
string to act as escape characters. This is not backwards compatible, so
it can be disabled by setting the bash compatibility mode to 4.2.
aaa. Fixed the rest of the cases where the shell runs non-allowed code in a
signal handler context.
bbb. Fixed a bug that caused spurious DEL characters (\177) to appear in
double-quoted expansion where the RHS is evaluated to the empty string.
ccc. Fixed a bug that caused the use of the shell's internal random number
generator for temporary file names to perturb the random number
sequence.
ddd. Fixed several bugs that caused `declare -g' to not set the right global
variables or to misbehave when declaring global indexed arrays.
eee. Fixed a logic bug that caused extended globbing in a multibyte locale to
cause failures when using the pattern substititution word expansions.
fff. Fixed a bug that caused the `lastpipe' option to corrupt the file
descriptor used to read the script.
ggg. Fixed a bug that causes the shell to delete DEL characters in the
expanded value of variables used in the same quoted string as variables
that expand to nothing.
hhh. Fixed a bug that caused the shell to assign the wrong value from an
assignment like (( x=7 )) when `x' was an existing array variable.
iii. Fixed a bug that caused the shell to misbehave when generating sequences
and the boundary values overflow an intmax_t.
jjj. Fixed a bug caused expansion errors if an expansion of "$@" appeared
next to another expansion (e.g.. "${@}${x}").
kkk. Fixed a potential buffer overflow bug when performing /dev/fd expansion.
lll. Fixed a bug that resulted in an extra semicolon being added to compound
assignments when they were added to the history list.
mmm. Fixed a bug that caused mapfile to read one extra line from the input.
nnn. Fixed a bug that caused the mail checking code to use uninitialized
values.
ooo. Fixed a bug that prevented history timestamps from being saved if the
history comment character is unset.
ppp. Fixed a bug that caused the case-modifying expansions to not work with
multibyte characters.
qqq. Fixed a bug that caused the edit-and-execute bindable readline command
to see the wrong data if invoked in the middle of a multi-line quoted
string.
rrr. Fixed a bug that resulted in the shell returning the wrong exit status
for a background command on systems that recycle PIDs very quickly.
sss. Fixed a bug that caused asynchronous group commands to not run any EXIT
trap defined in the body of the command.
ttt. Fixed a bug that caused `eval "... ; return"' to not clean up properly.
uuu. Fixed a bug that caused the shell to dump core if `read' reads an escaped
IFS whitespace character.
vvv. Fixed a bug that caused BASH_COMMAND to be set to an incorrect value when
executing a (...) subshell.
www. Fixed a pointer aliasing bug with the token string in arithmetic
evaluation.
xxx. Fixed a bug with parsing multi-line command substitutions when reading
the `do' keyword followed by whitespace.
yyy. Fixed a bug that caused the shell to seg fault if the time given to the
printf %(...)T format overflowed the value accepted by localtime(3).
zzz. Fixed a problem with displaying help topics in two columns when the
translated text contained multibyte characters.
aaaa. Fixed a bug with the extended globbing pattern matcher where a `*' was
followed by a negated extended glob pattern.
bbbb. Fixed a race condition with short-lived coproc creation and reaping that
caused the child process to be reaped before the various coproc shell
variables were initialized.
cccc. Fixed a bug where turning off `errexit' in command substitution subshells
was not reflected in $SHELLOPTS.
dddd. Partially fixed an inconsistency in how the shell treated shell
functions run from an EXIT trap.
eeee. Fixed a bug in how the shell invalidated FIFOs used for process
substitution when executing a pipeline (once rather than in every child).
ffff. Fixed a bug that occurred when expanding a special variable ($@, $*)
within double quotes and the expansion resulted in an empty string.
gggg. Fixed bugs with executing a SIGCHLD trap handler to make sure that it's
executed once per exited child.
hhhh. Fixed a bug that caused `declare' and `test' to find variables that
had been given attributes but not assigned values. Such variables are
not set.
iiii. Fixed a bug that caused commands in process substitutions to not look in
the local temporary environment when performing word expansions.
jjjj. Fixed several problems with globstar expansions (**/**) returning null
filenames and multiple instances of the same pathname.
kkkk. Fixed an oversight that did not allow the exit status of `coproc' to
be inverted using `!'.
llll. Fixed a bug that caused the -e option to be re-enabled using `set -e'
even when executing in a context where -e is ignored.
mmmm. Fixed a (mostly theoretical) bug with input lines longer than SIZE_MAX.
2. Changes to Readline
a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
commands to work on the entire line.
b. Fixed a bug that caused redisplay problems with prompts longer than 128
characters and history searches.
c. Fixed a bug that caused readline to try and run code to modify its idea
of the screen size in a signal handler context upon receiving a SIGWINCH.
d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
of an individual call top readline().
e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
redisplay to mishandle zero-width combining characters.
f. Fixed a bug that caused readline to `forget' part of a key sequence when
a multiple-key sequence caused it to break out of an incremental search.
g. Fixed bugs that caused readline to execute code in a signal handler
context if interrupted while reading from the file system during completion.
h. Fixed a bug that caused readline to `forget' part of a key sequence when
reading an unbound multi-character key sequence.
i. Fixed a bug that caused Readline's signal handlers to be installed beyond
the bounds of a single call to readline().
j. Fixed a bug that caused the `.' command to not redo the most recent `R'
command in vi mode.
k. Fixed a bug that caused ignoring case in completion matches to result in
readline using the wrong match.
l. Paren matching now works in vi insert mode.
m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
work together.
n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
in vi editing mode.
o. Fixed a bug that caused the filename comparison code to not compare
multibyte characters correctly when using case-sensitive or case-mapping
comparisons.
p. Fixed the input reading loop to call the input hook function only when there
is no terminal input available.
q. Fixed a bug that caused binding a macro to a multi-character key sequence
where the sequence and macro value share a common prefix to not perform
the macro replacement.
r. Fixed several redisplay errors with multibyte characters and prompts
containing invisible characters when using horizontal scrolling.
3. New Features in Bash
a. The `helptopic' completion action now maps to all the help topics, not just
the shell builtins.
b. The `help' builtin no longer does prefix substring matching, so `help read'
does not match `readonly'.
c. The shell can be compiled to not display a message about processes that
terminate due to SIGTERM.
d. Non-interactive shells now react to the setting of checkwinsize and set
LINES and COLUMNS after a foreground job exits.
e. There is a new shell option, `globasciiranges', which, when set to on,
forces globbing range comparisons to use character ordering as if they
were run in the C locale.
f. There is a new shell option, `direxpand', which makes filename completion
expand variables in directory names in the way bash-4.1 did.
g. In Posix mode, the `command' builtin does not change whether or not a
builtin it shadows is treated as an assignment builtin.
h. The `return' and `exit' builtins accept negative exit status arguments.
i. The word completion code checks whether or not a filename containing a
shell variable expands to a directory name and appends `/' to the word
as appropriate. The same code expands shell variables in command names
when performing command completion.
j. In Posix mode, it is now an error to attempt to define a shell function
with the same name as a Posix special builtin.
k. When compiled for strict Posix conformance, history expansion is disabled
by default.
l. The history expansion character (!) does not cause history expansion when
followed by the closing quote in a double-quoted string.
m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
option to inhibit quoting of the completions.
n. Setting HISTSIZE to a value less than zero causes the history list to be
unlimited (setting it 0 zero disables the history list).
o. Setting HISTFILESIZE to a value less than zero causes the history file size
to be unlimited (setting it to 0 causes the history file to be truncated
to zero size).
p. The `read' builtin now skips NUL bytes in the input.
q. There is a new `bind -X' option to print all key sequences bound to Unix
commands.
r. When in Posix mode, `read' is interruptible by a trapped signal. After
running the trap handler, read returns 128+signal and throws away any
partially-read input.
s. The command completion code skips whitespace and assignment statements
before looking for the command name word to be completed.
t. The build process has a new mechanism for constructing separate help files
that better reflects the current set of compilation options.
u. The -nt and -ot options to test now work with files with nanosecond
timestamp resolution.
v. The shell saves the command history in any shell for which history is
enabled and HISTFILE is set, not just interactive shells.
w. The shell has `nameref' variables and new -n(/+n) options to declare and
unset to use them, and a `test -R' option to test for them.
x. The shell now allows assigning, referencing, and unsetting elements of
indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
count back from the last element of the array.
y. The {x}<word redirection feature now allows words like {array[ind]} and
can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
z. There is a new CHILD_MAX special shell variable; its value controls the
number of exited child statues the shell remembers.
aa. There is a new configuration option (--enable-direxpand-default) that
causes the `direxpand' shell option to be enabled by default.
bb. Bash does not do anything special to ensure that the file descriptor
assigned to X in {x}<foo remains open after the block containing it
completes.
cc. The `wait' builtin has a new `-n' option to wait for the next child to
change status.
dd. The `printf' %(...)T format specifier now uses the current time if no
argument is supplied.
ee. There is a new variable, BASH_COMPAT, that controls the current shell
compatibility level.
4. New Features in Readline
a. Readline is now more responsive to SIGHUP and other fatal signals when
reading input from the terminal or performing word completion but no
longer attempts to run any not-allowable functions from a signal handler
context.
b. There are new bindable commands to search the history for the string of
characters between the beginning of the line and the point
(history-substring-search-forward, history-substring-search-backward)
c. Readline allows quoted strings as the values of variables when setting
them with `set'. As a side effect, trailing spaces and tabs are ignored
when setting a string variable's value.
d. The history library creates a backup of the history file when writing it
and restores the backup on a write error.
e. New application-settable variable: rl_filename_stat_hook: a function called
with a filename before using it in a call to stat(2). Bash uses it to
expand shell variables so things like $HOME/Downloads have a slash
appended.
f. New bindable function `print-last-kbd-macro', prints the most-recently-
defined keyboard macro in a reusable format.
g. New user-settable variable `colored-stats', enables use of colored text
to denote file types when displaying possible completions (colored analog
of visible-stats).
h. New user-settable variable `keyseq-timout', acts as an inter-character
timeout when reading input or incremental search strings.
i. New application-callable function: rl_clear_history. Clears the history list
and frees all readline-associated private data.
j. New user-settable variable, show-mode-in-prompt, adds a characters to the
beginning of the prompt indicating the current editing mode.
k. New application-settable variable: rl_input_available_hook; function to be
called when readline detects there is data available on its input file
descriptor.
l. Readline calls an application-set event hook (rl_event_hook) after it gets
a signal while reading input (read returns -1/EINTR but readline does not
handle the signal immediately) to allow the application to handle or
otherwise note it.
m. If the user-settable variable `history-size' is set to a value less than
0, the history list size is unlimited.
+491
View File
@@ -0,0 +1,491 @@
This document details the changes between this version, bash-4.3-alpha,
and the previous version, bash-4.2-release.
1. Changes to Bash
a. Fixed several bugs concerning incomplete bracket expressions in filename
generation (globbing) patterns.
b. Fixed a bug with single quotes and WORD in ${param op WORD} when running
in Posix mode.
c. Fixed a bug that caused the pattern removal and pattern substitution word
expansions and case statement word expansion to not match the empty string.
d. Fixed a bug that caused the tzset() function to not work after changing
the TZ enviroment variable.
e. Fixed a bug that caused the RHS of an assignment statement to undergo
word splitting when it contained an unquoted $@.
f. Fixed bugs that caused the shell to not react to a SIGINT sent while
waiting for a child process to exit.
g. Bash doesn't try to run things in a signal handler context when it gets a
signal (SIGINT/SIGHUP/etc) while reading input using readline but still
be responsive to terminating signals.
h. Fixed a bug that caused bash to go into an infinite loop if a filename
to be matched contained an invalid multibyte character.
i. Fixed a bug that caused PS4 to end up being truncated if it is longer
than 128 bytes.
j. Fixed a bug that caused brace expansion to not skip over double-quoted
command substitution.
k. System-specific updates for: DJGPP, HP/UX, Mac OS X
l. Fixed a bug in displaying commands that caused redirections to be associated
with the wrong part of the command.
m. Fixed the coproc cleanup to unset the appropriate shell variables when a
coproc terminates.
n. Fixed a bug that caused `fc' to dump core due to incorrect calculation of
the last history entry.
o. Added workarounds for FreeBSD's implementation of faccessat/eaccess and
`test -x'.
p. Fixed a bug that caused the shell to not match patterns containing
control-A.
q. Fixed a bug that could result in doubled error messages when the `printf'
builtin got a write error.
r. Fixed a bug that caused the shell to not correctly expand words containing
multiple consecutive quoted empty strings (""""""aa).
s. Fixed a bug that caused the shell to not correctly parse multi-line
process substitutions containing comments and quoted strings.
t. Fixed a problem with the bash malloc's internal idea of the top of the
memory heap that resulted in incorrect decisions to try to reduce the
break and give memory back to the kernel.
u. There are changes to the expansions peformed on compound array assignments,
in an effort to make foo=( [ind1]=bar [ind2]=baz ) identical to
foo[ind1]=bar foo[ind2]=baz.
v. Bash now reports an error if `read -a name' is used when `name' is an
existing associative array.
w. Fixed a bug that allowed an attempted assignment to a readonly variable
in an arithmetic expression to not return failure.
x. Fixed several bugs that caused completion functions to be invoked even when
the cursor was before the first word in the command.
y. Fixed a bug that caused parsing a command substitution to overwrite the
parsing state associated with the complete input line.
z. Fixed several bugs with the built-in snprintf replacement and field widths
and floating point.
aa. Fixed a bug that caused incorrect offset calculations and input buffer
corruption when reading files longer than 2^31 bytes.
bb. Fixed several bugs where bash performed arithmetic evaluation in contexts
where evaluation is suppressed.
cc. Fixed a bug that caused bash to close FIFOs used for process substitution
too early when a shell function was executing, but protect against using
all file descriptors when the shell functions are invoked inside loops.
dd. Added checks for printable (and non-printable) multibyte characters for
use in error messages.
ee. Fixed a bug that caused ^O (operate-and-get-next) to not work correctly
at the end of the history list.
ff. Fixed a bug that caused command-oriented history to incorrectly combine
here documents into one line.
gg. Fixed a bug that caused importing SHELLOPTS from the environment into a
Posix-mode shell to print an error message and refuse to parse it.
hh. Fixed a bug that caused the shell to delete an extra history entry when
using `history -s'.
ii. Fixed a bug that caused floating-point exceptions and overflow errors
for the / and % arithmetic operators when using INTMAX_MIN and -1.
jj. Fixed a bug that caused parsing errors when reading an arithmetic for
loop inside a command substitution.
kk. Fixed a bug that caused a readonly function to be unset when unset was
called without the -f or -v option.
ll. Fixed several bugs in the code that quotes characters special to regular
expressions when used in a quoted string on the RHS of the =~ operator
to the [[ command.
mm. Fixed a bug that caused redirections to fail because the file descriptor
limit was set to a value less than 10.
nn. Fixed a bug that caused the `read' builtin to execute code in a signal
handler context if read timed out.
oo. Fixed a bug that caused extended globbing patterns to not match files
beginning with `.' correctly when a `.' was explicitly supplied in the
pattern.
pp. Fixed a bug that caused key sequences longer than two characters to not
work when used with `bind -x'.
qq. Fixed a bug that resulted in redefined functions having the wrong source
file names in BASH_SOURCE.
rr. Fixed a bug that caused the read builtin to assign null strings to variables
when using `read -N', which caused core dumps when referenced
ss. Fixed a bug that caused `bash -m script' to not enable job control while
running the script.
tt. Fixed a bug that caused `printf -v var' to dump core when used with the
%b format code.
uu. Fixed a bug that caused the shell to exit with the wrong status if -e was
active and the shell exited on a substitution error.
vv. Fixed a bug that caused the shell to seg fault if an array variable with
the same name as an existing associative array was implicitly created by
an assignment (declare a[n]=b).
ww. Fixed a bug that caused a redirection to misbehave if the number specified
for a file descriptor overflows an intmax_t.
xx. Fixed several bugs with the handling of valid and invalid unicode character
values when used with the \u and \U escape sequences to printf and $'...'.
yy. Fixed a bug that caused tildes to not be escaped in expanded filenames,
making them subject to later expansion.
zz. When using the pattern substitution word expansion, bash now runs the
replacement string through quote removal, since it allows quotes in that
string to act as escape characters. This is not backwards compatible, so
it can be disabled by setting the bash compatibility mode to 4.2.
aaa. Fixed the rest of the cases where the shell runs non-allowed code in a
signal handler context.
bbb. Fixed a bug that caused spurious DEL characters (\177) to appear in
double-quoted expansion where the RHS is evaluated to the empty string.
ccc. Fixed a bug that caused the use of the shell's internal random number
generator for temporary file names to perturb the random number
sequence.
ddd. Fixed several bugs that caused `declare -g' to not set the right global
variables or to misbehave when declaring global indexed arrays.
eee. Fixed a logic bug that caused extended globbing in a multibyte locale to
cause failures when using the pattern substititution word expansions.
fff. Fixed a bug that caused the `lastpipe' option to corrupt the file
descriptor used to read the script.
ggg. Fixed a bug that causes the shell to delete DEL characters in the
expanded value of variables used in the same quoted string as variables
that expand to nothing.
hhh. Fixed a bug that caused the shell to assign the wrong value from an
assignment like (( x=7 )) when `x' was an existing array variable.
iii. Fixed a bug that caused the shell to misbehave when generating sequences
and the boundary values overflow an intmax_t.
jjj. Fixed a bug caused expansion errors if an expansion of "$@" appeared
next to another expansion (e.g.. "${@}${x}").
kkk. Fixed a potential buffer overflow bug when performing /dev/fd expansion.
lll. Fixed a bug that resulted in an extra semicolon being added to compound
assignments when they were added to the history list.
mmm. Fixed a bug that caused mapfile to read one extra line from the input.
nnn. Fixed a bug that caused the mail checking code to use uninitialized
values.
ooo. Fixed a bug that prevented history timestamps from being saved if the
history comment character is unset.
ppp. Fixed a bug that caused the case-modifying expansions to not work with
multibyte characters.
qqq. Fixed a bug that caused the edit-and-execute bindable readline command
to see the wrong data if invoked in the middle of a multi-line quoted
string.
rrr. Fixed a bug that resulted in the shell returning the wrong exit status
for a background command on systems that recycle PIDs very quickly.
sss. Fixed a bug that caused asynchronous group commands to not run any EXIT
trap defined in the body of the command.
ttt. Fixed a bug that caused `eval "... ; return"' to not clean up properly.
uuu. Fixed a bug that caused the shell to dump core if `read' reads an escaped
IFS whitespace character.
vvv. Fixed a bug that caused BASH_COMMAND to be set to an incorrect value when
executing a (...) subshell.
www. Fixed a pointer aliasing bug with the token string in arithmetic
evaluation.
xxx. Fixed a bug with parsing multi-line command substitutions when reading
the `do' keyword followed by whitespace.
yyy. Fixed a bug that caused the shell to seg fault if the time given to the
printf %(...)T format overflowed the value accepted by localtime(3).
zzz. Fixed a problem with displaying help topics in two columns when the
translated text contained multibyte characters.
aaaa. Fixed a bug with the extended globbing pattern matcher where a `*' was
followed by a negated extended glob pattern.
bbbb. Fixed a race condition with short-lived coproc creation and reaping that
caused the child process to be reaped before the various coproc shell
variables were initialized.
cccc. Fixed a bug where turning off `errexit' in command substitution subshells
was not reflected in $SHELLOPTS.
dddd. Partially fixed an inconsistency in how the shell treated shell
functions run from an EXIT trap.
eeee. Fixed a bug in how the shell invalidated FIFOs used for process
substitution when executing a pipeline (once rather than in every child).
ffff. Fixed a bug that occurred when expanding a special variable ($@, $*)
within double quotes and the expansion resulted in an empty string.
gggg. Fixed bugs with executing a SIGCHLD trap handler to make sure that it's
executed once per exited child.
hhhh. Fixed a bug that caused `declare' and `test' to find variables that
had been given attributes but not assigned values. Such variables are
not set.
iiii. Fixed a bug that caused commands in process substitutions to not look in
the local temporary environment when performing word expansions.
jjjj. Fixed several problems with globstar expansions (**/**) returning null
filenames and multiple instances of the same pathname.
kkkk. Fixed an oversight that did not allow the exit status of `coproc' to
be inverted using `!'.
llll. Fixed a bug that caused the -e option to be re-enabled using `set -e'
even when executing in a context where -e is ignored.
mmmm. Fixed a (mostly theoretical) bug with input lines longer than SIZE_MAX.
2. Changes to Readline
a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
commands to work on the entire line.
b. Fixed a bug that caused redisplay problems with prompts longer than 128
characters and history searches.
c. Fixed a bug that caused readline to try and run code to modify its idea
of the screen size in a signal handler context upon receiving a SIGWINCH.
d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
of an individual call top readline().
e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
redisplay to mishandle zero-width combining characters.
f. Fixed a bug that caused readline to `forget' part of a key sequence when
a multiple-key sequence caused it to break out of an incremental search.
g. Fixed bugs that caused readline to execute code in a signal handler
context if interrupted while reading from the file system during completion.
h. Fixed a bug that caused readline to `forget' part of a key sequence when
reading an unbound multi-character key sequence.
i. Fixed a bug that caused Readline's signal handlers to be installed beyond
the bounds of a single call to readline().
j. Fixed a bug that caused the `.' command to not redo the most recent `R'
command in vi mode.
k. Fixed a bug that caused ignoring case in completion matches to result in
readline using the wrong match.
l. Paren matching now works in vi insert mode.
m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
work together.
n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
in vi editing mode.
o. Fixed a bug that caused the filename comparison code to not compare
multibyte characters correctly when using case-sensitive or case-mapping
comparisons.
p. Fixed the input reading loop to call the input hook function only when there
is no terminal input available.
q. Fixed a bug that caused binding a macro to a multi-character key sequence
where the sequence and macro value share a common prefix to not perform
the macro replacement.
r. Fixed several redisplay errors with multibyte characters and prompts
containing invisible characters when using horizontal scrolling.
3. New Features in Bash
a. The `helptopic' completion action now maps to all the help topics, not just
the shell builtins.
b. The `help' builtin no longer does prefix substring matching, so `help read'
does not match `readonly'.
c. The shell can be compiled to not display a message about processes that
terminate due to SIGTERM.
d. Non-interactive shells now react to the setting of checkwinsize and set
LINES and COLUMNS after a foreground job exits.
e. There is a new shell option, `globasciiranges', which, when set to on,
forces globbing range comparisons to use character ordering as if they
were run in the C locale.
f. There is a new shell option, `direxpand', which makes filename completion
expand variables in directory names in the way bash-4.1 did.
g. In Posix mode, the `command' builtin does not change whether or not a
builtin it shadows is treated as an assignment builtin.
h. The `return' and `exit' builtins accept negative exit status arguments.
i. The word completion code checks whether or not a filename containing a
shell variable expands to a directory name and appends `/' to the word
as appropriate. The same code expands shell variables in command names
when performing command completion.
j. In Posix mode, it is now an error to attempt to define a shell function
with the same name as a Posix special builtin.
k. When compiled for strict Posix conformance, history expansion is disabled
by default.
l. The history expansion character (!) does not cause history expansion when
followed by the closing quote in a double-quoted string.
m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
option to inhibit quoting of the completions.
n. Setting HISTSIZE to a value less than zero causes the history list to be
unlimited (setting it 0 zero disables the history list).
o. Setting HISTFILESIZE to a value less than zero causes the history file size
to be unlimited (setting it to 0 causes the history file to be truncated
to zero size).
p. The `read' builtin now skips NUL bytes in the input.
q. There is a new `bind -X' option to print all key sequences bound to Unix
commands.
r. When in Posix mode, `read' is interruptible by a trapped signal. After
running the trap handler, read returns 128+signal and throws away any
partially-read input.
s. The command completion code skips whitespace and assignment statements
before looking for the command name word to be completed.
t. The build process has a new mechanism for constructing separate help files
that better reflects the current set of compilation options.
u. The -nt and -ot options to test now work with files with nanosecond
timestamp resolution.
v. The shell saves the command history in any shell for which history is
enabled and HISTFILE is set, not just interactive shells.
w. The shell has `nameref' variables and new -n(/+n) options to declare and
unset to use them, and a `test -R' option to test for them.
x. The shell now allows assigning, referencing, and unsetting elements of
indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
count back from the last element of the array.
y. The {x}<word redirection feature now allows words like {array[ind]} and
can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
z. There is a new CHILD_MAX special shell variable; its value controls the
number of exited child statues the shell remembers.
aa. There is a new configuration option (--enable-direxpand-default) that
causes the `direxpand' shell option to be enabled by default.
bb. Bash does not do anything special to ensure that the file descriptor
assigned to X in {x}<foo remains open after the block containing it
completes.
cc. The `wait' builtin has a new `-n' option to wait for the next child to
change status.
dd. The `printf' %(...)T format specifier now uses the current time if no
argument is supplied.
4. New Features in Readline
a. Readline is now more responsive to SIGHUP and other fatal signals when
reading input from the terminal or performing word completion but no
longer attempts to run any not-allowable functions from a signal handler
context.
b. There are new bindable commands to search the history for the string of
characters between the beginning of the line and the point
(history-substring-search-forward, history-substring-search-backward)
c. Readline allows quoted strings as the values of variables when setting
them with `set'. As a side effect, trailing spaces and tabs are ignored
when setting a string variable's value.
d. The history library creates a backup of the history file when writing it
and restores the backup on a write error.
e. New application-settable variable: rl_filename_stat_hook: a function called
with a filename before using it in a call to stat(2). Bash uses it to
expand shell variables so things like $HOME/Downloads have a slash
appended.
f. New bindable function `print-last-kbd-macro', prints the most-recently-
defined keyboard macro in a reusable format.
g. New user-settable variable `colored-stats', enables use of colored text
to denote file types when displaying possible completions (colored analog
of visible-stats).
h. New user-settable variable `keyseq-timout', acts as an inter-character
timeout when reading input or incremental search strings.
i. New application-callable function: rl_clear_history. Clears the history list
and frees all readline-associated private data.
j. New user-settable variable, show-mode-in-prompt, adds a characters to the
beginning of the prompt indicating the current editing mode.
k. New application-settable variable: rl_input_available_hook; function to be
called when readline detects there is data available on its input file
descriptor.
l. Readline calls an application-set event hook (rl_event_hook) after it gets
a signal while reading input (read returns -1/EINTR but readline does not
handle the signal immediately) to allow the application to handle or
otherwise note it.
m. If the user-settable variable `history-size' is set to a value less than
0, the history list size is unlimited.
+21 -6
View File
@@ -365,16 +365,27 @@ version and versions 2.0 and above.
history expansion by default, since it results in a non-conforming
environment.
53. Bash-4.3 runs the replacement string in the pattern substitution word
expansion through quote removal. The code already treats quote
characters in the replacement string as special; if it treats them as
special, then quote removal should remove them.
Shell Compatibility Level
=========================
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin (compat31, compat32, compat40, and
compat41 at this writing). There is only one current compatibility level --
each option is mutually exclusive. This list does not mention behavior
that is standard for a particular version (e.g., setting compat32 means that
quoting the rhs of the regexp matching operator quotes special regexp
characters in the word, which is default behavior in bash-3.2 and above).
as a set of options to the shopt builtin (compat31, compat32, compat40,
compat41, and compat42 at this writing). There is only one current
compatibility level -- each option is mutually exclusive. This list does not
mention behavior that is standard for a particular version (e.g., setting
compat32 means that quoting the rhs of the regexp matching operator quotes
special regexp characters in the word, which is default behavior in bash-3.2
and above).
Bash-4.3 introduces a new shell variable: BASH_COMPAT. The value assigned
to this variable (a decimal version number like 4.2, or an integer
corresponding to the compatNN option, like 42) determines the compatibility
level.
compat31 set
- the < and > operators to the [[ command do not consider the current
@@ -400,6 +411,10 @@ compat41 set
- when in posix mode, single quotes in the `word' portion of a
double-quoted parameter expansion define a new quoting context and
are treated specially
compat42 set
- the replacement string in double-quoted pattern substitution is not
run through quote removal, as in previous versions
-------------------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
+417
View File
@@ -0,0 +1,417 @@
Compatibility with previous versions
====================================
This document details the incompatibilities between this version of bash,
bash-4.2, and the previous widely-available versions, bash-2.x (which is
still the `standard' version for a few Linux distributions) and bash-3.x.
These were discovered by users of bash-2.x through 4.x, so this list is not
comprehensive. Some of these incompatibilities occur between the current
version and versions 2.0 and above.
1. Bash uses a new quoting syntax, $"...", to do locale-specific
string translation. Users who have relied on the (undocumented)
behavior of bash-1.14 will have to change their scripts. For
instance, if you are doing something like this to get the value of
a variable whose name is the value of a second variable:
eval var2=$"$var1"
you will have to change to a different syntax.
This capability is directly supported by bash-2.0:
var2=${!var1}
This alternate syntax will work portably between bash-1.14 and bash-2.0:
eval var2=\$${var1}
2. One of the bugs fixed in the YACC grammar tightens up the rules
concerning group commands ( {...} ). The `list' that composes the
body of the group command must be terminated by a newline or
semicolon. That's because the braces are reserved words, and are
recognized as such only when a reserved word is legal. This means
that while bash-1.14 accepted shell function definitions like this:
foo() { : }
bash-2.0 requires this:
foo() { :; }
This is also an issue for commands like this:
mkdir dir || { echo 'could not mkdir' ; exit 1; }
The syntax required by bash-2.0 is also accepted by bash-1.14.
3. The options to `bind' have changed to make them more consistent with
the rest of the bash builtins. If you are using `bind -d' to list
the readline key bindings in a form that can be re-read, use `bind -p'
instead. If you were using `bind -v' to list the key bindings, use
`bind -P' instead.
4. The `long' invocation options must now be prefixed by `--' instead
of `-'. (The old form is still accepted, for the time being.)
5. There was a bug in the version of readline distributed with bash-1.14
that caused it to write badly-formatted key bindings when using
`bind -d'. The only key sequences that were affected are C-\ (which
should appear as \C-\\ in a key binding) and C-" (which should appear
as \C-\"). If these key sequences appear in your inputrc, as, for
example,
"\C-\": self-insert
they will need to be changed to something like the following:
"\C-\\": self-insert
6. A number of people complained about having to use ESC to terminate an
incremental search, and asked for an alternate mechanism. Bash-2.03
uses the value of the settable readline variable `isearch-terminators'
to decide which characters should terminate an incremental search. If
that variable has not been set, ESC and Control-J will terminate a
search.
7. Some variables have been removed: MAIL_WARNING, notify, history_control,
command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
cdable_vars. Most of them are now implemented with the new `shopt'
builtin; others were already implemented by `set'. Here is a list of
correspondences:
MAIL_WARNING shopt mailwarn
notify set -o notify
history_control HISTCONTROL
command_oriented_history shopt cmdhist
glob_dot_filenames shopt dotglob
allow_null_glob_expansion shopt nullglob
nolinks set -o physical
hostname_completion_file HOSTFILE
noclobber set -o noclobber
no_exit_on_failed_exec shopt execfail
cdable_vars shopt cdable_vars
8. `ulimit' now sets both hard and soft limits and reports the soft limit
by default (when neither -H nor -S is specified). This is compatible
with versions of sh and ksh that implement `ulimit'. The bash-1.14
behavior of, for example,
ulimit -c 0
can be obtained with
ulimit -S -c 0
It may be useful to define an alias:
alias ulimit="ulimit -S"
9. Bash-2.01 uses a new quoting syntax, $'...' to do ANSI-C string
translation. Backslash-escaped characters in ... are expanded and
replaced as specified by the ANSI C standard.
10. The sourcing of startup files has changed somewhat. This is explained
more completely in the INVOCATION section of the manual page.
A non-interactive shell not named `sh' and not in posix mode reads
and executes commands from the file named by $BASH_ENV. A
non-interactive shell started by `su' and not in posix mode will read
startup files. No other non-interactive shells read any startup files.
An interactive shell started in posix mode reads and executes commands
from the file named by $ENV.
11. The <> redirection operator was changed to conform to the POSIX.2 spec.
In the absence of any file descriptor specification preceding the `<>',
file descriptor 0 is used. In bash-1.14, this was the behavior only
when in POSIX mode. The bash-1.14 behavior may be obtained with
<>filename 1>&0
12. The `alias' builtin now checks for invalid options and takes a `-p'
option to display output in POSIX mode. If you have old aliases beginning
with `-' or `+', you will have to add the `--' to the alias command
that declares them:
alias -x='chmod a-x' --> alias -- -x='chmod a-x'
13. The behavior of range specificiers within bracket matching expressions
in the pattern matcher (e.g., [A-Z]) depends on the current locale,
specifically the value of the LC_COLLATE environment variable. Setting
this variable to C or POSIX will result in the traditional ASCII behavior
for range comparisons. If the locale is set to something else, e.g.,
en_US (specified by the LANG or LC_ALL variables), collation order is
locale-dependent. For example, the en_US locale sorts the upper and
lower case letters like this:
AaBb...Zz
so a range specification like [A-Z] will match every letter except `z'.
Other locales collate like
aAbBcC...zZ
which means that [A-Z] matches every letter except `a'.
The portable way to specify upper case letters is [:upper:] instead of
A-Z; lower case may be specified as [:lower:] instead of a-z.
Look at the manual pages for setlocale(3), strcoll(3), and, if it is
present, locale(1).
You can find your current locale information by running locale(1):
caleb.ins.cwru.edu(2)$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_ALL=en_US
My advice is to put
export LC_COLLATE=C
into /etc/profile and inspect any shell scripts run from cron for
constructs like [A-Z]. This will prevent things like
rm [A-Z]*
from removing every file in the current directory except those beginning
with `z' and still allow individual users to change the collation order.
Users may put the above command into their own profiles as well, of course.
14. Bash versions up to 1.14.7 included an undocumented `-l' operator to
the `test/[' builtin. It was a unary operator that expanded to the
length of its string argument. This let you do things like
test -l $variable -lt 20
for example.
This was included for backwards compatibility with old versions of the
Bourne shell, which did not provide an easy way to obtain the length of
the value of a shell variable.
This operator is not part of the POSIX standard, because one can (and
should) use ${#variable} to get the length of a variable's value.
Bash-2.x does not support it.
15. Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
HOSTTYPE, MACHTYPE, or OSTYPE variables. If they appear in the initial
environment, the export attribute will be set, but if bash provides a
default value, they will remain local to the current shell.
16. Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
to have special behavior if they appear in the initial environment.
17. Bash no longer removes the export attribute from the SSH_CLIENT or
SSH2_CLIENT variables, and no longer attempts to discover whether or
not it has been invoked by sshd in order to run the startup files.
18. Bash no longer requires that the body of a function be a group command;
any compound command is accepted.
19. As of bash-3.0, the pattern substitution operators no longer perform
quote removal on the pattern before attempting the match. This is the
way the pattern removal functions behave, and is more consistent.
20. After bash-3.0 was released, I reimplemented tilde expansion, incorporating
it into the mainline word expansion code. This fixes the bug that caused
the results of tilde expansion to be re-expanded. There is one
incompatibility: a ${paramOPword} expansion within double quotes will not
perform tilde expansion on WORD. This is consistent with the other
expansions, and what POSIX specifies.
21. A number of variables have the integer attribute by default, so the +=
assignment operator returns expected results: RANDOM, LINENO, MAILCHECK,
HISTCMD, OPTIND.
22. Bash-3.x is much stricter about $LINENO correctly reflecting the line
number in a script; assignments to LINENO have little effect.
23. By default, readline binds the terminal special characters to their
readline equivalents. As of bash-3.1/readline-5.1, this is optional and
controlled by the bind-tty-special-chars readline variable.
24. The \W prompt string expansion abbreviates $HOME as `~'. The previous
behavior is available with ${PWD##/*/}.
25. The arithmetic exponentiation operator is right-associative as of bash-3.1.
26. The rules concerning valid alias names are stricter, as per POSIX.2.
27. The Readline key binding functions now obey the convert-meta setting active
when the binding takes place, as the dispatch code does when characters
are read and processed.
28. The historical behavior of `trap' reverting signal disposition to the
original handling in the absence of a valid first argument is implemented
only if the first argument is a valid signal number.
29. In versions of bash after 3.1, the ${parameter//pattern/replacement}
expansion does not interpret `%' or `#' specially. Those anchors don't
have any real meaning when replacing every match.
30. Beginning with bash-3.1, the combination of posix mode and enabling the
`xpg_echo' option causes echo to ignore all options, not looking for `-n'
31. Beginning with bash-3.2, bash follows the Bourne-shell-style (and POSIX-
style) rules for parsing the contents of old-style backquoted command
substitutions. Previous versions of bash attempted to recursively parse
embedded quoted strings and shell constructs; bash-3.2 uses strict POSIX
rules to find the closing backquote and simply passes the contents of the
command substitution to a subshell for parsing and execution.
32. Beginning with bash-3.2, bash uses access(2) when executing primaries for
the test builtin and the [[ compound command, rather than looking at the
file permission bits obtained with stat(2). This obeys restrictions of
the file system (e.g., read-only or noexec mounts) not available via stat.
33. Bash-3.2 adopts the convention used by other string and pattern matching
operators for the `[[' compound command, and matches any quoted portion
of the right-hand-side argument to the =~ operator as a string rather
than a regular expression.
34. Bash-4.0 allows the behavior in the previous item to be modified using
the notion of a shell `compatibility level'. If the compat31 shopt
option is set, quoting the pattern has no special effect.
35. Bash-3.2 (patched) and Bash-4.0 fix a bug that leaves the shell in an
inconsistent internal state following an assignment error. One of the
changes means that compound commands or { ... } grouping commands are
aborted under some circumstances in which they previously were not.
This is what Posix specifies.
36. Bash-4.0 now allows process substitution constructs to pass unchanged
through brace expansion, so any expansion of the contents will have to be
separately specified, and each process subsitution will have to be
separately entered.
37. Bash-4.0 now allows SIGCHLD to interrupt the wait builtin, as Posix
specifies, so the SIGCHLD trap is no longer always invoked once per
exiting child if you are using `wait' to wait for all children. As
of bash-4.2, this is the status quo only when in posix mode.
38. Since bash-4.0 now follows Posix rules for finding the closing delimiter
of a $() command substitution, it will not behave as previous versions
did, but will catch more syntax and parsing errors before spawning a
subshell to evaluate the command substitution.
39. The programmable completion code uses the same set of delimiting characters
as readline when breaking the command line into words, rather than the
set of shell metacharacters, so programmable completion and readline
should be more consistent.
40. When the read builtin times out, it attempts to assign any input read to
specified variables, which also causes variables to be set to the empty
string if there is not enough input. Previous versions discarded the
characters read.
41. Beginning with bash-4.0, when one of the commands in a pipeline is killed
by a SIGINT while executing a command list, the shell acts as if it
received the interrupt. This can be disabled by setting the compat31 or
compat32 shell options.
42. Bash-4.0 changes the handling of the set -e option so that the shell exits
if a pipeline fails (and not just if the last command in the failing
pipeline is a simple command). This is not as Posix specifies. There is
work underway to update this portion of the standard; the bash-4.0
behavior attempts to capture the consensus at the time of release.
43. Bash-4.0 fixes a Posix mode bug that caused the . (source) builtin to
search the current directory for its filename argument, even if "." is
not in $PATH. Posix says that the shell shouldn't look in $PWD in this
case.
44. Bash-4.1 uses the current locale when comparing strings using the < and
> operators to the `[[' command. This can be reverted to the previous
behavior (ASCII collating and strcmp(3)) by setting one of the
`compatNN' shopt options, where NN is less than 41.
45. Bash-4.1 conforms to the current Posix specification for `set -u':
expansions of $@ and $* when there are no positional parameters do not
cause the shell to exit.
46. Bash-4.1 implements the current Posix specification for `set -e' and
exits when any command fails, not just a simple command or pipeline.
47. Command substitutions now remove the caller's trap strings when trap is
run to set a new trap in the subshell. Previous to bash-4.2, the old
trap strings persisted even though the actual signal handlers were reset.
48. When in Posix mode, a single quote is not treated specially in a
double-quoted ${...} expansion, unless the expansion operator is
# or % or the new `//', `^', or `,' expansions. In particular, it
does not define a new quoting context. This is from Posix interpretation
221.
49. Posix mode shells no longer exit if a variable assignment error occurs
with an assignment preceding a command that is not a special builtin.
50. Bash-4.2 attempts to preserve what the user typed when performing word
completion, instead of, for instance, expanding shell variable
references to their value.
51. When in Posix mode, bash-4.2 exits if the filename supplied as an argument
to `.' is not found and the shell is not interactive.
52. When compiled for strict Posix compatibility, bash-4.3 does not enable
history expansion by default, since it results in a non-conforming
environment.
53. Bash-4.3 runs the replacement string in the pattern substitution word
expansion through quote removal. The code already treats quote
characters in the replacement string as special; if it treats them as
special, then quote removal should remove them.
Shell Compatibility Level
=========================
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin (compat31, compat32, compat40, and
compat41 at this writing). There is only one current compatibility level --
each option is mutually exclusive. This list does not mention behavior
that is standard for a particular version (e.g., setting compat32 means that
quoting the rhs of the regexp matching operator quotes special regexp
characters in the word, which is default behavior in bash-3.2 and above).
compat31 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering
- quoting the rhs of the regexp matching operator (=~) has no
special effect
compat32 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering
compat40 set
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering
- interrupting a command list such as "a ; b ; c" causes the execution
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)
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,
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
are treated specially
compat42 set
- the replacement string in double-quoted pattern substitution is not
run through quote removal, as in previous versions
-------------------------------------------------------------------------------
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
+58 -3
View File
@@ -857,8 +857,9 @@ lib/glob/smatch.c
- rangecmp,rangecmp_wc: change to take an additional argument, which
forces the use of strcoll/wscoll when non-zero. If it's 0, a new
variable `glob_asciirange' controls whether or not we use strcoll/
wscoll. If it's non-zero, we use straight C-locale-like ordering.
Suggested by Aharon Robbins <arnold@skeeve.com>
wscoll. If glob_asciirange is non-zero, we use straight
C-locale-like ordering. Suggested by Aharon Robbins
<arnold@skeeve.com>
6/30
----
@@ -3604,7 +3605,7 @@ builtins/help.def
for each builtin in two columns into a new function: dispcolumn
- wdispcolumn: multibyte-char version of dispcolumn; uses wide
chars and printf "%ls" format. Fixes problem reported by
Nguyá»n Thái Ngá»c Duy <pclouds@gmail.c
Nguyá»n Thái Ngá»c Duy <pclouds@gmail.com>
9/22
----
@@ -4122,6 +4123,7 @@ execute_cmd.c
setjmp_nosigs: call instead of setjmp where appropriate when saving
top_level; don't need to manipulate signal mask if we're going to
exit right away
subst.c
- command_substitute: setjmp_nosigs: call instead of setjmp when saving
return_catch; don't need to manipulate signal mask
@@ -4206,3 +4208,56 @@ subst.c
it (W_ASSNGLOBAL). Fixes inconsistency noticed by Vicente Couce
Diaz <vituko@gmail.com>, where declare -ag foo=(bar) could modify
array variable foo at previous function scope, not global scope
12/27
-----
bashline.c
- Minix needs the third argument to tputs to be a void funtion taking
an int argument, not an int-returning function. Fix from
John E. Malmberg <wb8tyw@qsl.net> as part of VMS bash port
12/29
-----
configure.ac,version.c,patchlevel.h
- bash-4.3-devel: new version, new shell compatibility level (43)
subst.c
- parameter_brace_patsub: put the bash-4.2 code back in from the
change of 3/3 that runs the replacement string through quote
removal, make it dependent on shell_compatibility_level <= 42
builtins/shopt.def
- compat42: new shopt option
- set_compatibility_level: change logic to set and unset various
compat variables and shell_compatibility_level
COMPAT
- new documentation for bash-4.3 compatibility changes
doc/{bash.1,bashref.texi}
- compat42: document new shopt option
builtins/shopt.def
- set_compatibility_opts: new function, sets the various shopt
compat variables based on the value of shell_compatibility_level
builtins/common.h
- set_compatibility_opts: new extern declaration
variables.c
- BASH_COMPAT: new special variable; sets the shell compatibility
level. Accepts values in decimal (4.2) or integer (42) form;
Unsetting variable, setting it to empty string, or setting it to
out-of-range value sets the shell's compatibility level to the
default for the current version. Valid values are 3.1/31 through
the current version
- sv_shcompat: new function implementing logic for BASH_COMPAT
variables.h
- sv_shcompat: new extern declaration
doc/{bash.1,bashref.texi}
- BASH_COMPAT: description of new variable
lib/readline/complete.c
- _rl_colored_stats: default back to 0 for 4.3 release branch
+61 -5
View File
@@ -857,8 +857,9 @@ lib/glob/smatch.c
- rangecmp,rangecmp_wc: change to take an additional argument, which
forces the use of strcoll/wscoll when non-zero. If it's 0, a new
variable `glob_asciirange' controls whether or not we use strcoll/
wscoll. If it's non-zero, we use straight C-locale-like ordering.
Suggested by Aharon Robbins <arnold@skeeve.com>
wscoll. If glob_asciirange is non-zero, we use straight
C-locale-like ordering. Suggested by Aharon Robbins
<arnold@skeeve.com>
6/30
----
@@ -3604,7 +3605,7 @@ builtins/help.def
for each builtin in two columns into a new function: dispcolumn
- wdispcolumn: multibyte-char version of dispcolumn; uses wide
chars and printf "%ls" format. Fixes problem reported by
Nguyá»n Thái Ngá»c Duy <pclouds@gmail.c
Nguyá»n Thái Ngá»c Duy <pclouds@gmail.com>
9/22
----
@@ -4186,7 +4187,8 @@ builtins/declare.def
- declare_internal: if -g given with name=value, but variable is not
found in the global variable table, make sure to call
bind_global_variable so the variable is created and modified at
global scope
global scope. Fixes a bug where declare -g x=y could modify `x'
at a previous function scope
command.h
- W_ASSIGNARRAY: new word flag, compound indexed array assignment
@@ -4203,4 +4205,58 @@ subst.c
- shell_expand_word_list: call make_internal_declare if -a option
given to declaration builtin (W_ASSIGNARRAY); handle -g option with
it (W_ASSNGLOBAL). Fixes inconsistency noticed by Vicente Couce
Diaz <vituko@gmail.com>
Diaz <vituko@gmail.com>, where declare -ag foo=(bar) could modify
array variable foo at previous function scope, not global scope
12/27
-----
bashline.c
- Minix needs the third argument to tputs to be a void funtion taking
an int argument, not an int-returning function. Fix from
John E. Malmberg <wb8tyw@qsl.net> as part of VMS bash port
12/29
-----
configure.ac,version.c,patchlevel.h
- bash-4.3-devel: new version, new shell compatibility level (43)
subst.c
- parameter_brace_patsub: put the bash-4.2 code back in from the
change of 3/3 that runs the replacement string through quote
removal, make it dependent on shell_compatibility_level <= 42
builtins/shopt.def
- compat42: new shopt option
- set_compatibility_level: change logic to set and unset various
compat variables and shell_compatibility_level
COMPAT
- new documentation for bash-4.3 compatibility changes
doc/{bash.1,bashref.texi}
- compat42: document new shopt option
builtins/shopt.def
- set_compatibility_opts: new function, sets the various shopt
compat variables based on the value of shell_compatibility_level
builtins/common.h
- set_compatibility_opts: new extern declaration
variables.c
- BASH_COMPAT: new special variable; sets the shell compatibility
level. Accepts values in decimal (4.2) or integer (42) form;
Unsetting variable, setting it to empty string, or setting it to
out-of-range value sets the shell's compatibility level to the
default for the current version. Valid values are 3.1/31 through
the current version
- sv_shcompat: new function implementing logic for BASH_COMPAT
variables.h
- sv_shcompat: new extern declaration
doc/{bash.1,bashref.texi}
- BASH_COMPAT: description of new variable
lib/readline/complete.c
- _rl_colored_stats: default back to 0 for 4.3 release branch
+4 -1
View File
@@ -563,7 +563,6 @@ CWRU/PLATFORMS f
CWRU/README f
CWRU/changelog f
CWRU/sh-redir-hack f
CWRU/mh-folder-comp f
doc/FAQ f
doc/Makefile.in f
doc/bash.1 f
@@ -1135,6 +1134,8 @@ tests/run-vredir f
tests/set-e.tests f
tests/set-e1.sub f
tests/set-e2.sub f
tests/set-e3.sub f
tests/set-e3a.sub f
tests/set-e.right f
tests/set-x.tests f
tests/set-x1.sub f
@@ -1167,6 +1168,8 @@ tests/varenv.right f
tests/varenv.sh f
tests/varenv1.sub f
tests/varenv2.sub f
tests/varenv3.sub f
tests/varenv4.sub f
tests/version f
tests/version.mini f
tests/vredir.tests f
+154
View File
@@ -0,0 +1,154 @@
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
the place to look for complete descriptions.
1. New Features in Bash
a. The `helptopic' completion action now maps to all the help topics, not just
the shell builtins.
b. The `help' builtin no longer does prefix substring matching, so `help read'
does not match `readonly'.
c. The shell can be compiled to not display a message about processes that
terminate due to SIGTERM.
d. Non-interactive shells now react to the setting of checkwinsize and set
LINES and COLUMNS after a foreground job exits.
e. There is a new shell option, `globasciiranges', which, when set to on,
forces globbing range comparisons to use character ordering as if they
were run in the C locale.
f. There is a new shell option, `direxpand', which makes filename completion
expand variables in directory names in the way bash-4.1 did.
g. In Posix mode, the `command' builtin does not change whether or not a
builtin it shadows is treated as an assignment builtin.
h. The `return' and `exit' builtins accept negative exit status arguments.
i. The word completion code checks whether or not a filename containing a
shell variable expands to a directory name and appends `/' to the word
as appropriate. The same code expands shell variables in command names
when performing command completion.
j. In Posix mode, it is now an error to attempt to define a shell function
with the same name as a Posix special builtin.
k. When compiled for strict Posix conformance, history expansion is disabled
by default.
l. The history expansion character (!) does not cause history expansion when
followed by the closing quote in a double-quoted string.
m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
option to inhibit quoting of the completions.
n. Setting HISTSIZE to a value less than zero causes the history list to be
unlimited (setting it 0 zero disables the history list).
o. Setting HISTFILESIZE to a value less than zero causes the history file size
to be unlimited (setting it to 0 causes the history file to be truncated
to zero size).
p. The `read' builtin now skips NUL bytes in the input.
q. There is a new `bind -X' option to print all key sequences bound to Unix
commands.
r. When in Posix mode, `read' is interruptible by a trapped signal. After
running the trap handler, read returns 128+signal and throws away any
partially-read input.
s. The command completion code skips whitespace and assignment statements
before looking for the command name word to be completed.
t. The build process has a new mechanism for constructing separate help files
that better reflects the current set of compilation options.
u. The -nt and -ot options to test now work with files with nanosecond
timestamp resolution.
v. The shell saves the command history in any shell for which history is
enabled and HISTFILE is set, not just interactive shells.
w. The shell has `nameref' variables and new -n(/+n) options to declare and
unset to use them, and a `test -R' option to test for them.
x. The shell now allows assigning, referencing, and unsetting elements of
indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
count back from the last element of the array.
y. The {x}<word redirection feature now allows words like {array[ind]} and
can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
z. There is a new CHILD_MAX special shell variable; its value controls the
number of exited child statues the shell remembers.
aa. There is a new configuration option (--enable-direxpand-default) that
causes the `direxpand' shell option to be enabled by default.
bb. Bash does not do anything special to ensure that the file descriptor
assigned to X in {x}<foo remains open after the block containing it
completes.
cc. The `wait' builtin has a new `-n' option to wait for the next child to
change status.
dd. The `printf' %(...)T format specifier now uses the current time if no
argument is supplied.
ee. There is a new variable, BASH_COMPAT, that controls the current shell
compatibility level.
2. New Features in Readline
a. Readline is now more responsive to SIGHUP and other fatal signals when
reading input from the terminal or performing word completion but no
longer attempts to run any not-allowable functions from a signal handler
context.
b. There are new bindable commands to search the history for the string of
characters between the beginning of the line and the point
(history-substring-search-forward, history-substring-search-backward)
c. Readline allows quoted strings as the values of variables when setting
them with `set'. As a side effect, trailing spaces and tabs are ignored
when setting a string variable's value.
d. The history library creates a backup of the history file when writing it
and restores the backup on a write error.
e. New application-settable variable: rl_filename_stat_hook: a function called
with a filename before using it in a call to stat(2). Bash uses it to
expand shell variables so things like $HOME/Downloads have a slash
appended.
f. New bindable function `print-last-kbd-macro', prints the most-recently-
defined keyboard macro in a reusable format.
g. New user-settable variable `colored-stats', enables use of colored text
to denote file types when displaying possible completions (colored analog
of visible-stats).
h. New user-settable variable `keyseq-timout', acts as an inter-character
timeout when reading input or incremental search strings.
i. New application-callable function: rl_clear_history. Clears the history list
and frees all readline-associated private data.
j. New user-settable variable, show-mode-in-prompt, adds a characters to the
beginning of the prompt indicating the current editing mode.
k. New application-settable variable: rl_input_available_hook; function to be
called when readline detects there is data available on its input file
descriptor.
l. Readline calls an application-set event hook (rl_event_hook) after it gets
a signal while reading input (read returns -1/EINTR but readline does not
handle the signal immediately) to allow the application to handle or
otherwise note it.
m. If the user-settable variable `history-size' is set to a value less than
0, the history list size is unlimited.
+494
View File
@@ -0,0 +1,494 @@
This document details the changes between this version, bash-4.3-alpha,
and the previous version, bash-4.2-release.
1. Changes to Bash
a. Fixed several bugs concerning incomplete bracket expressions in filename
generation (globbing) patterns.
b. Fixed a bug with single quotes and WORD in ${param op WORD} when running
in Posix mode.
c. Fixed a bug that caused the pattern removal and pattern substitution word
expansions and case statement word expansion to not match the empty string.
d. Fixed a bug that caused the tzset() function to not work after changing
the TZ enviroment variable.
e. Fixed a bug that caused the RHS of an assignment statement to undergo
word splitting when it contained an unquoted $@.
f. Fixed bugs that caused the shell to not react to a SIGINT sent while
waiting for a child process to exit.
g. Bash doesn't try to run things in a signal handler context when it gets a
signal (SIGINT/SIGHUP/etc) while reading input using readline but still
be responsive to terminating signals.
h. Fixed a bug that caused bash to go into an infinite loop if a filename
to be matched contained an invalid multibyte character.
i. Fixed a bug that caused PS4 to end up being truncated if it is longer
than 128 bytes.
j. Fixed a bug that caused brace expansion to not skip over double-quoted
command substitution.
k. System-specific updates for: DJGPP, HP/UX, Mac OS X
l. Fixed a bug in displaying commands that caused redirections to be associated
with the wrong part of the command.
m. Fixed the coproc cleanup to unset the appropriate shell variables when a
coproc terminates.
n. Fixed a bug that caused `fc' to dump core due to incorrect calculation of
the last history entry.
o. Added workarounds for FreeBSD's implementation of faccessat/eaccess and
`test -x'.
p. Fixed a bug that caused the shell to not match patterns containing
control-A.
q. Fixed a bug that could result in doubled error messages when the `printf'
builtin got a write error.
r. Fixed a bug that caused the shell to not correctly expand words containing
multiple consecutive quoted empty strings (""""""aa).
s. Fixed a bug that caused the shell to not correctly parse multi-line
process substitutions containing comments and quoted strings.
t. Fixed a problem with the bash malloc's internal idea of the top of the
memory heap that resulted in incorrect decisions to try to reduce the
break and give memory back to the kernel.
u. There are changes to the expansions peformed on compound array assignments,
in an effort to make foo=( [ind1]=bar [ind2]=baz ) identical to
foo[ind1]=bar foo[ind2]=baz.
v. Bash now reports an error if `read -a name' is used when `name' is an
existing associative array.
w. Fixed a bug that allowed an attempted assignment to a readonly variable
in an arithmetic expression to not return failure.
x. Fixed several bugs that caused completion functions to be invoked even when
the cursor was before the first word in the command.
y. Fixed a bug that caused parsing a command substitution to overwrite the
parsing state associated with the complete input line.
z. Fixed several bugs with the built-in snprintf replacement and field widths
and floating point.
aa. Fixed a bug that caused incorrect offset calculations and input buffer
corruption when reading files longer than 2^31 bytes.
bb. Fixed several bugs where bash performed arithmetic evaluation in contexts
where evaluation is suppressed.
cc. Fixed a bug that caused bash to close FIFOs used for process substitution
too early when a shell function was executing, but protect against using
all file descriptors when the shell functions are invoked inside loops.
dd. Added checks for printable (and non-printable) multibyte characters for
use in error messages.
ee. Fixed a bug that caused ^O (operate-and-get-next) to not work correctly
at the end of the history list.
ff. Fixed a bug that caused command-oriented history to incorrectly combine
here documents into one line.
gg. Fixed a bug that caused importing SHELLOPTS from the environment into a
Posix-mode shell to print an error message and refuse to parse it.
hh. Fixed a bug that caused the shell to delete an extra history entry when
using `history -s'.
ii. Fixed a bug that caused floating-point exceptions and overflow errors
for the / and % arithmetic operators when using INTMAX_MIN and -1.
jj. Fixed a bug that caused parsing errors when reading an arithmetic for
loop inside a command substitution.
kk. Fixed a bug that caused a readonly function to be unset when unset was
called without the -f or -v option.
ll. Fixed several bugs in the code that quotes characters special to regular
expressions when used in a quoted string on the RHS of the =~ operator
to the [[ command.
mm. Fixed a bug that caused redirections to fail because the file descriptor
limit was set to a value less than 10.
nn. Fixed a bug that caused the `read' builtin to execute code in a signal
handler context if read timed out.
oo. Fixed a bug that caused extended globbing patterns to not match files
beginning with `.' correctly when a `.' was explicitly supplied in the
pattern.
pp. Fixed a bug that caused key sequences longer than two characters to not
work when used with `bind -x'.
qq. Fixed a bug that resulted in redefined functions having the wrong source
file names in BASH_SOURCE.
rr. Fixed a bug that caused the read builtin to assign null strings to variables
when using `read -N', which caused core dumps when referenced
ss. Fixed a bug that caused `bash -m script' to not enable job control while
running the script.
tt. Fixed a bug that caused `printf -v var' to dump core when used with the
%b format code.
uu. Fixed a bug that caused the shell to exit with the wrong status if -e was
active and the shell exited on a substitution error.
vv. Fixed a bug that caused the shell to seg fault if an array variable with
the same name as an existing associative array was implicitly created by
an assignment (declare a[n]=b).
ww. Fixed a bug that caused a redirection to misbehave if the number specified
for a file descriptor overflows an intmax_t.
xx. Fixed several bugs with the handling of valid and invalid unicode character
values when used with the \u and \U escape sequences to printf and $'...'.
yy. Fixed a bug that caused tildes to not be escaped in expanded filenames,
making them subject to later expansion.
zz. When using the pattern substitution word expansion, bash now runs the
replacement string through quote removal, since it allows quotes in that
string to act as escape characters. This is not backwards compatible, so
it can be disabled by setting the bash compatibility mode to 4.2.
aaa. Fixed the rest of the cases where the shell runs non-allowed code in a
signal handler context.
bbb. Fixed a bug that caused spurious DEL characters (\177) to appear in
double-quoted expansion where the RHS is evaluated to the empty string.
ccc. Fixed a bug that caused the use of the shell's internal random number
generator for temporary file names to perturb the random number
sequence.
ddd. Fixed several bugs that caused `declare -g' to not set the right global
variables or to misbehave when declaring global indexed arrays.
eee. Fixed a logic bug that caused extended globbing in a multibyte locale to
cause failures when using the pattern substititution word expansions.
fff. Fixed a bug that caused the `lastpipe' option to corrupt the file
descriptor used to read the script.
ggg. Fixed a bug that causes the shell to delete DEL characters in the
expanded value of variables used in the same quoted string as variables
that expand to nothing.
hhh. Fixed a bug that caused the shell to assign the wrong value from an
assignment like (( x=7 )) when `x' was an existing array variable.
iii. Fixed a bug that caused the shell to misbehave when generating sequences
and the boundary values overflow an intmax_t.
jjj. Fixed a bug caused expansion errors if an expansion of "$@" appeared
next to another expansion (e.g.. "${@}${x}").
kkk. Fixed a potential buffer overflow bug when performing /dev/fd expansion.
lll. Fixed a bug that resulted in an extra semicolon being added to compound
assignments when they were added to the history list.
mmm. Fixed a bug that caused mapfile to read one extra line from the input.
nnn. Fixed a bug that caused the mail checking code to use uninitialized
values.
ooo. Fixed a bug that prevented history timestamps from being saved if the
history comment character is unset.
ppp. Fixed a bug that caused the case-modifying expansions to not work with
multibyte characters.
qqq. Fixed a bug that caused the edit-and-execute bindable readline command
to see the wrong data if invoked in the middle of a multi-line quoted
string.
rrr. Fixed a bug that resulted in the shell returning the wrong exit status
for a background command on systems that recycle PIDs very quickly.
sss. Fixed a bug that caused asynchronous group commands to not run any EXIT
trap defined in the body of the command.
ttt. Fixed a bug that caused `eval "... ; return"' to not clean up properly.
uuu. Fixed a bug that caused the shell to dump core if `read' reads an escaped
IFS whitespace character.
vvv. Fixed a bug that caused BASH_COMMAND to be set to an incorrect value when
executing a (...) subshell.
www. Fixed a pointer aliasing bug with the token string in arithmetic
evaluation.
xxx. Fixed a bug with parsing multi-line command substitutions when reading
the `do' keyword followed by whitespace.
yyy. Fixed a bug that caused the shell to seg fault if the time given to the
printf %(...)T format overflowed the value accepted by localtime(3).
zzz. Fixed a problem with displaying help topics in two columns when the
translated text contained multibyte characters.
aaaa. Fixed a bug with the extended globbing pattern matcher where a `*' was
followed by a negated extended glob pattern.
bbbb. Fixed a race condition with short-lived coproc creation and reaping that
caused the child process to be reaped before the various coproc shell
variables were initialized.
cccc. Fixed a bug where turning off `errexit' in command substitution subshells
was not reflected in $SHELLOPTS.
dddd. Partially fixed an inconsistency in how the shell treated shell
functions run from an EXIT trap.
eeee. Fixed a bug in how the shell invalidated FIFOs used for process
substitution when executing a pipeline (once rather than in every child).
ffff. Fixed a bug that occurred when expanding a special variable ($@, $*)
within double quotes and the expansion resulted in an empty string.
gggg. Fixed bugs with executing a SIGCHLD trap handler to make sure that it's
executed once per exited child.
hhhh. Fixed a bug that caused `declare' and `test' to find variables that
had been given attributes but not assigned values. Such variables are
not set.
iiii. Fixed a bug that caused commands in process substitutions to not look in
the local temporary environment when performing word expansions.
jjjj. Fixed several problems with globstar expansions (**/**) returning null
filenames and multiple instances of the same pathname.
kkkk. Fixed an oversight that did not allow the exit status of `coproc' to
be inverted using `!'.
llll. Fixed a bug that caused the -e option to be re-enabled using `set -e'
even when executing in a context where -e is ignored.
mmmm. Fixed a (mostly theoretical) bug with input lines longer than SIZE_MAX.
2. Changes to Readline
a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
commands to work on the entire line.
b. Fixed a bug that caused redisplay problems with prompts longer than 128
characters and history searches.
c. Fixed a bug that caused readline to try and run code to modify its idea
of the screen size in a signal handler context upon receiving a SIGWINCH.
d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
of an individual call top readline().
e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
redisplay to mishandle zero-width combining characters.
f. Fixed a bug that caused readline to `forget' part of a key sequence when
a multiple-key sequence caused it to break out of an incremental search.
g. Fixed bugs that caused readline to execute code in a signal handler
context if interrupted while reading from the file system during completion.
h. Fixed a bug that caused readline to `forget' part of a key sequence when
reading an unbound multi-character key sequence.
i. Fixed a bug that caused Readline's signal handlers to be installed beyond
the bounds of a single call to readline().
j. Fixed a bug that caused the `.' command to not redo the most recent `R'
command in vi mode.
k. Fixed a bug that caused ignoring case in completion matches to result in
readline using the wrong match.
l. Paren matching now works in vi insert mode.
m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
work together.
n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
in vi editing mode.
o. Fixed a bug that caused the filename comparison code to not compare
multibyte characters correctly when using case-sensitive or case-mapping
comparisons.
p. Fixed the input reading loop to call the input hook function only when there
is no terminal input available.
q. Fixed a bug that caused binding a macro to a multi-character key sequence
where the sequence and macro value share a common prefix to not perform
the macro replacement.
r. Fixed several redisplay errors with multibyte characters and prompts
containing invisible characters when using horizontal scrolling.
3. New Features in Bash
a. The `helptopic' completion action now maps to all the help topics, not just
the shell builtins.
b. The `help' builtin no longer does prefix substring matching, so `help read'
does not match `readonly'.
c. The shell can be compiled to not display a message about processes that
terminate due to SIGTERM.
d. Non-interactive shells now react to the setting of checkwinsize and set
LINES and COLUMNS after a foreground job exits.
e. There is a new shell option, `globasciiranges', which, when set to on,
forces globbing range comparisons to use character ordering as if they
were run in the C locale.
f. There is a new shell option, `direxpand', which makes filename completion
expand variables in directory names in the way bash-4.1 did.
g. In Posix mode, the `command' builtin does not change whether or not a
builtin it shadows is treated as an assignment builtin.
h. The `return' and `exit' builtins accept negative exit status arguments.
i. The word completion code checks whether or not a filename containing a
shell variable expands to a directory name and appends `/' to the word
as appropriate. The same code expands shell variables in command names
when performing command completion.
j. In Posix mode, it is now an error to attempt to define a shell function
with the same name as a Posix special builtin.
k. When compiled for strict Posix conformance, history expansion is disabled
by default.
l. The history expansion character (!) does not cause history expansion when
followed by the closing quote in a double-quoted string.
m. `complete' and its siblings compgen/compopt now takes a new `-o noquote'
option to inhibit quoting of the completions.
n. Setting HISTSIZE to a value less than zero causes the history list to be
unlimited (setting it 0 zero disables the history list).
o. Setting HISTFILESIZE to a value less than zero causes the history file size
to be unlimited (setting it to 0 causes the history file to be truncated
to zero size).
p. The `read' builtin now skips NUL bytes in the input.
q. There is a new `bind -X' option to print all key sequences bound to Unix
commands.
r. When in Posix mode, `read' is interruptible by a trapped signal. After
running the trap handler, read returns 128+signal and throws away any
partially-read input.
s. The command completion code skips whitespace and assignment statements
before looking for the command name word to be completed.
t. The build process has a new mechanism for constructing separate help files
that better reflects the current set of compilation options.
u. The -nt and -ot options to test now work with files with nanosecond
timestamp resolution.
v. The shell saves the command history in any shell for which history is
enabled and HISTFILE is set, not just interactive shells.
w. The shell has `nameref' variables and new -n(/+n) options to declare and
unset to use them, and a `test -R' option to test for them.
x. The shell now allows assigning, referencing, and unsetting elements of
indexed arrays using negative subscripts (a[-1]=2, echo ${a[-1]}) which
count back from the last element of the array.
y. The {x}<word redirection feature now allows words like {array[ind]} and
can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
z. There is a new CHILD_MAX special shell variable; its value controls the
number of exited child statues the shell remembers.
aa. There is a new configuration option (--enable-direxpand-default) that
causes the `direxpand' shell option to be enabled by default.
bb. Bash does not do anything special to ensure that the file descriptor
assigned to X in {x}<foo remains open after the block containing it
completes.
cc. The `wait' builtin has a new `-n' option to wait for the next child to
change status.
dd. The `printf' %(...)T format specifier now uses the current time if no
argument is supplied.
ee. There is a new variable, BASH_COMPAT, that controls the current shell
compatibility level.
4. New Features in Readline
a. Readline is now more responsive to SIGHUP and other fatal signals when
reading input from the terminal or performing word completion but no
longer attempts to run any not-allowable functions from a signal handler
context.
b. There are new bindable commands to search the history for the string of
characters between the beginning of the line and the point
(history-substring-search-forward, history-substring-search-backward)
c. Readline allows quoted strings as the values of variables when setting
them with `set'. As a side effect, trailing spaces and tabs are ignored
when setting a string variable's value.
d. The history library creates a backup of the history file when writing it
and restores the backup on a write error.
e. New application-settable variable: rl_filename_stat_hook: a function called
with a filename before using it in a call to stat(2). Bash uses it to
expand shell variables so things like $HOME/Downloads have a slash
appended.
f. New bindable function `print-last-kbd-macro', prints the most-recently-
defined keyboard macro in a reusable format.
g. New user-settable variable `colored-stats', enables use of colored text
to denote file types when displaying possible completions (colored analog
of visible-stats).
h. New user-settable variable `keyseq-timout', acts as an inter-character
timeout when reading input or incremental search strings.
i. New application-callable function: rl_clear_history. Clears the history list
and frees all readline-associated private data.
j. New user-settable variable, show-mode-in-prompt, adds a characters to the
beginning of the prompt indicating the current editing mode.
k. New application-settable variable: rl_input_available_hook; function to be
called when readline detects there is data available on its input file
descriptor.
l. Readline calls an application-set event hook (rl_event_hook) after it gets
a signal while reading input (read returns -1/EINTR but readline does not
handle the signal immediately) to allow the application to handle or
otherwise note it.
m. If the user-settable variable `history-size' is set to a value less than
0, the history list size is unlimited.
+3 -3
View File
@@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 4.2. Bash is the GNU Project's Bourne
This is GNU Bash, version 4.3. Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX shell spec,
but also with interactive command line editing, job control on
architectures that support it, csh-like features such as history
@@ -15,8 +15,8 @@ See the file POSIX for a discussion of how the Bash defaults differ
from the POSIX spec and a description of the Bash `posix mode'.
There are some user-visible incompatibilities between this version
of Bash and previous widely-distributed versions, bash-4.0 and
bash-4.1. For details, see the file COMPAT. The NEWS file tersely
of Bash and previous widely-distributed versions, bash-4.1 and
bash-4.2. For details, see the file COMPAT. The NEWS file tersely
lists features that are new in this release.
Bash is free software, distributed under the terms of the [GNU] General
+96
View File
@@ -0,0 +1,96 @@
Introduction
============
This is GNU Bash, version 4.2. Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX shell spec,
but also with interactive command line editing, job control on
architectures that support it, csh-like features such as history
substitution and brace expansion, and a slew of other features.
For more information on the features of Bash that are new to this
type of shell, see the file `doc/bashref.texi'. There is also a
large Unix-style man page. The man page is the definitive description
of the shell's features.
See the file POSIX for a discussion of how the Bash defaults differ
from the POSIX spec and a description of the Bash `posix mode'.
There are some user-visible incompatibilities between this version
of Bash and previous widely-distributed versions, bash-4.0 and
bash-4.1. For details, see the file COMPAT. The NEWS file tersely
lists features that are new in this release.
Bash is free software, distributed under the terms of the [GNU] General
Public License as published by the Free Software Foundation,
version 3 of the License (or any later version). For more information,
see the file COPYING.
A number of frequently-asked questions are answered in the file
`doc/FAQ'.
To compile Bash, type `./configure', then `make'. Bash auto-configures
the build process, so no further intervention should be necessary. Bash
builds with `gcc' by default if it is available. If you want to use `cc'
instead, type
CC=cc ./configure
if you are using a Bourne-style shell. If you are not, the following
may work:
env CC=cc ./configure
Read the file INSTALL in this directory for more information about how
to customize and control the build process. The file NOTES contains
platform-specific installation and configuration information.
If you are a csh user and wish to convert your csh aliases to Bash
aliases, you may wish to use the script `examples/misc/alias-conv.sh'
as a starting point. The script `examples/misc/cshtobash' is a
more ambitious script that attempts to do a more complete job.
Reporting Bugs
==============
Bug reports for bash should be sent to:
bug-bash@gnu.org
using the `bashbug' program that is built and installed at the same
time as bash.
The discussion list `bug-bash@gnu.org' often contains information
about new ports of Bash, or discussions of new features or behavior
changes that people would like. This mailing list is also available
as a usenet newsgroup: gnu.bash.bug.
When you send a bug report, please use the `bashbug' program that is
built at the same time as bash. If bash fails to build, try building
bashbug directly with `make bashbug'. If you cannot build `bashbug',
please send mail to bug-bash@gnu.org with the following information:
* the version number and release status of Bash (e.g., 2.05a-release)
* the machine and OS that it is running on (you may run
`bashversion -l' from the bash build directory for this information)
* a list of the compilation flags or the contents of `config.h', if
appropriate
* a description of the bug
* a recipe for recreating the bug reliably
* a fix for the bug if you have one!
The `bashbug' program includes much of this automatically.
If you would like to contact the Bash maintainers directly, send mail
to bash-maintainers@gnu.org.
While the Bash maintainers do not promise to fix all bugs, we would
like this shell to be the best that we can make it.
Enjoy!
Chet Ramey
chet.ramey@case.edu
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
+20650 -4045
View File
File diff suppressed because it is too large Load Diff
+12 -268
View File
@@ -6,253 +6,6 @@
bless( [
'0',
1,
[
'/opt/local/share/autoconf'
],
[
'/opt/local/share/autoconf/autoconf/autoconf.m4f',
'aclocal.m4',
'configure.in'
],
{
'_LT_AC_TAGCONFIG' => 1,
'AM_PROG_F77_C_O' => 1,
'AC_INIT' => 1,
'm4_pattern_forbid' => 1,
'_AM_COND_IF' => 1,
'AC_CANONICAL_TARGET' => 1,
'AC_SUBST' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_FC_SRCEXT' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AM_PATH_GUILE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AC_CONFIG_LINKS' => 1,
'm4_sinclude' => 1,
'LT_SUPPORTED_TAG' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_NLS' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'_m4_warn' => 1,
'AM_PROG_CXX_C_O' => 1,
'_AM_COND_ENDIF' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AM_SILENT_RULES' => 1,
'AM_PROG_MOC' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'LT_INIT' => 1,
'AM_PROG_AR' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_LIBSOURCE' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'sinclude' => 1,
'AM_PROG_CC_C_O' => 1,
'm4_pattern_allow' => 1,
'AM_XGETTEXT_OPTION' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AM_CONDITIONAL' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_POT_TOOLS' => 1,
'm4_include' => 1,
'_AM_COND_ELSE' => 1,
'AC_SUBST_TRACE' => 1
}
], 'Autom4te::Request' ),
bless( [
'1',
1,
[
'/sw/share/autoconf'
],
[
'/sw/share/autoconf/autoconf/autoconf.m4f',
'aclocal.m4',
'configure.in'
],
{
'AM_PROG_F77_C_O' => 1,
'_LT_AC_TAGCONFIG' => 1,
'm4_pattern_forbid' => 1,
'AC_INIT' => 1,
'AC_CANONICAL_TARGET' => 1,
'_AM_COND_IF' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_SUBST' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FC_SRCEXT' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_PATH_GUILE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_CONFIG_LINKS' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'LT_SUPPORTED_TAG' => 1,
'm4_sinclude' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_NLS' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'_m4_warn' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'AM_PROG_CXX_C_O' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'_AM_COND_ENDIF' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AM_SILENT_RULES' => 1,
'AM_PROG_MOC' => 1,
'AC_CONFIG_FILES' => 1,
'LT_INIT' => 1,
'include' => 1,
'AM_GNU_GETTEXT' => 1,
'AM_PROG_AR' => 1,
'AC_LIBSOURCE' => 1,
'AC_CANONICAL_BUILD' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'm4_pattern_allow' => 1,
'AM_PROG_CC_C_O' => 1,
'sinclude' => 1,
'AM_CONDITIONAL' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AM_XGETTEXT_OPTION' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_POT_TOOLS' => 1,
'm4_include' => 1,
'_AM_COND_ELSE' => 1,
'AC_SUBST_TRACE' => 1
}
], 'Autom4te::Request' ),
bless( [
'2',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'aclocal.m4',
'configure.in'
],
{
'm4_pattern_forbid' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_C_VOLATILE' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_STAT' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_HEADER_TIME' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_STRUCT_TM' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_FUNC_STRNLEN' => 1,
'm4_sinclude' => 1,
'AC_PROG_CXX' => 1,
'AC_PATH_X' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_PROG_AWK' => 1,
'_m4_warn' => 1,
'AC_HEADER_STDC' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_LIBSOURCE' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_TYPE_UID_T' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'm4_pattern_allow' => 1,
'sinclude' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_PROG_CC' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_FORK' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_PROG_YACC' => 1,
'AC_INIT' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_SUBST' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_PROG_RANLIB' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_FUNC_MMAP' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_CONFIG_LINKS' => 1,
'AC_CHECK_TYPES' => 1,
'AC_CHECK_MEMBERS' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_HEADER_STAT' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_PROG_CPP' => 1,
'AC_C_INLINE' => 1,
'AC_PROG_LEX' => 1,
'AC_C_CONST' => 1,
'AC_TYPE_PID_T' => 1,
'AC_CONFIG_FILES' => 1,
'include' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_PROG_INSTALL' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_CHECK_LIB' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AH_OUTPUT' => 1,
'AC_FUNC_FSEEKO' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AM_CONDITIONAL' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_PROG_LN_S' => 1,
'AC_FUNC_MEMCMP' => 1,
'm4_include' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_CHECK_FUNCS' => 1
}
], 'Autom4te::Request' ),
bless( [
'3',
1,
[
'/sw/share/autoconf'
],
@@ -262,58 +15,49 @@
'configure.ac'
],
{
'AM_PROG_F77_C_O' => 1,
'_LT_AC_TAGCONFIG' => 1,
'm4_pattern_forbid' => 1,
'AM_PROG_F77_C_O' => 1,
'AC_INIT' => 1,
'AC_CANONICAL_TARGET' => 1,
'm4_pattern_forbid' => 1,
'_AM_COND_IF' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_CANONICAL_TARGET' => 1,
'AC_SUBST' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AC_FC_SRCEXT' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_PATH_GUILE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_CONFIG_LINKS' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'LT_SUPPORTED_TAG' => 1,
'AC_CONFIG_LINKS' => 1,
'm4_sinclude' => 1,
'LT_SUPPORTED_TAG' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_NLS' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'_m4_warn' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'AM_PROG_CXX_C_O' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'_AM_COND_ENDIF' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AM_SILENT_RULES' => 1,
'AM_PROG_MOC' => 1,
'AC_CONFIG_FILES' => 1,
'LT_INIT' => 1,
'include' => 1,
'LT_INIT' => 1,
'AM_GNU_GETTEXT' => 1,
'AM_PROG_AR' => 1,
'AC_LIBSOURCE' => 1,
'AC_CANONICAL_BUILD' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'sinclude' => 1,
'm4_pattern_allow' => 1,
'AM_PROG_CC_C_O' => 1,
'sinclude' => 1,
'AM_CONDITIONAL' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AM_XGETTEXT_OPTION' => 1,
'AM_CONDITIONAL' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_POT_TOOLS' => 1,
'm4_include' => 1,
'_AM_COND_ELSE' => 1,
'AC_SUBST_TRACE' => 1
+2454 -2480
View File
File diff suppressed because it is too large Load Diff
+17 -1
View File
@@ -83,7 +83,11 @@ extern int bash_brace_completion __P((int, int));
#endif /* BRACE_COMPLETION */
/* To avoid including curses.h/term.h/termcap.h and that whole mess. */
#ifdef _MINIX
extern int tputs __P((const char *string, int nlines, void (*outx)(int)));
#else
extern int tputs __P((const char *string, int nlines, int (*outx)(int)));
#endif
/* Forward declarations */
@@ -159,7 +163,11 @@ static char *quote_word_break_chars __P((char *));
static void set_filename_bstab __P((const char *));
static char *bash_quote_filename __P((char *, int, char *));
#ifdef _MINIX
static void putx __P((int));
#else
static int putx __P((int));
#endif
static int bash_execute_unix_command __P((int, int));
static void init_unix_command_map __P((void));
static int isolate_sequence __P((char *, int, int, int *));
@@ -3871,11 +3879,19 @@ bash_quote_filename (s, rtype, qcp)
/* Support for binding readline key sequences to Unix commands. */
static Keymap cmd_xmap;
#ifdef _MINIX
static void
#else
static int
#endif
putx(c)
int c;
{
return (putc (c, rl_outstream));
int x;
x = putc (c, rl_outstream);
#ifndef _MINIX
return x;
#endif
}
static int
+2
View File
@@ -145,6 +145,8 @@ extern void set_bashopts __P((void));
extern void parse_bashopts __P((char *));
extern void initialize_bashopts __P((int));
extern void set_compatibility_opts __P((void));
/* Functions from type.def */
extern int describe_command __P((char *, int));
+175
View File
@@ -0,0 +1,175 @@
/* common.h -- extern declarations for functions defined in common.c. */
/* Copyright (C) 1993-2010 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
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/>.
*/
#if !defined (__COMMON_H)
# define __COMMON_H
#include "stdc.h"
#define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)
/* Flag values for parse_and_execute () */
#define SEVAL_NONINT 0x001
#define SEVAL_INTERACT 0x002
#define SEVAL_NOHIST 0x004
#define SEVAL_NOFREE 0x008
#define SEVAL_RESETLINE 0x010
#define SEVAL_PARSEONLY 0x020
#define SEVAL_NOLONGJMP 0x040
/* Flags for describe_command, shared between type.def and command.def */
#define CDESC_ALL 0x001 /* type -a */
#define CDESC_SHORTDESC 0x002 /* command -V */
#define CDESC_REUSABLE 0x004 /* command -v */
#define CDESC_TYPE 0x008 /* type -t */
#define CDESC_PATH_ONLY 0x010 /* type -p */
#define CDESC_FORCE_PATH 0x020 /* type -ap or type -P */
#define CDESC_NOFUNCS 0x040 /* type -f */
#define CDESC_ABSPATH 0x080 /* convert to absolute path, no ./ */
/* Flags for get_job_by_name */
#define JM_PREFIX 0x01 /* prefix of job name */
#define JM_SUBSTRING 0x02 /* substring of job name */
#define JM_EXACT 0x04 /* match job name exactly */
#define JM_STOPPED 0x08 /* match stopped jobs only */
#define JM_FIRSTMATCH 0x10 /* return first matching job */
/* Flags for remember_args and value of changed_dollar_vars */
#define ARGS_NONE 0x0
#define ARGS_INVOC 0x01
#define ARGS_FUNC 0x02
#define ARGS_SETBLTIN 0x04
/* Functions from common.c */
extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
extern void builtin_warning __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
extern void builtin_usage __P((void));
extern void no_args __P((WORD_LIST *));
extern int no_options __P((WORD_LIST *));
/* common error message functions */
extern void sh_needarg __P((char *));
extern void sh_neednumarg __P((char *));
extern void sh_notfound __P((char *));
extern void sh_invalidopt __P((char *));
extern void sh_invalidoptname __P((char *));
extern void sh_invalidid __P((char *));
extern void sh_invalidnum __P((char *));
extern void sh_invalidsig __P((char *));
extern void sh_erange __P((char *, char *));
extern void sh_badpid __P((char *));
extern void sh_badjob __P((char *));
extern void sh_readonly __P((const char *));
extern void sh_nojobs __P((char *));
extern void sh_restricted __P((char *));
extern void sh_notbuiltin __P((char *));
extern void sh_wrerror __P((void));
extern void sh_ttyerror __P((int));
extern int sh_chkwrite __P((int));
extern char **make_builtin_argv __P((WORD_LIST *, int *));
extern void remember_args __P((WORD_LIST *, int));
extern int dollar_vars_changed __P((void));
extern void set_dollar_vars_unchanged __P((void));
extern void set_dollar_vars_changed __P((void));
extern int get_numeric_arg __P((WORD_LIST *, int, intmax_t *));
extern int get_exitstat __P((WORD_LIST *));
extern int read_octal __P((char *));
/* Keeps track of the current working directory. */
extern char *the_current_working_directory;
extern char *get_working_directory __P((char *));
extern void set_working_directory __P((char *));
#if defined (JOB_CONTROL)
extern int get_job_by_name __P((const char *, int));
extern int get_job_spec __P((WORD_LIST *));
#endif
extern int display_signal_list __P((WORD_LIST *, int));
/* It's OK to declare a function as returning a Function * without
providing a definition of what a `Function' is. */
extern struct builtin *builtin_address_internal __P((char *, int));
extern sh_builtin_func_t *find_shell_builtin __P((char *));
extern sh_builtin_func_t *builtin_address __P((char *));
extern sh_builtin_func_t *find_special_builtin __P((char *));
extern void initialize_shell_builtins __P((void));
/* Functions from exit.def */
extern void bash_logout __P((void));
/* Functions from getopts.def */
extern void getopts_reset __P((int));
/* Functions from set.def */
extern int minus_o_option_value __P((char *));
extern void list_minus_o_opts __P((int, int));
extern char **get_minus_o_opts __P((void));
extern int set_minus_o_option __P((int, char *));
extern void set_shellopts __P((void));
extern void parse_shellopts __P((char *));
extern void initialize_shell_options __P((int));
extern void reset_shell_options __P((void));
/* Functions from shopt.def */
extern void reset_shopt_options __P((void));
extern char **get_shopt_options __P((void));
extern int shopt_setopt __P((char *, int));
extern int shopt_listopt __P((char *, int));
extern int set_login_shell __P((char *, int));
extern void set_bashopts __P((void));
extern void parse_bashopts __P((char *));
extern void initialize_bashopts __P((int));
/* Functions from type.def */
extern int describe_command __P((char *, int));
/* Functions from setattr.def */
extern int set_or_show_attributes __P((WORD_LIST *, int, int));
extern int show_all_var_attributes __P((int, int));
extern int show_var_attributes __P((SHELL_VAR *, int, int));
extern int show_name_attributes __P((char *, int));
extern void set_var_attribute __P((char *, int, int));
/* Functions from pushd.def */
extern char *get_dirstack_from_string __P((char *));
extern char *get_dirstack_element __P((intmax_t, int));
extern void set_dirstack_element __P((intmax_t, int, char *));
extern WORD_LIST *get_directory_stack __P((int));
/* Functions from evalstring.c */
extern int parse_and_execute __P((char *, const char *, int));
extern int evalstring __P((char *, const char *, int));
extern void parse_and_execute_cleanup __P((void));
extern int parse_string __P((char *, const char *, int, char **));
/* Functions from evalfile.c */
extern int maybe_execute_file __P((const char *, int));
extern int source_file __P((const char *, int));
extern int fc_execute_file __P((const char *));
#endif /* !__COMMON_H */
+3 -2
View File
@@ -155,6 +155,8 @@ sigalrm (s)
int s;
{
sigalrm_seen = 1;
if (signal_is_trapped (SIGALRM))
trap_handler (SIGALRM);
if (reading) /* do the longjmp if we get SIGALRM while in read() */
longjmp (alrmbuf, 1);
}
@@ -404,7 +406,7 @@ read_builtin (list)
if (tmsec > 0 || tmusec > 0)
{
code = setjmp (alrmbuf);
code = setjmp_nosigs (alrmbuf);
if (code)
{
sigalrm_seen = 0;
@@ -416,7 +418,6 @@ read_builtin (list)
remove_unwind_protect ();
run_unwind_frame ("read_builtin");
input_string[i] = '\0'; /* make sure it's terminated */
itrace("SIGALRM seen: input_string = '%s'", input_string);
retval = 128+SIGALRM;
goto assign_vars;
}
+42 -10
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-2010 Free Software Foundation, Inc.
Copyright (C) 1994-2012 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -136,6 +136,7 @@ static int shopt_compat31;
static int shopt_compat32;
static int shopt_compat40;
static int shopt_compat41;
static int shopt_compat42;
typedef int shopt_set_func_t __P((char *, int));
@@ -159,6 +160,7 @@ static struct {
{ "compat32", &shopt_compat32, set_compatibility_level },
{ "compat40", &shopt_compat40, set_compatibility_level },
{ "compat41", &shopt_compat41, set_compatibility_level },
{ "compat42", &shopt_compat41, set_compatibility_level },
#if defined (READLINE)
{ "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
{ "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
@@ -525,16 +527,18 @@ set_compatibility_level (option_name, mode)
char *option_name;
int mode;
{
/* Need to change logic here as we add more compatibility levels */
int ind;
/* First, check option_name so we can turn off other compat options when
one is set. */
if (mode && option_name[6] == '3' && option_name[7] == '1')
shopt_compat32 = shopt_compat40 = 0;
else if (mode && option_name[6] == '3' && option_name[7] == '2')
shopt_compat31 = shopt_compat40 = 0;
else if (mode && option_name[6] == '4' && option_name[7] == '0')
shopt_compat31 = shopt_compat32 = 0;
/* If we're setting something, redo some of the work we did above in
toggle_shopt(). Unset everything and reset the appropriate option
based on OPTION_NAME. */
if (mode)
{
shopt_compat31 = shopt_compat32 = 0;
shopt_compat40 = shopt_compat41 = shopt_compat42 = 0;
ind = find_shopt (option_name);
*shopt_vars[ind].value = mode;
}
/* Then set shell_compatibility_level based on what remains */
if (shopt_compat31)
@@ -543,11 +547,39 @@ set_compatibility_level (option_name, mode)
shell_compatibility_level = 32;
else if (shopt_compat40)
shell_compatibility_level = 40;
else if (shopt_compat41)
shell_compatibility_level = 41;
else if (shopt_compat42)
shell_compatibility_level = 42;
else
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
return 0;
}
/* Set and unset the various compatibility options from the value of
shell_compatibility_level; used by sv_shcompat */
void
set_compatibility_opts ()
{
shopt_compat31 = shopt_compat32 = shopt_compat40 = shopt_compat41 = shopt_compat42 = 0;
switch (shell_compatibility_level)
{
case DEFAULT_COMPAT_LEVEL:
break;
case 42:
shopt_compat42 = 1; break;
case 41:
shopt_compat41 = 1; break;
case 40:
shopt_compat40 = 1; break;
case 32:
shopt_compat32 = 1; break;
case 31:
shopt_compat31 = 1; break;
}
}
#if defined (READLINE)
static int
shopt_set_complete_direxpand (option_name, mode)
+783
View File
@@ -0,0 +1,783 @@
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.
This file is part of GNU Bash, the Bourne Again SHell.
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/>.
$PRODUCES shopt.c
$BUILTIN shopt
$FUNCTION shopt_builtin
$SHORT_DOC shopt [-pqsu] [-o] [optname ...]
Set and unset shell options.
Change the setting of each shell option OPTNAME. Without any option
arguments, list all shell options with an indication of whether or not each
is set.
Options:
-o restrict OPTNAMEs to those defined for use with `set -o'
-p print each shell option with an indication of its status
-q suppress output
-s enable (set) each OPTNAME
-u disable (unset) each OPTNAME
Exit Status:
Returns success if OPTNAME is enabled; fails if an invalid option is
given or OPTNAME is disabled.
$END
#include <config.h>
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
#include <stdio.h>
#include "version.h"
#include "../bashintl.h"
#include "../shell.h"
#include "../flags.h"
#include "common.h"
#include "bashgetopt.h"
#if defined (READLINE)
# include "../bashline.h"
#endif
#if defined (HISTORY)
# include "../bashhist.h"
#endif
#define UNSETOPT 0
#define SETOPT 1
#define OPTFMT "%-15s\t%s\n"
extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames;
extern int cdable_vars, mail_warning, source_uses_path;
extern int no_exit_on_failed_exec, print_shift_error;
extern int check_hashed_filenames, promptvars;
extern int cdspelling, expand_aliases;
extern int extended_quote;
extern int check_window_size;
extern int glob_ignore_case, match_ignore_case;
extern int hup_on_exit;
extern int xpg_echo;
extern int gnu_error_format;
extern int check_jobs_at_exit;
extern int autocd;
extern int glob_star;
extern int glob_asciirange;
extern int lastpipe_opt;
#if defined (EXTENDED_GLOB)
extern int extended_glob;
#endif
#if defined (READLINE)
extern int hist_verify, history_reediting, perform_hostname_completion;
extern int no_empty_command_completion;
extern int force_fignore;
extern int dircomplete_spelling, dircomplete_expand;
extern int complete_fullquote;
extern int enable_hostname_completion __P((int));
#endif
#if defined (PROGRAMMABLE_COMPLETION)
extern int prog_completion_enabled;
#endif
#if defined (RESTRICTED_SHELL)
extern char *shell_name;
#endif
#if defined (DEBUGGER)
extern int debugging_mode;
#endif
static void shopt_error __P((char *));
static int set_shellopts_after_change __P((char *, int));
static int shopt_enable_hostname_completion __P((char *, int));
static int set_compatibility_level __P((char *, int));
#if defined (RESTRICTED_SHELL)
static int set_restricted_shell __P((char *, int));
#endif
#if defined (READLINE)
static int shopt_set_complete_direxpand __P((char *, int));
#endif
static int shopt_login_shell;
static int shopt_compat31;
static int shopt_compat32;
static int shopt_compat40;
static int shopt_compat41;
static int shopt_compat42;
typedef int shopt_set_func_t __P((char *, int));
static struct {
char *name;
int *value;
shopt_set_func_t *set_func;
} shopt_vars[] = {
{ "autocd", &autocd, (shopt_set_func_t *)NULL },
{ "cdable_vars", &cdable_vars, (shopt_set_func_t *)NULL },
{ "cdspell", &cdspelling, (shopt_set_func_t *)NULL },
{ "checkhash", &check_hashed_filenames, (shopt_set_func_t *)NULL },
#if defined (JOB_CONTROL)
{ "checkjobs", &check_jobs_at_exit, (shopt_set_func_t *)NULL },
#endif
{ "checkwinsize", &check_window_size, (shopt_set_func_t *)NULL },
#if defined (HISTORY)
{ "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL },
#endif
{ "compat31", &shopt_compat31, set_compatibility_level },
{ "compat32", &shopt_compat32, set_compatibility_level },
{ "compat40", &shopt_compat40, set_compatibility_level },
{ "compat41", &shopt_compat41, set_compatibility_level },
{ "compat42", &shopt_compat41, set_compatibility_level },
#if defined (READLINE)
{ "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
{ "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
{ "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL },
#endif
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
{ "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
#if defined (DEBUGGER)
{ "extdebug", &debugging_mode, (shopt_set_func_t *)NULL },
#endif
#if defined (EXTENDED_GLOB)
{ "extglob", &extended_glob, (shopt_set_func_t *)NULL },
#endif
{ "extquote", &extended_quote, (shopt_set_func_t *)NULL },
{ "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (READLINE)
{ "force_fignore", &force_fignore, (shopt_set_func_t *)NULL },
#endif
{ "globstar", &glob_star, (shopt_set_func_t *)NULL },
{ "globasciiranges", &glob_asciirange, (shopt_set_func_t *)NULL },
{ "gnu_errfmt", &gnu_error_format, (shopt_set_func_t *)NULL },
#if defined (HISTORY)
{ "histappend", &force_append_history, (shopt_set_func_t *)NULL },
#endif
#if defined (READLINE)
{ "histreedit", &history_reediting, (shopt_set_func_t *)NULL },
{ "histverify", &hist_verify, (shopt_set_func_t *)NULL },
{ "hostcomplete", &perform_hostname_completion, shopt_enable_hostname_completion },
#endif
{ "huponexit", &hup_on_exit, (shopt_set_func_t *)NULL },
{ "interactive_comments", &interactive_comments, set_shellopts_after_change },
{ "lastpipe", &lastpipe_opt, (shopt_set_func_t *)NULL },
#if defined (HISTORY)
{ "lithist", &literal_history, (shopt_set_func_t *)NULL },
#endif
{ "login_shell", &shopt_login_shell, set_login_shell },
{ "mailwarn", &mail_warning, (shopt_set_func_t *)NULL },
#if defined (READLINE)
{ "no_empty_cmd_completion", &no_empty_command_completion, (shopt_set_func_t *)NULL },
#endif
{ "nocaseglob", &glob_ignore_case, (shopt_set_func_t *)NULL },
{ "nocasematch", &match_ignore_case, (shopt_set_func_t *)NULL },
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (PROGRAMMABLE_COMPLETION)
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
#endif
{ "promptvars", &promptvars, (shopt_set_func_t *)NULL },
#if defined (RESTRICTED_SHELL)
{ "restricted_shell", &restricted_shell, set_restricted_shell },
#endif
{ "shift_verbose", &print_shift_error, (shopt_set_func_t *)NULL },
{ "sourcepath", &source_uses_path, (shopt_set_func_t *)NULL },
{ "xpg_echo", &xpg_echo, (shopt_set_func_t *)NULL },
{ (char *)0, (int *)0, (shopt_set_func_t *)NULL }
};
#define N_SHOPT_OPTIONS (sizeof (shopt_vars) / sizeof (shopt_vars[0]))
#define GET_SHOPT_OPTION_VALUE(i) (*shopt_vars[i].value)
static const char * const on = "on";
static const char * const off = "off";
static int find_shopt __P((char *));
static int toggle_shopts __P((int, WORD_LIST *, int));
static void print_shopt __P((char *, int, int));
static int list_shopts __P((WORD_LIST *, int));
static int list_some_shopts __P((int, int));
static int list_shopt_o_options __P((WORD_LIST *, int));
static int list_some_o_options __P((int, int));
static int set_shopt_o_options __P((int, WORD_LIST *, int));
#define SFLAG 0x01
#define UFLAG 0x02
#define QFLAG 0x04
#define OFLAG 0x08
#define PFLAG 0x10
int
shopt_builtin (list)
WORD_LIST *list;
{
int opt, flags, rval;
flags = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "psuoq")) != -1)
{
switch (opt)
{
case 's':
flags |= SFLAG;
break;
case 'u':
flags |= UFLAG;
break;
case 'q':
flags |= QFLAG;
break;
case 'o':
flags |= OFLAG;
break;
case 'p':
flags |= PFLAG;
break;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
if ((flags & (SFLAG|UFLAG)) == (SFLAG|UFLAG))
{
builtin_error (_("cannot set and unset shell options simultaneously"));
return (EXECUTION_FAILURE);
}
rval = EXECUTION_SUCCESS;
if ((flags & OFLAG) && ((flags & (SFLAG|UFLAG)) == 0)) /* shopt -o */
rval = list_shopt_o_options (list, flags);
else if (list && (flags & OFLAG)) /* shopt -so args */
rval = set_shopt_o_options ((flags & SFLAG) ? FLAG_ON : FLAG_OFF, list, flags & QFLAG);
else if (flags & OFLAG) /* shopt -so */
rval = list_some_o_options ((flags & SFLAG) ? 1 : 0, flags);
else if (list && (flags & (SFLAG|UFLAG))) /* shopt -su args */
rval = toggle_shopts ((flags & SFLAG) ? SETOPT : UNSETOPT, list, flags & QFLAG);
else if ((flags & (SFLAG|UFLAG)) == 0) /* shopt [args] */
rval = list_shopts (list, flags);
else /* shopt -su */
rval = list_some_shopts ((flags & SFLAG) ? SETOPT : UNSETOPT, flags);
return (rval);
}
/* Reset the options managed by `shopt' to the values they would have at
shell startup. */
void
reset_shopt_options ()
{
allow_null_glob_expansion = glob_dot_filenames = 0;
cdable_vars = mail_warning = 0;
no_exit_on_failed_exec = print_shift_error = 0;
check_hashed_filenames = cdspelling = expand_aliases = check_window_size = 0;
source_uses_path = promptvars = 1;
#if defined (EXTENDED_GLOB)
extended_glob = 0;
#endif
#if defined (HISTORY)
literal_history = force_append_history = 0;
command_oriented_history = 1;
#endif
#if defined (READLINE)
hist_verify = history_reediting = 0;
perform_hostname_completion = 1;
#endif
shopt_login_shell = login_shell;
}
static int
find_shopt (name)
char *name;
{
int i;
for (i = 0; shopt_vars[i].name; i++)
if (STREQ (name, shopt_vars[i].name))
return i;
return -1;
}
static void
shopt_error (s)
char *s;
{
builtin_error (_("%s: invalid shell option name"), s);
}
static int
toggle_shopts (mode, list, quiet)
int mode;
WORD_LIST *list;
int quiet;
{
WORD_LIST *l;
int ind, rval;
for (l = list, rval = EXECUTION_SUCCESS; l; l = l->next)
{
ind = find_shopt (l->word->word);
if (ind < 0)
{
shopt_error (l->word->word);
rval = EXECUTION_FAILURE;
}
else
{
*shopt_vars[ind].value = mode; /* 1 for set, 0 for unset */
if (shopt_vars[ind].set_func)
(*shopt_vars[ind].set_func) (shopt_vars[ind].name, mode);
}
}
set_bashopts ();
return (rval);
}
static void
print_shopt (name, val, flags)
char *name;
int val, flags;
{
if (flags & PFLAG)
printf ("shopt %s %s\n", val ? "-s" : "-u", name);
else
printf (OPTFMT, name, val ? on : off);
}
/* List the values of all or any of the `shopt' options. Returns 0 if
all were listed or all variables queried were on; 1 otherwise. */
static int
list_shopts (list, flags)
WORD_LIST *list;
int flags;
{
WORD_LIST *l;
int i, val, rval;
if (list == 0)
{
for (i = 0; shopt_vars[i].name; i++)
{
val = *shopt_vars[i].value;
if ((flags & QFLAG) == 0)
print_shopt (shopt_vars[i].name, val, flags);
}
return (sh_chkwrite (EXECUTION_SUCCESS));
}
for (l = list, rval = EXECUTION_SUCCESS; l; l = l->next)
{
i = find_shopt (l->word->word);
if (i < 0)
{
shopt_error (l->word->word);
rval = EXECUTION_FAILURE;
continue;
}
val = *shopt_vars[i].value;
if (val == 0)
rval = EXECUTION_FAILURE;
if ((flags & QFLAG) == 0)
print_shopt (l->word->word, val, flags);
}
return (sh_chkwrite (rval));
}
static int
list_some_shopts (mode, flags)
int mode, flags;
{
int val, i;
for (i = 0; shopt_vars[i].name; i++)
{
val = *shopt_vars[i].value;
if (((flags & QFLAG) == 0) && mode == val)
print_shopt (shopt_vars[i].name, val, flags);
}
return (sh_chkwrite (EXECUTION_SUCCESS));
}
static int
list_shopt_o_options (list, flags)
WORD_LIST *list;
int flags;
{
WORD_LIST *l;
int val, rval;
if (list == 0)
{
if ((flags & QFLAG) == 0)
list_minus_o_opts (-1, (flags & PFLAG));
return (sh_chkwrite (EXECUTION_SUCCESS));
}
for (l = list, rval = EXECUTION_SUCCESS; l; l = l->next)
{
val = minus_o_option_value (l->word->word);
if (val == -1)
{
sh_invalidoptname (l->word->word);
rval = EXECUTION_FAILURE;
continue;
}
if (val == 0)
rval = EXECUTION_FAILURE;
if ((flags & QFLAG) == 0)
{
if (flags & PFLAG)
printf ("set %co %s\n", val ? '-' : '+', l->word->word);
else
printf (OPTFMT, l->word->word, val ? on : off);
}
}
return (sh_chkwrite (rval));
}
static int
list_some_o_options (mode, flags)
int mode, flags;
{
if ((flags & QFLAG) == 0)
list_minus_o_opts (mode, (flags & PFLAG));
return (sh_chkwrite (EXECUTION_SUCCESS));
}
static int
set_shopt_o_options (mode, list, quiet)
int mode;
WORD_LIST *list;
int quiet;
{
WORD_LIST *l;
int rval;
for (l = list, rval = EXECUTION_SUCCESS; l; l = l->next)
{
if (set_minus_o_option (mode, l->word->word) == EXECUTION_FAILURE)
rval = EXECUTION_FAILURE;
}
set_shellopts ();
return rval;
}
/* If we set or unset interactive_comments with shopt, make sure the
change is reflected in $SHELLOPTS. */
static int
set_shellopts_after_change (option_name, mode)
char *option_name;
int mode;
{
set_shellopts ();
return (0);
}
static int
shopt_enable_hostname_completion (option_name, mode)
char *option_name;
int mode;
{
return (enable_hostname_completion (mode));
}
static int
set_compatibility_level (option_name, mode)
char *option_name;
int mode;
{
/* Need to change logic here as we add more compatibility levels or do
this with a shell variable. */
/* First, check option_name so we can turn off other compat options when
one is set. */
if (mode && option_name[6] == '3')
shopt_compat40 = shopt_compat41 = shopt_compat42 = 0;
else if (mode && option_name[6] == '4')
shopt_compat31 = shopt_compat32 = 0;
if (mode && option_name[6] == '3' && option_name[7] == '1')
shopt_compat32 = 0;
else if (mode && option_name[6] == '3' && option_name[7] == '2')
shopt_compat31 = 0;
else if (mode && option_name[6] == '4' && option_name[7] == '0')
shopt_compat41 = shopt_compat42 = 0;
else if (mode && option_name[6] == '4' && option_name[7] == '1')
shopt_compat40 = shopt_compat42 = 0;
else if (mode && option_name[6] == '4' && option_name[7] == '2')
shopt_compat40 = shopt_compat41 = 0;
/* Then set shell_compatibility_level based on what remains */
if (shopt_compat31)
shell_compatibility_level = 31;
else if (shopt_compat32)
shell_compatibility_level = 32;
else if (shopt_compat40)
shell_compatibility_level = 40;
else if (shopt_compat41)
shell_compatibility_level = 41;
else if (shopt_compat42)
shell_compatibility_level = 42;
else
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
return 0;
}
/* Set and unset the various compatibility options from the value of
shell_compatibility_level; used by sv_shcompat */
void
set_compatibility_opts ()
{
shopt_compat31 = shopt_compat32 = shopt_compat40 = shopt_compat41 = shopt_compat42 = 0;
switch (shell_compatibility_level)
{
case DEFAULT_COMPAT_LEVEL:
break;
case 42:
shopt_compat42 = 1; break;
case 41:
shopt_compat41 = 1; break;
case 40:
shopt_compat40 = 1; break;
case 32:
shopt_compat32 = 1; break;
case 31:
shopt_compat31 = 1; break;
}
}
#if defined (READLINE)
static int
shopt_set_complete_direxpand (option_name, mode)
char *option_name;
int mode;
{
set_directory_hook ();
return 0;
}
#endif
#if defined (RESTRICTED_SHELL)
/* Don't allow the value of restricted_shell to be modified. */
static int
set_restricted_shell (option_name, mode)
char *option_name;
int mode;
{
static int save_restricted = -1;
if (save_restricted == -1)
save_restricted = shell_is_restricted (shell_name);
restricted_shell = save_restricted;
return (0);
}
#endif /* RESTRICTED_SHELL */
/* Not static so shell.c can call it to initialize shopt_login_shell */
int
set_login_shell (option_name, mode)
char *option_name;
int mode;
{
shopt_login_shell = login_shell != 0;
return (0);
}
char **
get_shopt_options ()
{
char **ret;
int n, i;
n = sizeof (shopt_vars) / sizeof (shopt_vars[0]);
ret = strvec_create (n + 1);
for (i = 0; shopt_vars[i].name; i++)
ret[i] = savestring (shopt_vars[i].name);
ret[i] = (char *)NULL;
return ret;
}
/*
* External interface for other parts of the shell. NAME is a string option;
* MODE is 0 if we want to unset an option; 1 if we want to set an option.
* REUSABLE is 1 if we want to print output in a form that may be reused.
*/
int
shopt_setopt (name, mode)
char *name;
int mode;
{
WORD_LIST *wl;
int r;
wl = add_string_to_list (name, (WORD_LIST *)NULL);
r = toggle_shopts (mode, wl, 0);
dispose_words (wl);
return r;
}
int
shopt_listopt (name, reusable)
char *name;
int reusable;
{
int i;
if (name == 0)
return (list_shopts ((WORD_LIST *)NULL, reusable ? PFLAG : 0));
i = find_shopt (name);
if (i < 0)
{
shopt_error (name);
return (EXECUTION_FAILURE);
}
print_shopt (name, *shopt_vars[i].value, reusable ? PFLAG : 0);
return (sh_chkwrite (EXECUTION_SUCCESS));
}
void
set_bashopts ()
{
char *value;
char tflag[N_SHOPT_OPTIONS];
int vsize, i, vptr, *ip, exported;
SHELL_VAR *v;
for (vsize = i = 0; shopt_vars[i].name; i++)
{
tflag[i] = 0;
if (GET_SHOPT_OPTION_VALUE (i))
{
vsize += strlen (shopt_vars[i].name) + 1;
tflag[i] = 1;
}
}
value = (char *)xmalloc (vsize + 1);
for (i = vptr = 0; shopt_vars[i].name; i++)
{
if (tflag[i])
{
strcpy (value + vptr, shopt_vars[i].name);
vptr += strlen (shopt_vars[i].name);
value[vptr++] = ':';
}
}
if (vptr)
vptr--; /* cut off trailing colon */
value[vptr] = '\0';
v = find_variable ("BASHOPTS");
/* Turn off the read-only attribute so we can bind the new value, and
note whether or not the variable was exported. */
if (v)
{
VUNSETATTR (v, att_readonly);
exported = exported_p (v);
}
else
exported = 0;
v = bind_variable ("BASHOPTS", value, 0);
/* Turn the read-only attribute back on, and turn off the export attribute
if it was set implicitly by mark_modified_vars and SHELLOPTS was not
exported before we bound the new value. */
VSETATTR (v, att_readonly);
if (mark_modified_vars && exported == 0 && exported_p (v))
VUNSETATTR (v, att_exported);
free (value);
}
void
parse_bashopts (value)
char *value;
{
char *vname;
int vptr, ind;
vptr = 0;
while (vname = extract_colon_unit (value, &vptr))
{
ind = find_shopt (vname);
if (ind >= 0)
*shopt_vars[ind].value = 1;
free (vname);
}
}
void
initialize_bashopts (no_bashopts)
int no_bashopts;
{
char *temp;
SHELL_VAR *var;
if (no_bashopts == 0)
{
var = find_variable ("BASHOPTS");
/* set up any shell options we may have inherited. */
if (var && imported_p (var))
{
temp = (array_p (var) || assoc_p (var)) ? (char *)NULL : savestring (value_cell (var));
if (temp)
{
parse_bashopts (temp);
free (temp);
}
}
}
/* Set up the $BASHOPTS variable. */
set_bashopts ();
}
Vendored
+20364 -4024
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,5 +1,5 @@
dnl
dnl Configure script for bash-4.2
dnl Configure script for bash-4.3
dnl
dnl report bugs to chet@po.cwru.edu
dnl
@@ -21,15 +21,15 @@ 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.2, version 4.052])dnl
AC_REVISION([for Bash 4.3, version 4.053])dnl
define(bashvers, 4.2)
define(relstatus, maint)
define(bashvers, 4.3)
define(relstatus, devel)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
dnl make sure we are using a recent autoconf version
AC_PREREQ(2.50)
AC_PREREQ(2.61)
AC_CONFIG_SRCDIR(shell.h)
dnl where to find install.sh, config.sub, and config.guess
+1194
View File
File diff suppressed because it is too large Load Diff
+25 -2
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Sat Dec 15 17:50:05 EST 2012
.\" Last Change: Sat Dec 29 11:19:16 EST 2012
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2012 December 15" "GNU Bash 4.2"
.TH BASH 1 "2012 December 29" "GNU Bash 4.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1864,6 +1864,23 @@ below.
.PP
.PD 0
.TP
.B BASH_COMPAT
The value is used to set the shell's compatibility level.
See the description of the \fBshopt\fB builtin below under
\fBSHELL BUILTIN COMMANDS\fP for a description of the various compatibility
levels and their effects.
The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
corresponding to the desired compatibility level.
If \fBBASH_COMPAT\fP is unset or set to the empty string, the compatibility
level is set to the default for the current version.
If \fBBASH_COMPAT\fP is set to a value that is not one of the valid
compatibility levels, the shell prints an error message and sets the
compatibility level to the default for the current version.
The valid compatibility levels correspond to the compatibility options
accepted by the \fBshopt\fP builtin described below (for example,
\fBcompat42\fP means that 4.2 and 42 are valid values).
The current version is also a valid value.
.TP
.B BASH_ENV
If this parameter is set when \fBbash\fP is executing a shell script,
its value is interpreted as a filename containing commands to
@@ -9218,6 +9235,12 @@ parameter expansion as a special character. The single quotes must match
quoted. This is the behavior of posix mode through version 4.1.
The default bash behavior remains as in previous versions.
.TP 8
.B compat42
If set,
.B bash
does not process the replacement string in the pattern substitution word
expansion using quote removal.
.TP 8
.B complete_fullquote
If set,
.B bash
+8 -2
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Fri Dec 14 10:13:24 EST 2012
.\" Last Change: Sat Dec 29 11:19:16 EST 2012
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2012 December 14" "GNU Bash 4.2"
.TH BASH 1 "2012 December 29" "GNU Bash 4.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -9218,6 +9218,12 @@ parameter expansion as a special character. The single quotes must match
quoted. This is the behavior of posix mode through version 4.1.
The default bash behavior remains as in previous versions.
.TP 8
.B compat42
If set,
.B bash
does not process the replacement string in the pattern substitution word
expansion using quote removal.
.TP 8
.B complete_fullquote
If set,
.B bash
+24 -2
View File
@@ -4894,6 +4894,11 @@ parameter expansion as a special character. The single quotes must match
quoted. This is the behavior of @sc{posix} mode through version 4.1.
The default Bash behavior remains as in previous versions.
@item compat42
If set, Bash
does not process the replacement string in the pattern substitution word
expansion using quote removal.
@item complete_fullquote
If set, Bash
quotes all shell metacharacters in filenames and directory names when
@@ -5298,6 +5303,22 @@ The command currently being executed or about to be executed, unless the
shell is executing a command as the result of a trap,
in which case it is the command executing at the time of the trap.
@item BASH_COMPAT
The value is used to set the shell's compatibility level.
@xref{The Shopt Builtin} for a description of the various compatibility
levels and their effects.
The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
corresponding to the desired compatibility level.
If @code{BASH_COMPAT} is unset or set to the empty string, the compatibility
level is set to the default for the current version.
If @code{BASH_COMPAT} is set to a value that is not one of the valid
compatibility levels, the shell prints an error message and sets the
compatibility level to the default for the current version.
The valid compatibility levels correspond to the compatibility options
accepted by the @code{shopt} builtin described above (for example,
@var{compat42} means that 4.2 and 42 are valid values).
The current version is also a valid value.
@item BASH_ENV
If this variable is set when Bash is invoked to execute a shell
script, its value is expanded and used as the name of a startup file
@@ -7070,7 +7091,7 @@ 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 POSIX mode, assignment builtins lose their assignment
when not in @sc{posix} mode, assignment builtins lose their assignment
statement expansion properties when preceded by @code{command}.
@item
@@ -7912,7 +7933,8 @@ The @samp{minimal-config} option can be used to disable all of
the following options, but it is processed first, so individual
options may be enabled using @samp{enable-@var{feature}}.
All of the following options except for @samp{disabled-builtins} and
All of the following options except for @samp{disabled-builtins},
@samp{directpand-default}, and
@samp{xpg-echo-default} are
enabled by default, unless the operating system does not provide the
necessary support.
+26 -2
View File
@@ -4274,12 +4274,15 @@ not echoed.
@item -t @var{timeout}
Cause @code{read} to time out and return failure if a complete line of
input is not read within @var{timeout} seconds.
input (or a specified number of characters)
is not read within @var{timeout} seconds.
@var{timeout} may be a decimal number with a fractional portion following
the decimal point.
This option is only effective if @code{read} is reading input from a
terminal, pipe, or other special file; it has no effect when reading
from regular files.
If @code{read} times out, @code{read} saves any partial input read into
the specified variable @var{name}.
If @var{timeout} is 0, @code{read} returns immediately, without trying to
read and data. The exit status is 0 if input is available on
the specified file descriptor, non-zero otherwise.
@@ -4891,6 +4894,11 @@ parameter expansion as a special character. The single quotes must match
quoted. This is the behavior of @sc{posix} mode through version 4.1.
The default Bash behavior remains as in previous versions.
@item compat42
If set, Bash
does not process the replacement string in the pattern substitution word
expansion using quote removal.
@item complete_fullquote
If set, Bash
quotes all shell metacharacters in filenames and directory names when
@@ -5295,6 +5303,22 @@ The command currently being executed or about to be executed, unless the
shell is executing a command as the result of a trap,
in which case it is the command executing at the time of the trap.
@item BASH_COMPAT
The value is used to set the shell's compatibility level.
@xref{The Shopt Builtin} for a description of the various compatibility
levels and their effects.
The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
corresponding to the desired compatibility level.
If @code{BASH_COMPAT} is unset or set to the empty string, the compatibility
level is set to the default for the current version.
If @code{BASH_COMPAT} is set to a value that is not one of the valid
compatibility levels, the shell prints an error message and sets the
compatibility level to the default for the current version.
The valid compatibility levels correspond to the compatibility options
accepted by the @code{shopt} builtin described above (for example,
@var{compat42} means that 4.2 and 42 are valid values).
The current version is also a valid value.
@item BASH_ENV
If this variable is set when Bash is invoked to execute a shell
script, its value is expanded and used as the name of a startup file
@@ -7067,7 +7091,7 @@ 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 POSIX mode, assignment builtins lose their assignment
when not in @sc{posix} mode, assignment builtins lose their assignment
statement expansion properties when preceded by @code{command}.
@item
+2 -2
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2012 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sat Dec 15 17:49:50 EST 2012
@set LASTCHANGE Sat Dec 29 11:19:39 EST 2012
@set EDITION 4.2
@set VERSION 4.2
@set UPDATED 15 December 2012
@set UPDATED 29 December 2012
@set UPDATED-MONTH December 2012
+2 -2
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2012 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Dec 14 10:13:02 EST 2012
@set LASTCHANGE Sat Dec 15 17:49:50 EST 2012
@set EDITION 4.2
@set VERSION 4.2
@set UPDATED 14 December 2012
@set UPDATED 15 December 2012
@set UPDATED-MONTH December 2012
+1 -1
View File
@@ -208,7 +208,7 @@ int rl_visible_stats = 0;
#if defined (COLOR_SUPPORT)
/* Non-zero means to use colors to indicate file type when listing possible
completions. The colors used are taken from $LS_COLORS, if set. */
int _rl_colored_stats = 1;
int _rl_colored_stats = 0;
#endif
/* If non-zero, when completing in the middle of a word, don't insert
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 39
#define PATCHLEVEL 0
#endif /* _PATCHLEVEL_H_ */
+30
View File
@@ -0,0 +1,30 @@
/* patchlevel.h -- current bash patch level */
/* Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
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/>.
*/
#if !defined (_PATCHLEVEL_H_)
#define _PATCHLEVEL_H_
/* It's important that there be no other strings in this file that match the
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 39
#endif /* _PATCHLEVEL_H_ */
+1 -1
View File
@@ -168,7 +168,7 @@ expandable_filename:
filename = temp->redirectee.filename->word;
}
else if (temp->redirectee.dest < 0)
filename = "file descriptor out of range";
filename = _("file descriptor out of range");
else
filename = allocname = itos (temp->redirectee.dest);
+1339
View File
File diff suppressed because it is too large Load Diff
+13 -5
View File
@@ -6738,11 +6738,19 @@ parameter_brace_patsub (varname, value, ind, patsub, quoted, flags)
pat = getpattern (lpatsub, quoted, 1);
if (rep)
/* We want to perform quote removal on the expanded replacement even if
the entire expansion is double-quoted because the parser and string
extraction functions treated quotes in the replacement string as
special. */
rep = expand_string_if_necessary (rep, quoted & ~(Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT), expand_string_unsplit);
{
/* We want to perform quote removal on the expanded replacement even if
the entire expansion is double-quoted because the parser and string
extraction functions treated quotes in the replacement string as
special. THIS IS NOT BACKWARDS COMPATIBLE WITH BASH-4.2. */
if (shell_compatibility_level > 42)
rep = expand_string_if_necessary (rep, quoted & ~(Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT), expand_string_unsplit);
/* This is the bash-4.2 code. */
else if ((mflags & MATCH_QUOTED) == 0)
rep = expand_string_if_necessary (rep, quoted, expand_string_unsplit);
else
rep = expand_string_to_string_internal (rep, quoted, expand_string_unsplit);
}
/* ksh93 doesn't allow the match specifier to be a part of the expanded
pattern. This is an extension. Make sure we don't anchor the pattern
+1 -1
View File
@@ -9374,7 +9374,7 @@ shell_expand_word_list (tlist, eflags)
make_internal_declare (tlist->word->word, "-gA");
else if (tlist->word->flags & W_ASSIGNASSOC)
make_internal_declare (tlist->word->word, "-A");
if ((tlist->word->flags & (W_ASSIGNASSOC|W_ASSNGLOBAL)) == (W_ASSIGNARRAY|W_ASSNGLOBAL))
if ((tlist->word->flags & (W_ASSIGNARRAY|W_ASSNGLOBAL)) == (W_ASSIGNARRAY|W_ASSNGLOBAL))
make_internal_declare (tlist->word->word, "-ga");
else if (tlist->word->flags & W_ASSIGNARRAY)
make_internal_declare (tlist->word->word, "-a");
+10
View File
@@ -7,3 +7,13 @@ set -- ""
recho "A${*:-w}R"
recho "A${*-w}R"
recho "A${*}R"
set -- $'\177'
recho "A${*:+w}R"
recho "A${*+w}R"
recho "A${*}R"
recho A${*:+w}R
recho A${*+w}R
recho A${*}R
+6
View File
@@ -231,3 +231,9 @@ argv[1] = <AR>
argv[1] = <AwR>
argv[1] = <AR>
argv[1] = <AR>
argv[1] = <AwR>
argv[1] = <AwR>
argv[1] = <A^?R>
argv[1] = <AwR>
argv[1] = <AwR>
argv[1] = <A^?R>
+2 -2
View File
@@ -140,7 +140,7 @@ three
one
two
three
4.2
4.3
echo ${BASH_VERSION%\.*}
4.2
4.3
echo ${BASH_VERSION%\.*}
+2
View File
@@ -78,3 +78,5 @@ test'ing
test'ing
test'string
a'b'c
foo b c baz
foo 'bar baz
+6
View File
@@ -41,3 +41,9 @@ test=test\'string
echo "${test//"'"/"'"}"
x="a'b'c"; echo "${x//\'/\'}"
printf '%s\n' "foo ${IFS+"b c"} baz"
# this is where the default behavior differs from posix
set -o posix
echo "foo ${IFS+'bar} baz"
+5
View File
@@ -65,3 +65,8 @@ after failure 3
true || false no exit
false || true no exit
false && false no exit
A:
B:
ehB
C:
D:
+1
View File
@@ -108,3 +108,4 @@ set +e
${THIS_SH} ./set-e1.sub
${THIS_SH} ./set-e2.sub
${THIS_SH} ./set-e3.sub
+10
View File
@@ -0,0 +1,10 @@
foo()
{
echo A:
. ./set-e3a.sub
echo D:
}
# should run all the way through; foo being called in a context where set -e
# is ignored means that that condition persists through sourcing the file
foo && true
+7
View File
@@ -0,0 +1,7 @@
echo B:
set -e
echo $-
false
echo C:
+9
View File
@@ -51,6 +51,15 @@ after fff3: x=4
|0|12|
|y|
|y|
a:b:c:d
a-b-c-d
a:b:c:d
g: ,
f: ,
FIN: asdf fdsa, asdf fdsa
g: v = , w =
f: v = , w =
FIN: v = two, w = one
a=z
a=b
a=z
+6
View File
@@ -202,5 +202,11 @@ $THIS_SH ./varenv1.sub
# more tests; bugs in bash up to version 2.05a
$THIS_SH ./varenv2.sub
# more tests; bugs in bash IFS scoping up through version 4.2
$THIS_SH ./varenv3.sub
# scoping problems with declare -g through bash-4.2
${THIS_SH} ./varenv4.sub
# make sure variable scoping is done right
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
oifs=$IFS
inner () {
#recho inner: "$IFS" >&2
echo a/b/c/d
exit 0
}
outer() {
#recho outer: "$IFS" >&2
for i in 1; do
IFS=/ read m v k a < <(IFS=$oifs inner)
echo $m:$v:$k:$a
done
}
outer
unset m k v a b c d
for j in 1; do
IFS=: read a b c d
done < <(outer)
echo $a-$b-$c-$d
unset m k v a b c d
IFS=: read a b c d < <(outer)
echo $a:$b:$c:$d
+44
View File
@@ -0,0 +1,44 @@
f()
{
local -a v
local -a w
g
echo "f: ${v[@]}, ${w[@]}"
}
g()
{
aux=v
declare -ga "$aux=( asdf fdsa )"
declare -ga w=( asdf fdsa )
echo "g: ${v[@]}, ${w[@]}"
}
f
echo "FIN: ${v[@]}, ${w[@]}"
unset v w
unset -f f g
f()
{
local v
local w
g
echo f: v = $v, w = $w
}
g()
{
aux=v
declare -g w=one
declare -g "$aux=two"
echo g: v = $v, w = $w
}
f
echo FIN: v = $v, w = $w
+57
View File
@@ -57,6 +57,8 @@
#include "alias.h"
#include "jobs.h"
#include "version.h"
#include "builtins/getopt.h"
#include "builtins/common.h"
@@ -4513,6 +4515,7 @@ struct name_and_function {
};
static struct name_and_function special_vars[] = {
{ "BASH_COMPAT", sv_shcompat },
{ "BASH_XTRACEFD", sv_xtracefd },
#if defined (JOB_CONTROL)
@@ -5171,6 +5174,60 @@ sv_xtracefd (name)
}
}
#define MIN_COMPAT_LEVEL 31
void
sv_shcompat (name)
char *name;
{
SHELL_VAR *v;
char *val;
int tens, ones, compatval;
v = find_variable (name);
if (v == 0)
{
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
set_compatibility_opts ();
return;
}
val = value_cell (v);
if (val == 0 || *val == '\0')
{
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
set_compatibility_opts ();
return;
}
/* Handle decimal-like compatibility version specifications: 4.2 */
if (isdigit (val[0]) && val[1] == '.' && isdigit (val[2]) && val[3] == 0)
{
tens = val[0] - '0';
ones = val[2] - '0';
compatval = tens*10 + ones;
}
/* Handle integer-like compatibility version specifications: 42 */
else if (isdigit (val[0]) && isdigit (val[1]) && val[2] == 0)
{
tens = val[0] - '0';
ones = val[1] - '0';
compatval = tens*10 + ones;
}
else
{
compat_error:
internal_error (_("%s: %s: compatibility value out of range"), name, val);
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
set_compatibility_opts ();
return;
}
if (compatval < MIN_COMPAT_LEVEL || compatval > DEFAULT_COMPAT_LEVEL)
goto compat_error;
shell_compatibility_level = compatval;
set_compatibility_opts ();
}
#if defined (JOB_CONTROL)
void
sv_childmax (name)
+74
View File
@@ -57,6 +57,8 @@
#include "alias.h"
#include "jobs.h"
#include "version.h"
#include "builtins/getopt.h"
#include "builtins/common.h"
@@ -2601,6 +2603,23 @@ bind_variable (name, value, flags)
return (bind_variable_internal (name, value, global_variables->table, 0, flags));
}
SHELL_VAR *
bind_global_variable (name, value, flags)
const char *name;
char *value;
int flags;
{
SHELL_VAR *v, *nv;
VAR_CONTEXT *vc, *nvc;
int level;
if (shell_variables == 0)
create_variable_tables ();
/* bind_variable_internal will handle nameref resolution in this case */
return (bind_variable_internal (name, value, global_variables->table, 0, flags));
}
/* Make VAR, a simple shell variable, have value VALUE. Once assigned a
value, variables are no longer invisible. This is a duplicate of part
of the internals of bind_variable. If the variable is exported, or
@@ -4496,6 +4515,7 @@ struct name_and_function {
};
static struct name_and_function special_vars[] = {
{ "BASH_COMPAT", sv_shcompat },
{ "BASH_XTRACEFD", sv_xtracefd },
#if defined (JOB_CONTROL)
@@ -5154,6 +5174,60 @@ sv_xtracefd (name)
}
}
#define MIN_COMPAT_LEVEL 31
void
sv_shcompat (name)
char *name;
{
SHELL_VAR *v;
char *val;
int tens, ones, compatval;
v = find_variable (name);
if (v == 0)
{
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
set_compatibility_opts ();
return;
}
val = value_cell (v);
if (val == 0 || *val == '\0')
{
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
set_compatibility_opts ();
return;
}
/* Handle decimal-like compatibility version specifications: 4.2 */
if (isdigit (val[0]) && val[1] == '.' && isdigit (val[2]) && val[3] == 0)
{
tens = val[0] - '0';
ones = val[2] - '0';
compatval = tens*10 + ones;
}
/* Handle integer-like compatibility version specifications: 42 */
else if (isdigit (val[0]) && isdigit (val[1]) && val[2] == 0)
{
tens = val[0] - '0';
ones = val[1] - '0';
compatval = tens*10 + ones;
}
else
{
compat_error:
internal_error (_("%s: %s: value out of range"), name, val);
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
set_compatibility_opts ();
return;
}
if (compatval < MIN_COMPAT_LEVEL || compatval > DEFAULT_COMPAT_LEVEL)
goto compat_error;
shell_compatibility_level = compatval;
set_compatibility_opts ();
}
#if defined (JOB_CONTROL)
void
sv_childmax (name)
+1
View File
@@ -378,6 +378,7 @@ extern void sv_optind __P((char *));
extern void sv_opterr __P((char *));
extern void sv_locale __P((char *));
extern void sv_xtracefd __P((char *));
extern void sv_shcompat __P((char *));
#if defined (READLINE)
extern void sv_comp_wordbreaks __P((char *));
+1
View File
@@ -253,6 +253,7 @@ extern SHELL_VAR *find_tempenv_variable __P((const char *));
extern SHELL_VAR *copy_variable __P((SHELL_VAR *));
extern SHELL_VAR *make_local_variable __P((const char *));
extern SHELL_VAR *bind_variable __P((const char *, char *, int));
extern SHELL_VAR *bind_global_variable __P((const char *, char *, int));
extern SHELL_VAR *bind_function __P((const char *, COMMAND *));
extern void bind_function_def __P((const char *, FUNCTION_DEF *));
+2 -2
View File
@@ -1,6 +1,6 @@
/* version.c -- distribution and version numbers. */
/* Copyright (C) 1989-2011 Free Software Foundation, Inc.
/* Copyright (C) 1989-2012 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -43,7 +43,7 @@ const char * const release_status = (char *)0;
#endif
const char * const sccs_version = SCCSVERSION;
const char * const bash_copyright = N_("Copyright (C) 2011 Free Software Foundation, Inc.");
const char * const bash_copyright = N_("Copyright (C) 2012 Free Software Foundation, Inc.");
const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
/* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */
+94
View File
@@ -0,0 +1,94 @@
/* version.c -- distribution and version numbers. */
/* Copyright (C) 1989-2011 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
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>
#include <stdio.h>
#include "stdc.h"
#include "version.h"
#include "patchlevel.h"
#include "conftypes.h"
#include "bashintl.h"
extern char *shell_name;
/* Defines from version.h */
const char * const dist_version = DISTVERSION;
const int patch_level = PATCHLEVEL;
const int build_version = BUILDVERSION;
#ifdef RELSTATUS
const char * const release_status = RELSTATUS;
#else
const char * const release_status = (char *)0;
#endif
const char * const sccs_version = SCCSVERSION;
const char * const bash_copyright = N_("Copyright (C) 2011 Free Software Foundation, Inc.");
const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
/* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */
int shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
/* Functions for getting, setting, and displaying the shell version. */
/* Forward declarations so we don't have to include externs.h */
extern char *shell_version_string __P((void));
extern void show_shell_version __P((int));
/* Give version information about this shell. */
char *
shell_version_string ()
{
static char tt[32] = { '\0' };
if (tt[0] == '\0')
{
if (release_status)
#if defined (HAVE_SNPRINTF)
snprintf (tt, sizeof (tt), "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);
#else
sprintf (tt, "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);
#endif
else
#if defined (HAVE_SNPRINTF)
snprintf (tt, sizeof (tt), "%s.%d(%d)", dist_version, patch_level, build_version);
#else
sprintf (tt, "%s.%d(%d)", dist_version, patch_level, build_version);
#endif
}
return tt;
}
void
show_shell_version (extended)
int extended;
{
printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE);
if (extended)
{
printf ("%s\n", _(bash_copyright));
printf ("%s\n", _(bash_license));
printf ("%s\n", _("This is free software; you are free to change and redistribute it."));
printf ("%s\n", _("There is NO WARRANTY, to the extent permitted by law."));
}
}