]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - COMPAT
Bash-4.4 patch 17
[thirdparty/bash.git] / COMPAT
diff --git a/COMPAT b/COMPAT
index b80beff37b82a8bdcc4625ec883e9d3685e6463e..9959b962fd15b729c747511edb98d062d0c0f1c0 100644 (file)
--- a/COMPAT
+++ b/COMPAT
@@ -1,10 +1,14 @@
+Compatibility with previous versions
+====================================
+
 This document details the incompatibilities between this version of bash,
-bash-4.0, and the previous widely-available versions, bash-1.14 (which is
-still the `standard' version for a few Linux distributions) and bash-2.x. 
-These were discovered by users of bash-2.x and 3.x, so this list is not
-comprehensive.  Some of these incompatibilities occur between the current
-version and versions 2.0 and above.  (The differences between bash-1.14 and
-bash-2.0 were significant.)
+bash-4.4, and the previous widely-available versions, bash-3.x (which is
+still the `standard' version for Mac OS X), 4.1/4.2 (which are still
+standard on a few Linux distributions), and bash-4.3, 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
+incompatibilities occur between the current version and versions 2.0 and
+above. 
 
 1.  Bash uses a new quoting syntax, $"...", to do locale-specific
     string translation.  Users who have relied on the (undocumented)
@@ -277,7 +281,8 @@ bash-2.0 were significant.)
     than a regular expression.
 
 34. Bash-4.0 allows the behavior in the previous item to be modified using
-    the notion of a shell `compatibility level'.
+    the notion of a shell `compatibility level'.  If the compat31 shopt
+    option is set, quoting the pattern has no special effect.
 
 35. Bash-3.2 (patched) and Bash-4.0 fix a bug that leaves the shell in an
     inconsistent internal state following an assignment error.  One of the
@@ -292,7 +297,8 @@ bash-2.0 were significant.)
 
 37. Bash-4.0 now allows SIGCHLD to interrupt the wait builtin, as Posix
     specifies, so the SIGCHLD trap is no longer always invoked once per
-    exiting child if you are using `wait' to wait for all children.
+    exiting child if you are using `wait' to wait for all children.  As
+    of bash-4.2, this is the status quo only when in posix mode.
 
 38. Since bash-4.0 now follows Posix rules for finding the closing delimiter
     of a $() command substitution, it will not behave as previous versions
@@ -311,4 +317,143 @@ bash-2.0 were significant.)
 
 41. Beginning with bash-4.0, when one of the commands in a pipeline is killed
     by a SIGINT while executing a command list, the shell acts as if it
