commit bash-20200520 snapshot

This commit is contained in:
Chet Ramey
2020-05-27 09:00:49 -04:00
parent e76c732799
commit ce1a3c07c4
102 changed files with 29297 additions and 18340 deletions
+10 -7
View File
@@ -100,7 +100,8 @@ ee. Fixed a bug that could result in `history -n' adding spurious line feeds to
commands in the history list.
ff. The $RANDOM random number generator now XORs the top and bottom halves of
the internal 32-bit value to introduce more randomness.
the internal 32-bit value to introduce more randomness. Setting the shell
compatibility level to 50 or lower undoes this.
gg. Fixed several problems caused by running the DEBUG trap on simple commands
executed as part of a pipeline.
@@ -234,6 +235,9 @@ yyy. When `test' is supplied four or more arguments, treat an argument that
is valid, as a string, as it would be when using the POSIX rules, instead
of an operator with a missing argument.
zzz. There is no `compat50' shopt option. Changes to the shell compatibility
level should use the BASH_COMPAT variable.
2. Changes to Readline
a. There are a number of fixes that were found as the result of fuzzing with
@@ -314,7 +318,9 @@ h. The `select' builtin now runs traps if its internal call to the read builtin
is interrupted by a signal.
i. SRANDOM: a new variable that expands to a 32-bit random number that is not
produced by an LCRNG, and uses /dev/urandom or arc4random if available.
produced by an LCRNG, and uses getrandom/getentropy, falling back to
/dev/urandom or arc4random if available. There is a fallback generator if
none of these are available.
j. shell-transpose-words: a new bindable readline command that uses the same
definition of word as shell-forward-word, etc.
@@ -343,7 +349,7 @@ q. wait: has a new -p VARNAME option, which stores the PID returned by `wait -n'
r. Sorting the results of pathname expansion now uses byte-by-byte comparisons
if two strings collate equally to impose a total order; the result of a
POSIX interpretation.
POSIX interpretation (#963 and #1070).
s. Bash now allows SIGINT trap handlers to execute recursively.
@@ -407,10 +413,7 @@ ll. `wait -n' now accepts a list of job specifications as arguments and will
mm. The associative array implementation can now dynamically increase the
size of the hash table based on insertion patterns.
nn. Posix-mode shells no longer allow the closing right paren in a command
substitution to delimit a pending here-document -- the newline is required.
oo. HISTFILE is now readonly in a restricted shell.
nn. HISTFILE is now readonly in a restricted shell.
4. New Features in Readline
+449
View File
@@ -0,0 +1,449 @@
This document details the changes between this version, bash-5.1-alpha, and
the previous version, bash-5.0-release.
1. Changes to Bash
a. Fixed a bug that caused a posix-mode shell to not exit if the return builtin
was executed outside a function or dot script.
b. Fixed a bug where `declare +f' could potentially turn off the function
attribute.
c. Restored bash-4.4 pathname expansion behavior when a word to be expanded had
only backslashes, not any of the other globbing characters. This came after
an extensive POSIX group discussion (interp #1234).
d. There are more changes to avoid performing word expansions multiple times on
arithmetic expressions.
e. Fixed a bug with alias expansion when the alias ends with a TAB.
f. Fixed a bug that caused programmable completion to return an error if the
shell function name supplied as an argument to `complete -F' was invalid.
g. There are several fixes to buffer overflows found as the result of fuzzing
with random input.
h. Fixed a bug that caused the edit-and-execute-command editing command to
start with the previous history line if invoked on an empty line.
i. Fixed a bug that potentially caused `bind --help' to change readline's
output stream.
j. Turning off posix mode now restores the vi-insertion mode binding for TAB
that was in effect when posix mode was enabled.
k. Restore the previous state of job control being enabled if `exec' fails in
an interactive shell.
l. Fixed a bug that caused the terminal's process group to be set incorrectly
if job control was turned off before starting an interactive shell.
m. Fixed a bug that caused a crash when HISTSIZE=0.
n. Fixed a word expansion bug that caused null strings on the rhs of expansions
to be discarded incorrectly.
o. History list management does a better job of handling the situation where
the number of history entries from the current shell session is greater than
the number of entries in the history list.
p. Fixed a bug that caused the `fc' builtin to attempt to dereference a newly-
freed history entry.
q. Fixed a bug that made the `Q' variable transformation not work well with
`set -u'.
r. There are several word expansion fixes for expanding $* and $@ in contexts
where word splitting is not going to be performed, since each positional
parameter must expand to a separate word.
s. Fixed a bug that could cause ^D to exit bash immediately even if there were
stopped jobs.
t. Fixed a bug with double-quoting and backslash-quoting strings containing
multibyte characters for reuse.
u. Fixed a bug that caused the line number to be reported incorrectly if the
shell executed a (command) subshell.
v. Fixed a bug that caused the shell to fail to reap process substitutions
when they went out of scope, which had unpredictable results.
w. Fixed a bug that caused null strings in arguments to [[ conditional command
operators to compare incorrectly.
x. Changed the behavior of `wait' without arguments to only wait for background
processes the current shell instance started, not background children it may
have inherited.
y. Fixed a bug that could cause command substitution to leave file descriptors
open if the shell received many SIGINTs.
z. Bash now behaves better if the `**' filename expansion operator encounters a
symbolic link to a directory, avoiding more cases where it might return
duplicate pathnames.
aa. Programmable completion now canonicalizes directory names in the same way
as bash word completion, so `..' is handled consistently.
bb. Fixed a bug when using RETURN as the delimiter to the read builtin; it
caused readline to set the binding for RETURN incorrectly.
cc. Fixed a bug that caused `history -d' to delay printing an out-of-range
error message.
dd. Fixed a bug with `bash -c command' where `command' ends with an expanded
alias.
ee. Fixed a bug that could result in `history -n' adding spurious line feeds to
commands in the history list.
ff. The $RANDOM random number generator now XORs the top and bottom halves of
the internal 32-bit value to introduce more randomness. Setting the shell
compatibility level to 50 or lower undoes this.
gg. Fixed several problems caused by running the DEBUG trap on simple commands
executed as part of a pipeline.
ii. Fixed a bug that didn't allow `bind -r' to remove the binding for \C-@.
jj. Several fixes to the bash-backward-shellword bindable readline command to
behave better when at the last character on the line.
kk. If `set -x' is enabled, bash doesn't print a command twice if it's run by
the `command' builtin.
ll. Fixed a bug with printing function definitions containing here documents.
mm. Fixed a bug that could cause the `bind' builtin to set $? to -1.
nn. Fixed a bug that didn't reset the timezone information correctly when the
TZ variable was unset.
oo. Fixed several issues with assigning an associative array variable using a
compound assignment that expands the value of the same variable.
pp. Fixed several places where the shell set $? without setting PIPESTATUS.
qq. Fixed a problem with glob bracket expressions containing invalid character
classes, collating symbols, or equivalence classes -- they should not
require a closing right bracket.
rr. Fixed a bug where running a builtin in a subshell did not run the EXIT trap.
ss. Fixed several problems with posix-mode variable assignments preceding
shell function calls and posix special builtins, so that they create and
modify variables at the current scope.
tt. Fix history initialization so `bash +o history' works as expected.
uu. Fixed a bug in the bindable edit-and-execute-command command that could
interfere with the shell's parsing state.
vv. Fixed an issue with nested traps running command substitutions in command
lines with command substitutions.
ww. Fixed a bug with globbing pathnames that contain invalid multibyte
characters (sequences that don't correspond to a character in the current
locale).
xx. Fixed a bug that caused the shell not to exit if a function definition
failed while errexit was enabled.
yy. Process substitution processes now get their input from /dev/null, since
they are asynchronous, not interactive, and not jobs.
zz. Setting nocaseglob no longer turns on case-insensitive regexp matching.
aaa. Fixed a bug that resulted in extra blank lines being added to some history
entries containing here-documents.
bbb. Fixed a bug that resulted in incorrect matching of some patterns in word
expansion if they expanded to the empty string.
ccc. Fixed here-string expansion so it behaves the same as expansion of the
rhs of an assignment statement.
ddd. Changed here-document parsing to no longer allow the end of the here
document to delimit a command substitution.
eee. Several fixes to history expansion: multiple :p modifiers work, a ^ word
designator works as part of a range, and a `-' is treated as part of a
search string if it immediately follows a `!'.
fff. Fixed a bug in pattern substitution with null matches in a string
containing multibyte characters.
ggg. Unbinding a key sequence bound with `bind -x' now removes the key sequence
from the additional keymap `bind -x' uses.
hhh. Fixed a bug with command start detection for completion so that it doesn't
mistake brace expansion for the start of a command.
iii. Fixed a bug that caused local variables with the same name as variables
appearing in a function's temporary environment to not be marked as local.
jjj. Fixed a bug that could cause SIGCHLD to be blocked when executing return
or exec in the rightmost pipeline element with lastpipe enabled.
kkk. Fixed a bug that could result in commands without the execute bit set
being added to the command hash table.
lll. Fixed a bug that allowed non-digits to follow the `#' in a `base#number'
integer constant.
mmm. Fixed a bug that made `time -- command' attempt to execute `--'.
nnn. Fixed a couple of bugs with variable transformation using arrays
subscripted with `*' or `@'.
ooo. A failure to create a variable using `declare' in a function no longer
causes the function to return immediately.
ppp. Fixed a bug that could cause the := word expansion to add a non-null
value if attempting to assign a null string when double-quoted.
qqq. Fixed a bug that could cause backslashes quoting double quotes in here
document bodies to not be removed when expanding the body.
rrr. Fixed a bug that caused commands following a subshell while the shell is
reading input from stdin but not interactive, while job control is
enabled, to be executed twice.
sss. Fixed a bug where receiving SIGTERM from a different process while
readline was active could cause the shell to terminate.
ttt. In posix mode, running a trap after the read builtin now sees the exit
status of the read builtin (e.g., 130 after a SIGINT) in $?.
uuu. Fixed a bug with nameref variables referencing array subscripts used in
arithmetic expressions.
vvv. Fixed a bug that caused the pipeline process group id to be reset in the
middle of a command list run by a shell started to run a command
substitution.
www. Restricted shells can no longer read and write history files with pathnames
containing slashes.
xxx. Fixed a couple of problems with 0 and -0 used as arguments to `fc' when
not listing commands from the history.
yyy. When `test' is supplied four or more arguments, treat an argument that
looks like an operator (e.g., -e), but is in a place where only a string
is valid, as a string, as it would be when using the POSIX rules, instead
of an operator with a missing argument.
zzz. There is no `compat50' shopt option. Changes to the shell compatibility
level should use the BASH_COMPAT variable.
2. Changes to Readline
a. There are a number of fixes that were found as the result of fuzzing with
random input.
b. Changed the revert-all-at-newline behavior to make sure to start at the end
of the history list when doing it, instead of the line where the user hit
return.
c. When parsing `set' commands from the inputrc file or an application, readline
now allows trailing whitespace.
d. Fixed a bug that left a file descriptor open to the history file if the
file size was 0.
e. Fixed a problem with binding key sequences containing meta characters.
f. Fixed a bug that caused the wrong line to be displayed if the user tried to
move back beyond the beginning of the history list, or forward past the end
of the history list.
g. If readline catches SIGTSTP, it now sets a hook that allows the calling
application to handle it if it desires.
h. Fixed a redisplay problem with a prompt string containing embedded newlines.
i. Fixed a problem with completing filenames containing invalid multibyte
sequences when case-insensitive comparisons are enabled.
j. Fixed a redisplay problem with prompt strings containing invisible multibyte
characters.
k. Fixed a problem with multibyte characters mapped to editing commands that
modify the search string in incremental search.
l. Fixed a bug with maintaining the key sequence while resolving a bound
command in the presence of ambiguous sequences (sequences with a common
prefix), in most cases while attempting to unbind it.
m. Fixed several buffer overflows found as the result of fuzzing.
n. Reworked backslash handling when translating key sequences for key binding
to be more uniform and consistent, which introduces a slight backwards
incompatibility.
o. Fixed a bug with saving the history that resulted in errors not being
propagated to the calling application when the history file is not writable.
p. Readline only calls chown(2) on a newly-written history file if it really
needs to, instead of having it be a no-op.
q. Readline now behaves better when operate-and-get-next is used when the
history list is `full': when there are already $HISTSIZE entries.
3. New Features in Bash
a. `bind -x' now supports different bindings for different editing modes and
keymaps.
b. Bash attempts to optimize the number of times it forks when executing
commands in subshells and from `bash -c'.
c. Here documents and here strings now use pipes for the expanded document if
it's smaller than the pipe buffer size, reverting to temporary files if it's
larger.
d. There are new loadable builtins: mktemp, accept, mkfifo, csv, cut/lcut
e. In posix mode, `trap -p' now displays signals whose disposition is SIG_DFL
and those that were SIG_IGN when the shell starts.
f. The shell now expands the history number (e.g., in PS1) even if it is not
currently saving commands to the history list.
g. `read -e' may now be used with arbitrary file descriptors (`read -u N').
h. The `select' builtin now runs traps if its internal call to the read builtin
is interrupted by a signal.
i. SRANDOM: a new variable that expands to a 32-bit random number that is not
produced by an LCRNG, and uses getrandom/getentropy, falling back to
/dev/urandom or arc4random if available. There is a fallback generator if
none of these are available.
j. shell-transpose-words: a new bindable readline command that uses the same
definition of word as shell-forward-word, etc.
k. The shell now adds default bindings for shell-forward-word,
shell-backward-word, shell-transpose-words, and shell-kill-word.
l. Bash now allows ARGV0 appearing in the initial shell environment to set $0.
m. If `unset' is executed without option arguments, bash tries to unset a shell
function if a name argument cannot be a shell variable name because it's not
an identifier.
n. The `test -N' operator uses nanosecond timestamp granularity if it's
available.
o. Bash posix mode now treats assignment statements preceding shell function
definitions the same as in its default mode, since POSIX has changed and
no longer requires those assignments to persist after the function returns
(POSIX interp 654).
p. BASH_REMATCH is no longer readonly.
q. wait: has a new -p VARNAME option, which stores the PID returned by `wait -n'
or `wait' without arguments.
r. Sorting the results of pathname expansion now uses byte-by-byte comparisons
if two strings collate equally to impose a total order; the result of a
POSIX interpretation (#963 and #1070).
s. Bash now allows SIGINT trap handlers to execute recursively.
t. Bash now saves and restores state around setting and unsetting posix mode,
instead of having unsetting posix mode set a known state.
u. Process substitution is now available in posix mode.
v. READLINE_MARK: a new variable available while executing commands bound with
`bind -x', contains the value of the mark.
w. Bash removes SIGCHLD from the set of blocked signals if it's blocked at shell
startup.
x. `test -v N' can now test whether or not positional parameter N is set.
y. `local' now honors the `-p' option to display all local variables at the
current context.
z. The `@a' variable transformation now prints attributes for unset array
variables.
aa. The `@A' variable transformation now prints a declare command that sets a
variable's attributes if the variable has attributes but is unset.
bb. `declare' and `local' now have a -I option that inherits attributes and
value from a variable with the same name at a previous scope.
cc. When run from a -c command, `jobs' now reports the status of completed jobs.
dd. New `U', `u', and `L' parameter transformations to convert to uppercase,
convert first character to uppercase, and convert to lowercase,
respectively.
ee. PROMPT_COMMANDS: a new array variable, each element of which can contain a
command to be executed like PROMPT_COMMAND.
ff. `ulimit' has a -R option to report and set the RLIMIT_RTTIME resource.
gg. Associative arrays may be assigned using a list of key-value pairs within
a compound assignment. Compound assignments where the words are not of
the form [key]=value are assumed to be key-value assignments. A missing or
empty key is an error; a missing value is treated as NULL. Assignments may
not mix the two forms.
hh. New `K' parameter transformation to display associative arrays as key-
value pairs.
ii. Writing history to syslog now handles messages longer than the syslog max
length by writing multiple messages with a sequence number.
jj. SECONDS and RANDOM may now be assigned using arithmetic expressions, since
they are nominally integer variables. LINENO is not an integer variable.
kk. Bash temporarily suppresses the verbose option when running the DEBUG trap
while running a command from the `fc' builtin.
ll. `wait -n' now accepts a list of job specifications as arguments and will
wait for the first one in the list to change state.
mm. The associative array implementation can now dynamically increase the
size of the hash table based on insertion patterns.
nn. HISTFILE is now readonly in a restricted shell.
4. New Features in Readline
a. If a second consecutive completion attempt produces matches where the first
did not, treat it as a new completion attempt and insert a match as
appropriate.
b. Bracketed paste mode works in more places: incremental search strings, vi
overstrike mode, character search, and reading numeric arguments.
c. Readline automatically switches to horizontal scrolling if the terminal has
only one line.
d. Unbinding all key sequences bound to a particular readline function now
descends into keymaps for multi-key sequences.
e. rl-clear-display: new bindable command that clears the screen and, if
possible, the scrollback buffer (bound to emacs mode M-C-l by default).
f. New active mark and face feature: when enabled, it will highlight the text
inserted by a bracketed paste (the `active region') and the text found by
incremental and non-incremental history searches.
g. Readline sets the mark in several additional commands.
h. Bracketed paste mode is enabled by default (for now).
i. Readline tries to take advantage of the more regular structure of UTF-8
characters to identify the beginning and end of characters when moving
through the line buffer.
j. The bindable operate-and-get-next command (and its default bindings) are
now part of readline instead of a bash-specific addition.
+102 -40
View File
@@ -2,11 +2,11 @@ Compatibility with previous versions
====================================
This document details the incompatibilities between this version of bash,
bash-5.0, and the previous widely-available versions, bash-3.x (which is
bash-5.1, and the previous widely-available versions, bash-3.x (which is
still the `standard' version for Mac OS X), 4.2/4.3 (which are still
standard on a few Linux distributions), and bash-4.4, the current
widely-available version. These were discovered by users of bash-2.x
through 4.x, so this list is not comprehensive. Some of these
standard on a few Linux distributions), and bash-4.4/bash-5.0, the current
widely-available versions. These were discovered by users of bash-2.x
through 5.x, so this list is not comprehensive. Some of these
incompatibilities occur between the current version and versions 2.0 and
above.
@@ -404,78 +404,140 @@ above.
contexts (including the global context) unless the shell is in posix
mode, since export and readonly are special builtins.
63. Bash-5.1 changes the way posix-mode shells handle assignment statements
preceding shell function calls. Previous versions of POSIX specified that
such assignments would persist after the function returned; subsequent
versions of the standard removed that requirement (interpretation #654).
Bash-5.1 posix mode assignment statements preceding shell function calls
do not persist after the function returns.
64. Bash-5.1 reverts to the bash-4.4 treatment of pathname expansion of words
containing backslashes but no other special globbing characters. This comes
after a protracted discussion and a POSIX interpretation (#1234).
65. In bash-5.1, disabling posix mode attempts to restore the state of several
options that posix mode modifies to the state they had before enabling
posix mode. Previous versions restored these options to default values.
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,
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).
as a set of options to the shopt builtin (compat31, compat32, compat40,
compat41, and so on). There is only one current compatibility level --
each option is mutually exclusive. The compatibility level is intended to
allow users to select behavior from previous versions that is incompatible
with newer versions while they migrate scripts to use current features and
behavior. It's intended to be a temporary solution.
Bash-4.3 introduces a new shell variable: BASH_COMPAT. The value assigned
This section 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).
If a user enables, say, compat32, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
The idea is that each compatibility level controls behavior that changed in
that version of bash, but that behavior may have been present in earlier
versions. For instance, the change to use locale-based comparisons with
the `[[' command came in bash-4.1, and earlier versions used ASCII-based
comparisons, so enabling compat32 will enable ASCII-based comparisons as
well. That granularity may not be sufficient for all uses, and as a result
users should employ compatibility levels carefully. Read the documentation
for a particular feature to find out the current behavior.
Bash-4.3 introduced 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.
Bash-4.4 has begun deprecating older compatibility levels. Eventually, the
options will be removed in favor of the BASH_COMPAT variable.
Starting with bash-4.4, bash has begun deprecating older compatibility
levels. Eventually, the options will be removed in favor of the
BASH_COMPAT variable.
compat31 set
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use the BASH_COMPAT variable
on bash-5.0 and later versions.
The following table describes the behavior changes controlled by each
compatibility level setting. The `compatNN' tag is used as shorthand for
setting the compatibility level to NN using one of the following
mechanisms. For versions prior to bash-5.0, the compatibility level may be
set using the corresponding compatNN shopt option. For bash-4.3 and later
versions, the BASH_COMPAT variable is preferred, and it is required for
bash-5.1 and later versions.
compat31
- 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
- quoting the rhs of the [[ command's 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
compat32
- 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)
of the next command in the list (in bash-4.0 and later versions,
the shell acts as if it received the interrupt, so interrupting
one command in a list aborts the execution of the entire list)
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.0,
interrupting one command in a list caused the next to be executed)
- when in posix mode, single quotes in the `word' portion of a
double-quoted parameter expansion define a new quoting context and
are treated specially
compat40
- the < and > operators to the [[ command do not consider the current
locale when comparing strings; they use ASCII ordering.
Bash versions prior to bash-4.1 use ASCII collation and strcmp(3);
bash-4.1 and later use the current locale's collation sequence and
strcoll(3).
compat42 set
compat41
- in posix mode, `time' may be followed by options and still be
recognized as a reserved word (this is POSIX interpretation 267)
- in posix mode, the parser requires that an even number of single
quotes occur in the `word' portion of a double-quoted ${...}
parameter expansion and treats them specially, so that characters
within the single quotes are considered quoted (this is POSIX
interpretation 221)
compat42
- the replacement string in double-quoted pattern substitution is not
run through quote removal, as in previous versions
run through quote removal, as it is in versions after bash-4.2
- in posix mode, single quotes are considered special when expanding
the `word' portion of a double-quoted ${...} parameter expansion
and can be used to quote a closing brace or other special character
(this is part of POSIX interpretation 221); in later versions,
single quotes are not special within double-quoted word expansions
compat43 set
compat43
- the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(declare -a foo='(1 2)')
(declare -a foo='(1 2)'). Later versions warn that this usage is
deprecated.
- word expansion errors are considered non-fatal errors that cause the
current command to fail, even in Posix mode
current command to fail, even in posix mode (the default behavior is
to make them fatal errors that cause the shell to exit)
- when executing a shell function, the loop state (while/until/etc.)
is not reset, so `break' or `continue' in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this.
the loop state to prevent this
compat44 set
compat44
- the shell sets up the values used by BASH_ARGV and BASH_ARGC so
they can expand to the shell's positional parameters even if extended
debug mode is not enabled
- a subshell inherits loops from its parent contenxt, so `break'
or `continue' will cause the subshell to exit
- a subshell inherits loops from its parent context, so `break'
or `continue' will cause the subshell to exit. Bash-5.0 and later
reset the loop state to prevent the exit
- variable assignments preceding builtins like export and readonly
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
compat50 (set using BASH_COMPAT)
- Bash-5.1 changed the way $RANDOM is generated to introduce slightly
more randomness. If the shell compatibility level is set to 50 or
lower, it reverts to the method from bash-5.0 and previous versions,
so seeding the random number generator by assigning a value to
RANDOM will produce the same sequence as in bash-5.0
-------------------------------------------------------------------------------
+27
View File
@@ -8380,3 +8380,30 @@ configure.ac
lib/readline/readline.h
- updated defines to readline version 8.1
variables.c
- brand: if shell_compatibility_level is 50 or below, don't xor the
top and bottom halves of the 32-bit random number together, since
previous versions did not
5/21
----
COMPAT
- overhauled and updated the descriptions of the various shopt compatNN
options
doc/bashref.texi
- Shell Compatibility Mode: new section, describes compatibility levels,
BASH_COMPAT, and the various compatNN shopt options
5/23
----
doc/bash.1
- added Shell Compatibility mode section
doc/{bash.1,bashref.texi}
- changed shopt section to list the compatibility options and refer
to Shell Compatibility Mode section
- BASH_COMPAT: overhauled the text, refers to Shell Compatibility Mode
section
+161
View File
@@ -1,3 +1,164 @@
This is a terse description of the new features added to bash-5.1 since
the release of bash-5.0. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. `bind -x' now supports different bindings for different editing modes and
keymaps.
b. Bash attempts to optimize the number of times it forks when executing
commands in subshells and from `bash -c'.
c. Here documents and here strings now use pipes for the expanded document if
it's smaller than the pipe buffer size, reverting to temporary files if it's
larger.
d. There are new loadable builtins: mktemp, accept, mkfifo, csv, cut/lcut
e. In posix mode, `trap -p' now displays signals whose disposition is SIG_DFL
and those that were SIG_IGN when the shell starts.
f. The shell now expands the history number (e.g., in PS1) even if it is not
currently saving commands to the history list.
g. `read -e' may now be used with arbitrary file descriptors (`read -u N').
h. The `select' builtin now runs traps if its internal call to the read builtin
is interrupted by a signal.
i. SRANDOM: a new variable that expands to a 32-bit random number that is not
produced by an LCRNG, and uses getrandom/getentropy, falling back to
/dev/urandom or arc4random if available. There is a fallback generator if
none of these are available.
j. shell-transpose-words: a new bindable readline command that uses the same
definition of word as shell-forward-word, etc.
k. The shell now adds default bindings for shell-forward-word,
shell-backward-word, shell-transpose-words, and shell-kill-word.
l. Bash now allows ARGV0 appearing in the initial shell environment to set $0.
m. If `unset' is executed without option arguments, bash tries to unset a shell
function if a name argument cannot be a shell variable name because it's not
an identifier.
n. The `test -N' operator uses nanosecond timestamp granularity if it's
available.
o. Bash posix mode now treats assignment statements preceding shell function
definitions the same as in its default mode, since POSIX has changed and
no longer requires those assignments to persist after the function returns
(POSIX interp 654).
p. BASH_REMATCH is no longer readonly.
q. wait: has a new -p VARNAME option, which stores the PID returned by `wait -n'
or `wait' without arguments.
r. Sorting the results of pathname expansion now uses byte-by-byte comparisons
if two strings collate equally to impose a total order; the result of a
POSIX interpretation.
s. Bash now allows SIGINT trap handlers to execute recursively.
t. Bash now saves and restores state around setting and unsetting posix mode,
instead of having unsetting posix mode set a known state.
u. Process substitution is now available in posix mode.
v. READLINE_MARK: a new variable available while executing commands bound with
`bind -x', contains the value of the mark.
w. Bash removes SIGCHLD from the set of blocked signals if it's blocked at shell
startup.
x. `test -v N' can now test whether or not positional parameter N is set.
y. `local' now honors the `-p' option to display all local variables at the
current context.
z. The `@a' variable transformation now prints attributes for unset array
variables.
aa. The `@A' variable transformation now prints a declare command that sets a
variable's attributes if the variable has attributes but is unset.
bb. `declare' and `local' now have a -I option that inherits attributes and
value from a variable with the same name at a previous scope.
cc. When run from a -c command, `jobs' now reports the status of completed jobs.
dd. New `U', `u', and `L' parameter transformations to convert to uppercase,
convert first character to uppercase, and convert to lowercase,
respectively.
ee. PROMPT_COMMANDS: a new array variable, each element of which can contain a
command to be executed like PROMPT_COMMAND.
ff. `ulimit' has a -R option to report and set the RLIMIT_RTTIME resource.
gg. Associative arrays may be assigned using a list of key-value pairs within
a compound assignment. Compound assignments where the words are not of
the form [key]=value are assumed to be key-value assignments. A missing or
empty key is an error; a missing value is treated as NULL. Assignments may
not mix the two forms.
hh. New `K' parameter transformation to display associative arrays as key-
value pairs.
ii. Writing history to syslog now handles messages longer than the syslog max
length by writing multiple messages with a sequence number.
jj. SECONDS and RANDOM may now be assigned using arithmetic expressions, since
they are nominally integer variables. LINENO is not an integer variable.
kk. Bash temporarily suppresses the verbose option when running the DEBUG trap
while running a command from the `fc' builtin.
ll. `wait -n' now accepts a list of job specifications as arguments and will
wait for the first one in the list to change state.
mm. The associative array implementation can now dynamically increase the
size of the hash table based on insertion patterns.
nn. HISTFILE is now readonly in a restricted shell.
2. New Features in Readline
a. If a second consecutive completion attempt produces matches where the first
did not, treat it as a new completion attempt and insert a match as
appropriate.
b. Bracketed paste mode works in more places: incremental search strings, vi
overstrike mode, character search, and reading numeric arguments.
c. Readline automatically switches to horizontal scrolling if the terminal has
only one line.
d. Unbinding all key sequences bound to a particular readline function now
descends into keymaps for multi-key sequences.
e. rl-clear-display: new bindable command that clears the screen and, if
possible, the scrollback buffer (bound to emacs mode M-C-l by default).
f. New active mark and face feature: when enabled, it will highlight the text
inserted by a bracketed paste (the `active region') and the text found by
incremental and non-incremental history searches.
g. Readline sets the mark in several additional commands.
h. Bracketed paste mode is enabled by default (for now).
i. Readline tries to take advantage of the more regular structure of UTF-8
characters to identify the beginning and end of characters when moving
through the line buffer.
j. The bindable operate-and-get-next command (and its default bindings) are
now part of readline instead of a bash-specific addition.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-5.0 since
the release of bash-4.4. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
+159
View File
@@ -0,0 +1,159 @@
This is a terse description of the new features added to bash-5.1 since
the release of bash-5.0. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. `bind -x' now supports different bindings for different editing modes and
keymaps.
b. Bash attempts to optimize the number of times it forks when executing
commands in subshells and from `bash -c'.
c. Here documents and here strings now use pipes for the expanded document if
it's smaller than the pipe buffer size, reverting to temporary files if it's
larger.
d. There are new loadable builtins: mktemp, accept, mkfifo, csv, cut/lcut
e. In posix mode, `trap -p' now displays signals whose disposition is SIG_DFL
and those that were SIG_IGN when the shell starts.
f. The shell now expands the history number (e.g., in PS1) even if it is not
currently saving commands to the history list.
g. `read -e' may now be used with arbitrary file descriptors (`read -u N').
h. The `select' builtin now runs traps if its internal call to the read builtin
is interrupted by a signal.
i. SRANDOM: a new variable that expands to a 32-bit random number that is not
produced by an LCRNG, and uses getrandom/getentropy, falling back to
/dev/urandom or arc4random if available. There is a fallback generator if
none of these are available.
j. shell-transpose-words: a new bindable readline command that uses the same
definition of word as shell-forward-word, etc.
k. The shell now adds default bindings for shell-forward-word,
shell-backward-word, shell-transpose-words, and shell-kill-word.
l. Bash now allows ARGV0 appearing in the initial shell environment to set $0.
m. If `unset' is executed without option arguments, bash tries to unset a shell
function if a name argument cannot be a shell variable name because it's not
an identifier.
n. The `test -N' operator uses nanosecond timestamp granularity if it's
available.
o. Bash posix mode now treats assignment statements preceding shell function
definitions the same as in its default mode, since POSIX has changed and
no longer requires those assignments to persist after the function returns
(POSIX interp 654).
p. BASH_REMATCH is no longer readonly.
q. wait: has a new -p VARNAME option, which stores the PID returned by `wait -n'
or `wait' without arguments.
r. Sorting the results of pathname expansion now uses byte-by-byte comparisons
if two strings collate equally to impose a total order; the result of a
POSIX interpretation.
s. Bash now allows SIGINT trap handlers to execute recursively.
t. Bash now saves and restores state around setting and unsetting posix mode,
instead of having unsetting posix mode set a known state.
u. Process substitution is now available in posix mode.
v. READLINE_MARK: a new variable available while executing commands bound with
`bind -x', contains the value of the mark.
w. Bash removes SIGCHLD from the set of blocked signals if it's blocked at shell
startup.
x. `test -v N' can now test whether or not positional parameter N is set.
y. `local' now honors the `-p' option to display all local variables at the
current context.
z. The `@a' variable transformation now prints attributes for unset array
variables.
aa. The `@A' variable transformation now prints a declare command that sets a
variable's attributes if the variable has attributes but is unset.
bb. `declare' and `local' now have a -I option that inherits attributes and
value from a variable with the same name at a previous scope.
cc. When run from a -c command, `jobs' now reports the status of completed jobs.
dd. New `U', `u', and `L' parameter transformations to convert to uppercase,
convert first character to uppercase, and convert to lowercase,
respectively.
ee. PROMPT_COMMANDS: a new array variable, each element of which can contain a
command to be executed like PROMPT_COMMAND.
ff. `ulimit' has a -R option to report and set the RLIMIT_RTTIME resource.
gg. Associative arrays may be assigned using a list of key-value pairs within
a compound assignment. Compound assignments where the words are not of
the form [key]=value are assumed to be key-value assignments. A missing or
empty key is an error; a missing value is treated as NULL. Assignments may
not mix the two forms.
hh. New `K' parameter transformation to display associative arrays as key-
value pairs.
ii. Writing history to syslog now handles messages longer than the syslog max
length by writing multiple messages with a sequence number.
jj. SECONDS and RANDOM may now be assigned using arithmetic expressions, since
they are nominally integer variables. LINENO is not an integer variable.
kk. Bash temporarily suppresses the verbose option when running the DEBUG trap
while running a command from the `fc' builtin.
ll. `wait -n' now accepts a list of job specifications as arguments and will
wait for the first one in the list to change state.
mm. The associative array implementation can now dynamically increase the
size of the hash table based on insertion patterns.
nn. HISTFILE is now readonly in a restricted shell.
2. New Features in Readline
a. If a second consecutive completion attempt produces matches where the first
did not, treat it as a new completion attempt and insert a match as
appropriate.
b. Bracketed paste mode works in more places: incremental search strings, vi
overstrike mode, character search, and reading numeric arguments.
c. Readline automatically switches to horizontal scrolling if the terminal has
only one line.
d. Unbinding all key sequences bound to a particular readline function now
descends into keymaps for multi-key sequences.
e. rl-clear-display: new bindable command that clears the screen and, if
possible, the scrollback buffer (bound to emacs mode M-C-l by default).
f. New active mark and face feature: when enabled, it will highlight the text
inserted by a bracketed paste (the `active region') and the text found by
incremental and non-incremental history searches.
g. Readline sets the mark in several additional commands.
h. Bracketed paste mode is enabled by default (for now).
i. Readline tries to take advantage of the more regular structure of UTF-8
characters to identify the beginning and end of characters when moving
through the line buffer.
j. The bindable operate-and-get-next command (and its default bindings) are
now part of readline instead of a bash-specific addition.
+1 -1
View File
@@ -1,4 +1,4 @@
Platform-Specific Configuration and Operation Notes [somewhat dated]
Platform-Specific Configuration and Operation Notes [very dated]
====================================================================
1. configure --without-gnu-malloc on:
+55 -52
View File
@@ -17,118 +17,118 @@ The following list is what's changed when 'POSIX mode' is in effect:
re-search '$PATH' to find the new location. This is also available
with 'shopt -s checkhash'.
3. The message printed by the job control code and builtins when a job
exits with a non-zero status is 'Done(status)'.
3. Bash will not insert a command without the execute bit set into the
command hash table, even if it returns it as a (last-ditch) result
from a '$PATH' search.
4. The message printed by the job control code and builtins when a job
exits with a non-zero status is 'Done(status)'.
5. The message printed by the job control code and builtins when a job
is stopped is 'Stopped(SIGNAME)', where SIGNAME is, for example,
'SIGTSTP'.
5. Alias expansion is always enabled, even in non-interactive shells.
6. Alias expansion is always enabled, even in non-interactive shells.
6. Reserved words appearing in a context where reserved words are
7. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
7. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
8. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
and '!!' to '!' are enabled, and parameter expansion is performed
on the values of 'PS1' and 'PS2' regardless of the setting of the
'promptvars' option.
8. The POSIX startup files are executed ('$ENV') rather than the
9. The POSIX startup files are executed ('$ENV') rather than the
normal Bash files.
9. Tilde expansion is only performed on assignments preceding a
10. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
10. The default history file is '~/.sh_history' (this is the default
11. The default history file is '~/.sh_history' (this is the default
value of '$HISTFILE').
11. Redirection operators do not perform filename expansion on the
12. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
12. Redirection operators do not perform word splitting on the word in
13. Redirection operators do not perform word splitting on the word in
the redirection.
13. Function names must be valid shell 'name's. That is, they may not
14. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
14. Function names may not be the same as one of the POSIX special
15. Function names may not be the same as one of the POSIX special
builtins.
15. POSIX special builtins are found before shell functions during
16. POSIX special builtins are found before shell functions during
command lookup.
16. When printing shell function definitions (e.g., by 'type'), Bash
17. When printing shell function definitions (e.g., by 'type'), Bash
does not print the 'function' keyword.
17. Literal tildes that appear as the first character in elements of
18. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
18. The 'time' reserved word may be used by itself as a command. When
19. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
19. When parsing and expanding a ${...} expansion that appears within
20. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
20. The parser does not recognize 'time' as a reserved word if the
21. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
21. The '!' character does not introduce history expansion within a
22. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
22. If a POSIX special builtin returns an error status, a
23. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
23. A non-interactive shell exits with an error status if a variable
24. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
24. A non-interactive shell exits with an error status if a variable
25. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command.
25. A non-interactive shell exits with an error status if the
26. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
26. Non-interactive shells exit if FILENAME in '.' FILENAME is not
27. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
27. Non-interactive shells exit if a syntax error in an arithmetic
28. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
28. Non-interactive shells exit if a parameter expansion error occurs.
29. Non-interactive shells exit if a parameter expansion error occurs.
29. Non-interactive shells exit if there is a syntax error in a script
30. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
30. While variable indirection is available, it may not be applied to
31. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
31. When expanding the '*' special parameter in a pattern context
32. When expanding the '*' special parameter in a pattern context
where the expansion is double-quoted does not treat the '$*' as if
it were double-quoted.
32. Assignment statements preceding POSIX special builtins persist in
33. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
33. Assignment statements preceding shell function calls persist in
the shell environment after the function returns, as if a POSIX
special builtin command had been executed.
34. The '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
@@ -158,75 +158,78 @@ The following list is what's changed when 'POSIX mode' is in effect:
handler for a given signal to the original disposition, they should
use '-' as the first argument.
41. The '.' and 'source' builtins do not search the current directory
41. 'trap -p' displays signals whose dispositions are set to SIG_DFL
and those that were ignored when the shell started.
42. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
42. Enabling POSIX mode has the effect of setting the
43. Enabling POSIX mode has the effect of setting the
'inherit_errexit' option, so subshells spawned to execute command
substitutions inherit the value of the '-e' option from the parent
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
43. Enabling POSIX mode has the effect of setting the 'shift_verbose'
44. Enabling POSIX mode has the effect of setting the 'shift_verbose'
option, so numeric arguments to 'shift' that exceed the number of
positional parameters will result in an error message.
44. When the 'alias' builtin displays alias definitions, it does not
45. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
45. When the 'set' builtin is invoked without options, it does not
46. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
46. When the 'set' builtin is invoked without options, it displays
47. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
48. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to PHYSICAL mode.
48. When the 'cd' builtin cannot change a directory because the length
49. When the 'cd' builtin cannot change a directory because the length
of the pathname constructed from '$PWD' and the directory name
supplied as an argument exceeds PATH_MAX when all symbolic links
are expanded, 'cd' will fail instead of attempting to use only the
supplied directory name.
49. The 'pwd' builtin verifies that the value it prints is the same as
50. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
50. When listing the history, the 'fc' builtin does not include an
51. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
51. The default editor used by 'fc' is 'ed'.
52. The default editor used by 'fc' is 'ed'.
52. The 'type' and 'command' builtins will not report a non-executable
53. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
53. The 'vi' editing mode will invoke the 'vi' editor directly when
54. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
54. When the 'xpg_echo' option is enabled, Bash does not attempt to
55. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
55. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
56. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
57. The 'read' builtin may be interrupted by a signal for which a trap
58. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
58. Bash removes an exited background process's status from the list
59. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
There is other POSIX behavior that Bash does not implement by default
+4 -2
View File
@@ -8,11 +8,13 @@ the standard shell. A restricted shell behaves identically to 'bash'
with the exception that the following are disallowed or not performed:
* Changing directories with the 'cd' builtin.
* Setting or unsetting the values of the 'SHELL', 'PATH', 'ENV', or
'BASH_ENV' variables.
* Setting or unsetting the values of the 'SHELL', 'PATH', 'HISTFILE',
'ENV', or 'BASH_ENV' variables.
* Specifying command names containing slashes.
* Specifying a filename containing a slash as an argument to the '.'
builtin command.
* Specifying a filename containing a slash as an argument to the
'history' builtin command.
* Specifying a filename containing a slash as an argument to the '-p'
option to the 'hash' builtin command.
* Importing function definitions from the shell environment at
+3 -3
View File
@@ -1,7 +1,7 @@
Introduction
============
This is GNU Bash, version 5.0. Bash is the GNU Project's Bourne
This is GNU Bash, version 5.1. 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.3 and
bash-4.4. For details, see the file COMPAT. The NEWS file tersely
of Bash and previous widely-distributed versions, bash-4.4 and
bash-5.0. 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
+1 -1
View File
@@ -1,7 +1,7 @@
This file is shopt.def, from which is created shopt.c.
It implements the Bash `shopt' builtin.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Vendored
+12 -12
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.0, version 5.017.
# From configure.ac for Bash 5.1, version 5.017.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.0-maint.
# Generated by GNU Autoconf 2.69 for bash 5.1-alpha.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.0-maint'
PACKAGE_STRING='bash 5.0-maint'
PACKAGE_VERSION='5.1-alpha'
PACKAGE_STRING='bash 5.1-alpha'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1427,7 +1427,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 5.0-maint to adapt to many kinds of systems.
\`configure' configures bash 5.1-alpha to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1492,7 +1492,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.0-maint:";;
short | recursive ) echo "Configuration of bash 5.1-alpha:";;
esac
cat <<\_ACEOF
@@ -1693,7 +1693,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.0-maint
bash configure 5.1-alpha
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2402,7 +2402,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 5.0-maint, which was
It was created by bash $as_me 5.1-alpha, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2800,8 +2800,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers config.h"
BASHVERS=5.0
RELSTATUS=maint
BASHVERS=5.1
RELSTATUS=alpha
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -21039,7 +21039,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 5.0-maint, which was
This file was extended by bash $as_me 5.1-alpha, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21105,7 +21105,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bash config.status 5.0-maint
bash config.status 5.1-alpha
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+1 -1
View File
@@ -334,7 +334,7 @@ posix: bashref.texi
$(RM) POSIX
rbash: bashref.texi
$(SH) ./mkrbash
$(SHELL) ./mkrbash
cmp -s RBASH ../RBASH || mv RBASH ../RBASH
$(RM) RBASH
+211 -60
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Tue May 5 16:20:48 EDT 2020
.\" Last Change: Sat May 23 12:45:10 EDT 2020
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2020 May 5" "GNU Bash 5.0"
.TH BASH 1 "2020 May 23" "GNU Bash 5.1"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -2034,9 +2034,9 @@ below.
.TP
.B BASH_COMPAT
The value is used to set the shell's compatibility level.
See the description of the \fBshopt\fP builtin below under
\fBSHELL BUILTIN COMMANDS\fP
for a description of the various compatibility
See
\fBSHELL COMPATIBILITY MODE\fP
below 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.
@@ -2045,9 +2045,12 @@ 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 valid values correspond to the compatibility levels
described below under
\fBSHELL COMPATIBILITY MODE\fP.
For example, 4.2 and 42 are valid values that correspond
to the \fBcompat42\fP \fBshopt\fP option
and set the compatibility level to 42.
The current version is also a valid value.
.TP
.B BASH_ENV
@@ -9934,72 +9937,27 @@ This option is enabled by default, but only has an effect if command
history is enabled, as described above under
.SM
.BR HISTORY .
.PD 0
.TP 8
.B compat31
If set,
.B bash
changes its behavior to that of version 3.1 with respect to quoted
arguments to the \fB[[\fP conditional command's \fB=~\fP operator
and locale-specific string comparison when using the \fB[[\fP
conditional command's \fB<\fP and \fB>\fP operators.
Bash versions prior to bash-4.1 use ASCII collation and
.IR strcmp (3);
bash-4.1 and later use the current locale's collation sequence and
.IR strcoll (3).
.TP 8
.B compat32
If set,
.B bash
changes its behavior to that of version 3.2 with respect to
locale-specific string comparison when using the \fB[[\fP
conditional command's \fB<\fP and \fB>\fP operators (see previous item)
and the effect of interrupting a command list.
Bash versions 3.2 and earlier continue with the next command in the list
after one terminates due to an interrupt.
.TP 8
.B compat40
If set,
.B bash
changes its behavior to that of version 4.0 with respect to locale-specific
string comparison when using the \fB[[\fP
conditional command's \fB<\fP and \fB>\fP operators (see description of
\fBcompat31\fP)
and the effect of interrupting a command list.
Bash versions 4.0 and later interrupt the list as if the shell received the
interrupt; previous versions continue with the next command in the list.
.TP 8
.B compat41
If set,
.BR bash ,
when in \fIposix mode\fP, treats a single quote in a double-quoted
parameter expansion as a special character. The single quotes must match
(an even number) and the characters between the single quotes are considered
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 compat43
If set,
.B bash
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to \fBdeclare\fP,
makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit),
and does not reset the
loop state when a shell function is executed (this allows \fBbreak\fP or
\fBcontinue\fP in a shell function to affect loops in the caller's context).
.TP 8
.B compat44
If set,
.B bash
saves the positional parameters to BASH_ARGV and BASH_ARGC before they are
used, regardless of whether or not extended debugging mode is enabled.
.PD
These control aspects of the shell's compatibility mode
(see
.SM
.B "SHELL COMPATIBILITY MODE"
below).
.TP 8
.B complete_fullquote
If set,
@@ -10906,6 +10864,199 @@ If
specifies a non-existent process or job, the return status is
127. Otherwise, the return status is the exit status of the last
process or job waited for.
.SH "SHELL COMPATIBILITY MODE"
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
.BR compat31 ,
.BR compat32 ,
.BR compat40 ,
.BR compat41 ,
and so on).
There is only one current
compatibility level -- each option is mutually exclusive.
The compatibility level is intended to allow users to select behavior
from previous versions that is incompatible with newer versions
while they migrate scripts to use current features and
behavior. It's intended to be a temporary solution.
.PP
This section does not mention behavior that is standard for a particular
version (e.g., setting \fBcompat32\fP 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).
.PP
If a user enables, say, \fBcompat32\fP, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
The idea is that each compatibility level controls behavior that changed
in that version of \fBbash\fP,
but that behavior may have been present in earlier versions.
For instance, the change to use locale-based comparisons with the \fB[[\fP
command came in bash-4.1, and earlier versions used ASCII-based comparisons,
so enabling \fBcompat32\fP will enable ASCII-based comparisons as well.
That granularity may not be sufficient for
all uses, and as a result users should employ compatibility levels carefully.
Read the documentation for a particular feature to find out the
current behavior.
.PP
Bash-4.3 introduced a new shell variable:
.SM
.BR BASH_COMPAT .
The value assigned
to this variable (a decimal version number like 4.2, or an integer
corresponding to the \fBcompat\fP\fINN\fP option, like 42) determines the
compatibility level.
.PP
Starting with bash-4.4, Bash has begun deprecating older compatibility
levels.
Eventually, the options will be removed in favor of
.SM
.BR BASH_COMPAT .
.PP
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use
.SM
.B BASH_COMPAT
on bash-5.0 and later versions.
.PP
The following table describes the behavior changes controlled by each
compatibility level setting.
The \fBcompat\fP\fINN\fP tag is used as shorthand for setting the
compatibility level
to \fINN\fP using one of the following mechanisms.
For versions prior to bash-5.0, the compatibility level may be set using
the corresponding \fBcompat\fP\fINN\fP shopt option.
For bash-4.3 and later versions, the
.SM
.B BASH_COMPAT
variable is preferred,
and it is required for bash-5.1 and later versions.
.TP
\fBcompat31\fP
.PD 0
.RS
.IP \(bu
quoting the rhs of the \fB[[\fP command's regexp matching operator (=~)
has no special effect
.RE
.PD
.TP
\fBcompat32\fP
.PD 0
.RS
.IP \(bu
interrupting a command list such as "a ; b ; c" causes the execution
of the next command in the list (in bash-4.0 and later versions,
the shell acts as if it received the interrupt, so
interrupting one command in a list aborts the execution of the
entire list)
.RE
.PD
.TP
\fBcompat40\fP
.PD 0
.RS
.IP \(bu
the \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not
consider the current locale when comparing strings; they use ASCII
ordering.
Bash versions prior to bash-4.1 use ASCII collation and
.IR strcmp (3);
bash-4.1 and later use the current locale's collation sequence and
.IR strcoll (3).
.RE
.PD
.TP
\fBcompat41\fP
.PD 0
.RS
.IP \(bu
in \fIposix\fP mode, \fBtime\fP may be followed by options and still be
recognized as a reserved word (this is POSIX interpretation 267)
.IP \(bu
in \fIposix\fP mode, the parser requires that an even number of single
quotes occur in the \fIword\fP portion of a double-quoted
parameter expansion and treats them specially, so that characters within
the single quotes are considered quoted
(this is POSIX interpretation 221)
.RE
.PD
.TP
\fBcompat42\fP
.PD 0
.RS
.IP \(bu
the replacement string in double-quoted pattern substitution does not
undergo quote removal, as it does in versions after bash-4.2
.IP \(bu
in posix mode, single quotes are considered special when expanding
the \fIword\fP portion of a double-quoted parameter expansion
and can be used to quote a closing brace or other special character
(this is part of POSIX interpretation 221);
in later versions, single quotes
are not special within double-quoted word expansions
.RE
.PD
.TP
\fBcompat43\fP
.PD 0
.RS
.IP \(bu
the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(declare -a foo='(1 2)'). Later versions warn that this usage is
deprecated
.IP \(bu
word expansion errors are considered non-fatal errors that cause the
current command to fail, even in posix mode
(the default behavior is to make them fatal errors that cause the shell
to exit)
.IP \(bu
when executing a shell function, the loop state (while/until/etc.)
is not reset, so \fBbreak\fP or \fBcontinue\fP in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this
.RE
.PD
.TP
\fBcompat44\fP
.PD 0
.RS
.IP \(bu
the shell sets up the values used by
.SM
.B BASH_ARGV
and
.SM
.B BASH_ARGC
so they can expand to the shell's positional parameters even if extended
debugging mode is not enabled
.IP \(bu
a subshell inherits loops from its parent context, so \fBbreak\fP
or \fBcontinue\fP will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the exit
.IP \(bu
variable assignments preceding builtins like \fBexport\fP and \fBreadonly\fP
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
.RE
.PD
.TP
\fBcompat50\fP
.PD 0
.RS
.IP \(bu
Bash-5.1 changed the way
.SM
.B $RANDOM
is generated to introduce slightly
more randomness. If the shell compatibility level is set to 50 or
lower, it reverts to the method from bash-5.0 and previous versions,
so seeding the random number generator by assigning a value to
.SM
.B RANDOM
will produce the same sequence as in bash-5.0
.RE
.PD
.\" bash_builtins
.if \n(zZ=1 .ig zZ
.SH "RESTRICTED SHELL"
+190 -70
View File
@@ -1064,8 +1064,8 @@ to be matched as a string.
An additional binary operator, @samp{=~}, is available, with the same
precedence as @samp{==} and @samp{!=}.
When it is used, the string to the right of the operator is considered
a @sc{POSIX} extended regular expression and matched accordingly
(using the @sc{POSIX} @code{regcomp} and @code{regexec} interfaces
a @sc{posix} extended regular expression and matched accordingly
(using the @sc{posix} @code{regcomp} and @code{regexec} interfaces
usually described in @i{regex}(3)).
The return value is 0 if the string matches
the pattern, and 1 otherwise.
@@ -4790,7 +4790,7 @@ allow this value to be set).
The pipe buffer size.
@item -q
The maximum number of bytes in POSIX message queues.
The maximum number of bytes in @sc{posix} message queues.
@item -r
The maximum real-time scheduling priority.
@@ -5270,61 +5270,14 @@ This option is enabled by default, but only has an effect if command
history is enabled (@pxref{Bash History Facilities}).
@item compat31
If set, Bash
changes its behavior to that of version 3.1 with respect to quoted
arguments to the conditional command's @samp{=~} operator
and with respect to locale-specific
string comparison when using the @code{[[}
conditional command's @samp{<} and @samp{>} operators.
Bash versions prior to bash-4.1 use ASCII collation and strcmp(3);
bash-4.1 and later use the current locale's collation sequence and strcoll(3).
@item compat32
If set, Bash
changes its behavior to that of version 3.2 with respect to locale-specific
string comparison when using the @code{[[}
conditional command's @samp{<} and @samp{>} operators (see previous item)
and the effect of interrupting a command list.
Bash versions 3.2 and earlier continue with the next command in the list
after one terminates due to an interrupt.
@item compat40
If set, Bash
changes its behavior to that of version 4.0 with respect to locale-specific
string comparison when using the @code{[[}
conditional command's @samp{<} and @samp{>} operators (see description
of @code{compat31})
and the effect of interrupting a command list.
Bash versions 4.0 and later interrupt the list as if the shell received the
interrupt; previous versions continue with the next command in the list.
@item compat41
If set, Bash, when in @sc{posix} mode, treats a single quote in a double-quoted
parameter expansion as a special character. The single quotes must match
(an even number) and the characters between the single quotes are considered
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 compat43
If set, Bash
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to @code{declare},
makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit),
and does not reset the
loop state when a shell function is executed (this allows @code{break} or
@code{continue} in a shell function to affect loops in the caller's context).
@item compat44
If set, Bash
saves the positional parameters to BASH_ARGV and BASH_ARGC before they are
used, regardless of whether or not extended debugging mode is enabled.
@itemx compat32
@itemx compat40
@itemx compat41
@itemx compat42
@itemx compat43
@itemx compat44
These control aspects of the shell's compatibility mode
(@pxref{Shell Compatibility Mode}).
@item complete_fullquote
If set, Bash
@@ -5807,18 +5760,20 @@ subsequently reset.
@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.
@xref{Shell Compatibility Mode}, 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
If @env{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
If @env{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 valid values correspond to the compatibility levels
described below (@pxref{Shell Compatibility Mode}).
For example, 4.2 and 42 are valid values that correspond
to the @code{compat42} @code{shopt} option
and set the compatibility level to 42.
The current version is also a valid value.
@item BASH_ENV
@@ -6519,6 +6474,8 @@ This chapter describes features unique to Bash.
* The Restricted Shell:: A more controlled mode of shell execution.
* Bash POSIX Mode:: Making Bash behave more closely to what
the POSIX standard specifies.
* Shell Compatibility Mode:: How Bash supports behavior that was present
in earlier versions and has changed.
@end menu
@node Invoking Bash
@@ -7891,11 +7848,6 @@ double-quoted.
Assignment statements preceding @sc{posix} special builtins
persist in the shell environment after the builtin completes.
@item
Assignment statements preceding shell function calls persist in the
shell environment after the function returns, as if a @sc{posix}
special builtin command had been executed.
@item
The @code{command} builtin does not prevent builtins that take assignment
statements as arguments from expanding them as assignment statements;
@@ -7931,6 +7883,10 @@ is a valid signal number. If users want to reset the handler for a given
signal to the original disposition, they should use @samp{-} as the
first argument.
@item
@code{trap -p} displays signals whose dispositions are set to SIG_DFL and
those that were ignored when the shell started.
@item
The @code{.} and @code{source} builtins do not search the current directory
for the filename argument if it is not found by searching @env{PATH}.
@@ -8045,6 +8001,170 @@ Bash can be configured to be @sc{posix}-conformant by default, by specifying
the @option{--enable-strict-posix-default} to @code{configure} when building
(@pxref{Optional Features}).
@node Shell Compatibility Mode
@section Shell Compatibility Mode
@cindex Compatibility Level
@cindex Compatibility Mode
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
(@code{compat31},
@code{compat32},
@code{compat40},
@code{compat41},
and so on).
There is only one current
compatibility level -- each option is mutually exclusive.
The compatibility level is intended to allow users to select behavior
from previous versions that is incompatible with newer versions
while they migrate scripts to use current features and
behavior. It's intended to be a temporary solution.
This section does not mention behavior that is standard for a particular
version (e.g., setting @code{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).
If a user enables, say, @code{compat32}, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
The idea is that each compatibility level controls behavior that changed
in that version of Bash,
but that behavior may have been present in earlier versions.
For instance, the change to use locale-based comparisons with the @code{[[}
command came in bash-4.1, and earlier versions used ASCII-based comparisons,
so enabling @code{compat32} will enable ASCII-based comparisons as well.
That granularity may not be sufficient for
all uses, and as a result users should employ compatibility levels carefully.
Read the documentation for a particular feature to find out the
current behavior.
Bash-4.3 introduced a new shell variable: @env{BASH_COMPAT}.
The value assigned
to this variable (a decimal version number like 4.2, or an integer
corresponding to the @code{compat}@var{NN} option, like 42) determines the
compatibility level.
Starting with bash-4.4, Bash has begun deprecating older compatibility
levels.
Eventually, the options will be removed in favor of @env{BASH_COMPAT}.
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use @env{BASH_COMPAT}
on bash-5.0 and later versions.
The following table describes the behavior changes controlled by each
compatibility level setting.
The @code{compat}@var{NN} tag is used as shorthand for setting the
compatibility level
to @var{NN} using one of the following mechanisms.
For versions prior to bash-5.0, the compatibility level may be set using
the corresponding @code{compat}@var{NN} shopt option.
For bash-4.3 and later versions, the @env{BASH_COMPAT} variable is preferred,
and it is required for bash-5.1 and later versions.
@table @code
@item compat31
@itemize @bullet
@item
quoting the rhs of the @code{[[} command's regexp matching operator (=~)
has no special effect
@end itemize
@item compat32
@itemize @bullet
@item
interrupting a command list such as "a ; b ; c" causes the execution
of the next command in the list (in bash-4.0 and later versions,
the shell acts as if it received the interrupt, so
interrupting one command in a list aborts the execution of the
entire list)
@end itemize
@item compat40
@itemize @bullet
@item
the @samp{<} and @samp{>} operators to the @code{[[} command do not
consider the current locale when comparing strings; they use ASCII
ordering.
Bash versions prior to bash-4.1 use ASCII collation and strcmp(3);
bash-4.1 and later use the current locale's collation sequence and
strcoll(3).
@end itemize
@item compat41
@itemize @bullet
@item
in posix mode, @code{time} may be followed by options and still be
recognized as a reserved word (this is @sc{posix} interpretation 267)
@item
in posix mode, the parser requires that an even number of single
quotes occur in the @var{word} portion of a double-quoted $@{@dots{}@}
parameter expansion and treats them specially, so that characters within
the single quotes are considered quoted
(this is @sc{posix} interpretation 221)
@end itemize
@item compat42
@itemize @bullet
@item
the replacement string in double-quoted pattern substitution does not
undergo quote removal, as it does in versions after bash-4.2
@item
in posix mode, single quotes are considered special when expanding
the @var{word} portion of a double-quoted $@{@dots{}@} parameter expansion
and can be used to quote a closing brace or other special character
(this is part of @sc{posix} interpretation 221);
in later versions, single quotes
are not special within double-quoted word expansions
@end itemize
@item compat43
@itemize @bullet
@item
the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(declare -a foo='(1 2)'). Later versions warn that this usage is
deprecated
@item
word expansion errors are considered non-fatal errors that cause the
current command to fail, even in posix mode
(the default behavior is to make them fatal errors that cause the shell
to exit)
@item
when executing a shell function, the loop state (while/until/etc.)
is not reset, so @code{break} or @code{continue} in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this
@end itemize
@item compat44
@itemize @bullet
@item
the shell sets up the values used by @env{BASH_ARGV} and @env{BASH_ARGC}
so they can expand to the shell's positional parameters even if extended
debugging mode is not enabled
@item
a subshell inherits loops from its parent context, so @code{break}
or @code{continue} will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the exit
@item
variable assignments preceding builtins like @code{export} and @code{readonly}
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
@end itemize
@item compat50 (set using BASH_COMPAT)
@itemize @bullet
@item
Bash-5.1 changed the way @code{$RANDOM} is generated to introduce slightly
more randomness. If the shell compatibility level is set to 50 or
lower, it reverts to the method from bash-5.0 and previous versions,
so seeding the random number generator by assigning a value to
@env{RANDOM} will produce the same sequence as in bash-5.0
@end itemize
@end table
@node Job Control
@chapter Job Control
+158
View File
@@ -0,0 +1,158 @@
@node Shell Compatibility Mode
@section Shell Compatibility Mode
@cindex Compatibility Level
@cindex Compatibility Mode
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
(@code{compat31},
@code{compat32},
@code{compat40},
@code{compat41},
and so on).
There is only one current
compatibility level -- each option is mutually exclusive.
The compatibility level is intended to allow users to select behavior
from previous versions that is incompatible with newer versions
while they migrate scripts to use current features and
behavior. It's intended to be a temporary solution.
This section does not mention behavior that is standard for a particular
version (e.g., setting @code{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).
If a user enables, say, @code{compat32}, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
The idea is that each compatibility level controls behavior that changed
in that version of Bash, but that granularity may not be sufficient for
all uses, and as a result users should employ compatibility levels carefully.
Read the documentation for a particular feature to find out the
current behavior.
Bash-4.3 introduced a new shell variable: @env{BASH_COMPAT}.
The value assigned
to this variable (a decimal version number like 4.2, or an integer
corresponding to the @code{compat}@var{NN} option, like 42) determines the
compatibility level.
Starting with bash-4.4, Bash has begun deprecating older compatibility
levels.
Eventually, the options will be removed in favor of @env{BASH_COMPAT}.
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use @env{BASH_COMPAT}
on bash-5.0 and later versions.
The following table describes the behavior changes controlled by each
compatibility level setting.
The @code{compat}@var{NN} tag is used as shorthand for setting the
compatibility level
to @var{NN} using one of the following mechanisms.
For versions prior to bash-5.0, the compatibility level may be set using
the corresponding @code{compat}@var{NN} shopt option.
For bash-4.3 and later versions, the @env{BASH_COMPAT} variable is preferred,
and it is required for bash-5.1 and later versions.
@table @code
@item compat31
@itemize @bullet
@item
quoting the rhs of the @code{[[} command's regexp matching operator (=~)
has no special effect
@end itemize
@item compat32
@itemize @bullet
@item
interrupting a command list such as "a ; b ; c" causes the execution
of the next command in the list (in bash-4.0 and later versions,
the shell acts as if it received the interrupt, so
interrupting one command in a list aborts the execution of the
entire list)
@end itemize
@item compat40
@itemize @bullet
@item
the @samp{<} and @samp{>} operators to the @code{[[} command do not
consider the current locale when comparing strings; they use ASCII
ordering.
Bash versions prior to bash-4.1 use ASCII collation and strcmp(3);
bash-4.1 and later use the current locale's collation sequence and
strcoll(3).
@end itemize
@item compat41
@itemize @bullet
@item
in posix mode, @code{time} may be followed by options and still be
recognized as a reserved word (this is @sc{posix} interpretation 267)
@item
in posix mode, the parser requires that an even number of single
quotes occur in the @var{word} portion of a double-quoted $@{@dots{}@}
parameter expansion and treats them specially, so that characters within
the single quotes are considered quoted
(this is @sc{posix} interpretation 221)
@end itemize
@item compat42
@itemize @bullet
@item
the replacement string in double-quoted pattern substitution is not
run through quote removal, as it is in versions after bash-4.2
@item
in posix mode, single quotes are considered special when expanding
the @var{word} portion of a double-quoted a $@{@dots{}@} parameter expansion
and can be used to quote a closing brace or other special character
(this is part of @sc{posix} interpretation 221);
in later versions, single quotes
are not special within double-quoted word expansions
@end itemize
@item compat43
@itemize @bullet
@item
the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(declare -a foo='(1 2)'). Later versions warn that this usage is
deprecated
@item
word expansion errors are considered non-fatal errors that cause the
current command to fail, even in posix mode
(the default behavior is to make them fatal errors that cause the shell
to exit)
@item
when executing a shell function, the loop state (while/until/etc.)
is not reset, so @code{break} or @code{continue} in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this
@end itemize
@item compat44
@itemize @bullet
@item
the shell sets up the values used by @env{BASH_ARGV} and @env{BASH_ARGC}
so they can expand to the shell's positional parameters even if extended
debug mode is not enabled
@item
a subshell inherits loops from its parent context, so @code{break}
or @code{continue} will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the exit
@item
variable assignments preceding builtins like @code{export} and @code{readonly}
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
@end itemize
@item compat50 (set using BASH_COMPAT)
@itemize @bullet
@item
Bash-5.1 changed the way @code{$RANDOM} is generated to introduce slightly
more randomness. If the shell compatibility level is set to 50 or
lower, it reverts to the method from bash-5.0 and previous versions,
so seeding the random number generator by assigning a value to
@env{RANDOM} wll produce the same sequence as in bash-5.0
@end itemize
@end table
+169
View File
@@ -0,0 +1,169 @@
.SH Shell Compatibility Mode
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
.BR compat31 ,
.BR compat32 ,
.BR compat40 ,
.BR compat41 ,
and so on).
There is only one current
compatibility level -- each option is mutually exclusive.
The compatibility level is intended to allow users to select behavior
from previous versions that is incompatible with newer versions
while they migrate scripts to use current features and
behavior. It's intended to be a temporary solution.
.PP
This section does not mention behavior that is standard for a particular
version (e.g., setting \fBcompat32\fP 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).
.PP
If a user enables, say, \fBcompat32\fP, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
The idea is that each compatibility level controls behavior that changed
in that version of \fBbash\fP,
but that behavior may have been present in earlier versions.
For instance, the change to use locale-based comparisons with the \fB[[\fP
command came in bash-4.1, and earlier versions used ASCII-based comparisons,
so enabling \fBcompat32\fP will enable ASCII-based comparisons as well.
That granularity may not be sufficient for
all uses, and as a result users should employ compatibility levels carefully.
Read the documentation for a particular feature to find out the
current behavior.
.PP
Bash-4.3 introduced a new shell variable:
.SM
.BR BASH_COMPAT .
The value assigned
to this variable (a decimal version number like 4.2, or an integer
corresponding to the \fBcompat\fP\fINN\fP option, like 42) determines the
compatibility level.
.PP
Starting with bash-4.4, Bash has begun deprecating older compatibility
levels.
Eventually, the options will be removed in favor of
.SM
.BR BASH_COMPAT .
.PP
Bash-5.0 is the final version for which there will be an individual shopt
option for the previous version. Users should use
.SM
.B BASH_COMPAT
on bash-5.0 and later versions.
.PP
The following table describes the behavior changes controlled by each
compatibility level setting.
The \fBcompat\fP\fINN\fP tag is used as shorthand for setting the
compatibility level
to \fINN\fP using one of the following mechanisms.
For versions prior to bash-5.0, the compatibility level may be set using
the corresponding \fBcompat\fP\fINN\fP shopt option.
For bash-4.3 and later versions, the
.SM
.B BASH_COMPAT
variable is preferred,
and it is required for bash-5.1 and later versions.
.PP
.TP
\fBcompat31\fP
.IP \(bu
quoting the rhs of the \fB[[\fP command's regexp matching operator (=~)
has no special effect
.TP
\fBcompat32\fP
.IP \(bu
interrupting a command list such as "a ; b ; c" causes the execution
of the next command in the list (in bash-4.0 and later versions,
the shell acts as if it received the interrupt, so
interrupting one command in a list aborts the execution of the
entire list)
.TP
\fBcompat40\fP
.IP \(bu
the \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not
consider the current locale when comparing strings; they use ASCII
ordering.
Bash versions prior to bash-4.1 use ASCII collation and
.IR strcmp (3);
bash-4.1 and later use the current locale's collation sequence and
.IR strcoll (3).
.TP
\fBcompat41\fP
.IP \(bu
in \fIposix\fP mode, \fBtime\fP may be followed by options and still be
recognized as a reserved word (this is POSIX interpretation 267)
.IP \(bu
in \fIposix\fP mode, the parser requires that an even number of single
quotes occur in the \fIword\fP portion of a double-quoted
parameter expansion and treats them specially, so that characters within
the single quotes are considered quoted
(this is POSIX interpretation 221)
.TP
\fBcompat42\fP
.IP \(bu
the replacement string in double-quoted pattern substitution does not
undergo quote removal, as it does in versions after bash-4.2
.IP \(bu
in posix mode, single quotes are considered special when expanding
the \fIword\fP portion of a double-quoted parameter expansion
and can be used to quote a closing brace or other special character
(this is part of POSIX interpretation 221);
in later versions, single quotes
are not special within double-quoted word expansions
.TP
\fBcompat43\fP
the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(declare -a foo='(1 2)'). Later versions warn that this usage is
deprecated
.IP \(bu
word expansion errors are considered non-fatal errors that cause the
current command to fail, even in posix mode
(the default behavior is to make them fatal errors that cause the shell
to exit)
.IP \(bu
when executing a shell function, the loop state (while/until/etc.)
is not reset, so \fBbreak\fP or \fBcontinue\fP in that function will break
or continue loops in the calling context. Bash-4.4 and later reset
the loop state to prevent this
.TP
\fBcompat44\fP
.IP \(bu
the shell sets up the values used by
.SM
.B BASH_ARGV
and
.SM
.B BASH_ARGC
so they can expand to the shell's positional parameters even if extended
debug mode is not enabled
.IP \(bu
a subshell inherits loops from its parent context, so \fBbreak\fP
or \fBcontinue\fP will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the exit
.IP \(bu
variable assignments preceding builtins like \fBexport\fP and \fBreadonly\fP
that set attributes continue to affect variables with the same
name in the calling environment even if the shell is not in posix
mode
.TP
\fBcompat50\fP
.IP \(bu
Bash-5.1 changed the way
.SM
.B $RANDOM
is generated to introduce slightly
more randomness. If the shell compatibility level is set to 50 or
lower, it reverts to the method from bash-5.0 and previous versions,
so seeding the random number generator by assigning a value to
.SM
.B RANDOM
will produce the same sequence as in bash-5.0
+4 -4
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2020 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Tue May 5 16:20:28 EDT 2020
@set LASTCHANGE Sat May 23 12:45:30 EDT 2020
@set EDITION 5.0
@set VERSION 5.0
@set EDITION 5.1
@set VERSION 5.1
@set UPDATED 5 May 2020
@set UPDATED 23 May 2020
@set UPDATED-MONTH May 2020
+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 17
#define PATCHLEVEL 0
#endif /* _PATCHLEVEL_H_ */
BIN
View File
Binary file not shown.
+444 -396
View File
File diff suppressed because it is too large Load Diff
+4190
View File
File diff suppressed because it is too large Load Diff
+438 -393
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+1374 -828
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+494 -409
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+1201 -739
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+472 -396
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+832 -562
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+462 -399
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+495 -429
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+480 -415
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+477 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+475 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+447 -396
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+472 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+577 -476
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+480 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+473 -399
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+481 -399
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+911 -595
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+479 -403
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+472 -395
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+472 -395
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+749 -525
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+462 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+492 -409
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+1120 -702
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+485 -399
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+483 -399
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+482 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+448 -400
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+496 -412
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+470 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+471 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+1137 -708
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+480 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+476 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+481 -403
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+473 -396
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+480 -397
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+788 -537
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -1408,7 +1408,10 @@ brand ()
unsigned int ret;
rseed = intrand32 (rseed);
ret = (rseed >> 16) ^ (rseed & 65535);
if (shell_compatibility_level > 50)
ret = (rseed >> 16) ^ (rseed & 65535);
else
ret = rseed;
return (ret & BASH_RAND_MAX);
}

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