Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / COMPAT
diff --git a/COMPAT b/COMPAT
index a01035a..6d30663 100644 (file)
--- a/COMPAT
+++ b/COMPAT
@@ -1,9 +1,12 @@
 This document details the incompatibilites between this version of bash,
-bash-2.04, and the previous widely-available version, bash-1.14 (which
-is still the `standard' version for many Linux distributions).  These
-were discovered by users of bash-2.x, so this list is not comprehensive.
-
-1.  Bash now uses a new quoting syntax, $"...", to do locale-specific
+bash-3.1, and a previous widely-available version, bash-1.14 (which
+is still the `standard' version for a few Linux distributions).  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.)
+
+1.  Bash uses a new quoting syntax, $"...", to do locale-specific
     string translation.  Users who have relied on the (undocumented)
     behavior of bash-1.14 will have to change their scripts.  For
     instance, if you are doing something like this to get the value of
@@ -42,8 +45,8 @@ were discovered by users of bash-2.x, so this list is not comprehensive.
 
 3.  The options to `bind' have changed to make them more consistent with
     the rest of the bash builtins.  If you are using `bind -d' to list
-    the readline keybindings in a form that can be re-read, use `bind -p'
-    instead.  If you were using `bind -v' to list the keybindings, use
+    the readline key bindings in a form that can be re-read, use `bind -p'
+    instead.  If you were using `bind -v' to list the key bindings, use
     `bind -P' instead.
 
 4.  The `long' invocation options must now be prefixed by `--' instead
@@ -62,7 +65,7 @@ were discovered by users of bash-2.x, so this list is not comprehensive.
 
        "\C-\\": self-insert
 
-6.  A number of people complained above having to use ESC to terminate an
+6.  A number of people complained about having to use ESC to terminate an
     incremental search, and asked for an alternate mechanism.  Bash-2.03
     uses the value of the settable readline variable `isearch-terminators'
     to decide which characters should terminate an incremental search.  If
@@ -131,3 +134,92 @@ were discovered by users of bash-2.x, so this list is not comprehensive.
     that declares them:
 
        alias -x='chmod a-x' --> alias -- -x='chmod a-x'
+
+13. The behavior of range specificiers within bracket matching expressions
+    in the pattern matcher (e.g., [A-Z]) depends on the current locale,
+    specifically the value of the LC_COLLATE environment variable.  Setting
+    this variable to C or POSIX will result in the traditional ASCII behavior
+    for range comparisons.  If the locale is set to something else, e.g.,
+    en_US (specified by the LANG or LC_ALL variables), collation order is
+    locale-dependent.  For example, the en_US locale sorts the upper and
+    lower case letters like this:
+
+       AaBb...Zz
+
+    so a range specification like [A-Z] will match every letter except `z'.
+    Other locales collate like
+
+        aAbBcC...zZ
+
+    which means that [A-Z] matches every letter except `a'.
+
+    The portable way to specify upper case letters is [:upper:] instead of
+    A-Z; lower case may be specified as [:lower:] instead of a-z.
+
+    Look at the manual pages for setlocale(3), strcoll(3), and, if it is
+    present, locale(1).
+
+    You can find your current locale information by running locale(1):
+
+       caleb.ins.cwru.edu(2)$ locale
+       LANG=en_US
+       LC_CTYPE="en_US"
+       LC_NUMERIC="en_US"
+       LC_TIME="en_US"
+       LC_COLLATE="en_US"
+       LC_MONETARY="en_US"
+       LC_MESSAGES="en_US"
+       LC_ALL=en_US
+
+    My advice is to put
+
+       export LC_COLLATE=C
+
+    into /etc/profile and inspect any shell scripts run from cron for
+    constructs like [A-Z].  This will prevent things like
+
+       rm [A-Z]*
+
+    from removing every file in the current directory except those beginning
+    with `z' and still allow individual users to change the collation order.
+    Users may put the above command into their own profiles as well, of course.
+
+14.  Bash versions up to 1.14.7 included an undocumented `-l' operator to
+     the `test/[' builtin.  It was a unary operator that expanded to the
+     length of its string argument.  This let you do things like
+
+       test -l $variable -lt 20
+
+     for example.
+
+     This was included for backwards compatibility with old versions of the
+     Bourne shell, which did not provide an easy way to obtain the length of
+     the value of a shell variable.
+
+     This operator is not part of the POSIX standard, because one can (and
+     should) use ${#variable} to get the length of a variable's value.
+     Bash-2.x does not support it.
+
+15.  Bash no longer auto-exports the HOME, PATH, SHELL, TERM, HOSTNAME,
+     HOSTTYPE, MACHTYPE, or OSTYPE variables.
+
+16.  Bash no longer initializes the FUNCNAME, GROUPS, or DIRSTACK variables
+     to have special behavior if they appear in the initial environment.
+
+17.  Bash no longer removes the export attribute from the SSH_CLIENT or
+     SSH2_CLIENT variables, and no longer attempts to discover whether or
+     not it has been invoked by sshd in order to run the startup files.
+
+18.  Bash no longer requires that the body of a function be a group command;
+     any compound command is accepted.
+
+19.  As of bash-3.0, the pattern substitution operators no longer perform
+     quote removal on the pattern before attempting the match.  This is the
+     way the pattern removal functions behave, and is more consistent.
+
+20.  After bash-3.0 was released, I reimplemented tilde expansion, incorporating
+     it into the mainline word expansion code.  This fixes the bug that caused
+     the results of tilde expansion to be re-expanded.  There is one
+     incompatibility:  a ${paramOPword} expansion within double quotes will not
+     perform tilde expansion on WORD.  This is consistent with the other
+     expansions, and what POSIX specifies.