-    received the interrupt.
+    received the interrupt.  This can be disabled by setting the compat31 or
+    compat32 shell options.
+
+42. Bash-4.0 changes the handling of the set -e option so that the shell exits
+    if a pipeline fails (and not just if the last command in the failing
+    pipeline is a simple command).  This is not as Posix specifies.  There is
+    work underway to update this portion of the standard; the bash-4.0
+    behavior attempts to capture the consensus at the time of release.
+
+43. Bash-4.0 fixes a Posix mode bug that caused the . (source) builtin to
+    search the current directory for its filename argument, even if "." is
+    not in $PATH.  Posix says that the shell shouldn't look in $PWD in this
+    case.
+
+44. Bash-4.1 uses the current locale when comparing strings using the < and
+    > operators to the `[[' command.  This can be reverted to the previous
+    behavior (ASCII collating and strcmp(3)) by setting one of the
+    `compatNN' shopt options, where NN is less than 41.
+
+45. Bash-4.1 conforms to the current Posix specification for `set -u':
+    expansions of $@ and $* when there are no positional parameters do not
+    cause the shell to exit.
+
+46. Bash-4.1 implements the current Posix specification for `set -e' and
+    exits when any command fails, not just a simple command or pipeline.
+
+47. Command substitutions now remove the caller's trap strings when trap is
+    run to set a new trap in the subshell.  Previous to bash-4.2, the old
+    trap strings persisted even though the actual signal handlers were reset.
+
+48. When in Posix mode, a single quote is not treated specially in a
+    double-quoted ${...} expansion, unless the expansion operator is
+    # or % or the new `//', `^', or `,' expansions.  In particular, it
+    does not define a new quoting context.  This is from Posix interpretation
+    221.
+
+49. Posix mode shells no longer exit if a variable assignment error occurs
+    with an assignment preceding a command that is not a special builtin.
+
+50. Bash-4.2 attempts to preserve what the user typed when performing word
+    completion, instead of, for instance, expanding shell variable
+    references to their value.
+
+51. When in Posix mode, bash-4.2 exits if the filename supplied as an argument
+    to `.' is not found and the shell is not interactive.
+
+52. When compiled for strict Posix compatibility, bash-4.3 does not enable
+    history expansion by default in interactive shells, since it results in
+    a non-conforming environment.
+
+53. Bash-4.3 runs the replacement string in the pattern substitution word
+    expansion through quote removal.  The code already treats quote
+    characters in the replacement string as special; if it treats them as
+    special, then quote removal should remove them.
+
+54. Bash-4.4 no longer considers a reference to ${a[@]} or ${a[*]}, where `a'
+    is an array without any elements set, to be a reference to an unset
+    variable.  This means that such a reference will not cause the shell to
+    exit when the `-u' option is enabled.
+
+55. Bash-4.4 allows double quotes to quote the history expansion character (!)
+    when in Posix mode, since Posix specifies the effects of double quotes.
+
+56. Bash-4.4 does not inherit $PS4 from the environment if running as root.
+
+57. Bash-4.4 doesn't allow a `break' or `continue' in a function to affect
+    loop execution in the calling context.
+
+58. Bash-4.4 no longer expands tildes in $PATH elements when in Posix mode.
+
+59. Bash-4.4 does not attempt to perform a compound array assignment if an
+    argument to `declare' or a similar builtin expands to a word that looks
+    like a compound array assignment (e.g. declare w=$x where x='(foo)').
+
+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).
+
+Bash-4.3 introduces a new shell variable: BASH_COMPAT.  The value assigned
+to this variable (a decimal version number like 4.2, or an integer
+corresponding to the compatNN option, like 42) determines the compatibility
+level.
+
+Bash-4.4 has begun deprecating older compatibility levels.  Eventually, the
+options will be removed in favor of the BASH_COMPAT variable.
+
+compat31 set
+       - the < and > operators to the [[ command do not consider the current
+         locale when comparing strings; they use ASCII ordering
+       - quoting the rhs of the regexp matching operator (=~) has no
+         special effect
+
+compat32 set
+       - the < and > operators to the [[ command do not consider the current
+         locale when comparing strings; they use ASCII ordering
+
+compat40 set
+       - the < and > operators to the [[ command do not consider the current
+         locale when comparing strings; they use ASCII ordering
+       - interrupting a command list such as "a ; b ; c" causes the execution
+         of the entire list to be aborted (in versions before bash-4.0,
+         interrupting one command in a list caused the next to be executed)
+
+compat41 set
+       - interrupting a command list such as "a ; b ; c" causes the execution
+         of the entire list to be aborted (in versions before bash-4.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
+
+compat42 set
+       - the replacement string in double-quoted pattern substitution is not
+         run through quote removal, as in previous versions
+
+compat43 set
+       - 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)')
+       - word expansion errors are considered non-fatal errors that cause the
+         current command to fail, even in Posix mode
+       - when executing a shell function, the loop state (while/until/etc.) is
+         not reset, so `break' or `continue' in a shell function will break or
+         continue loops in the calling context.  Bash-4.4 and later reset the
+         loop state to prevent this.
+
+-------------------------------------------------------------------------------
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without any warranty.