Skip to content

Commit

Permalink
Imported from ../bash-2.05.tar.gz.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaalto committed Sep 12, 2009
1 parent bb70624 commit 28ef6c3
Show file tree
Hide file tree
Showing 251 changed files with 24,920 additions and 15,014 deletions.
558 changes: 557 additions & 1 deletion CHANGES

Large diffs are not rendered by default.

69 changes: 68 additions & 1 deletion COMPAT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This document details the incompatibilites between this version of bash,
bash-2.04, and the previous widely-available version, bash-1.14 (which
bash-2.05, 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.

Expand Down Expand Up @@ -131,3 +131,70 @@ 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. There was a bug in bash-1.14 and previous versions that caused it to
accept as valid syntax for loops of the form

for f in ; do ... ; done

This should be a syntax error, and bash-2.x treats it as such.

14. 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'.

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.

15. 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.
38 changes: 34 additions & 4 deletions CWRU/POSIX.NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ 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'.

2. The `>&' redirection does not redirect stdout and stderr.
2. The message printed by the job control code and builtins when a job
exits with a non-zero status is `Done(status)'.

3. The message printed by the job control code and builtins when a job
exits with a non-zero status is `Done(status)'.
is stopped is `Stopped(SIGNAME)', where SIGNAME is, for example,
`SIGTSTP'.

4. Reserved words may not be aliased.

Expand Down Expand Up @@ -69,7 +71,7 @@ The following list is what's changed when `POSIX mode' is in effect:
`$CDPATH', the value it assigns to the `PWD' variable does not
contain any symbolic links, as if `cd -P' had been executed.

19. If `$CDPATH' is set, the `cd' builtin will not implicitly append
19. If `CDPATH' is set, the `cd' builtin will not implicitly append
the current directory to it. This means that `cd' will fail if no
valid directory name can be constructed from any of the entries in
`$CDPATH', even if the a directory with the same name as the name
Expand All @@ -89,13 +91,41 @@ The following list is what's changed when `POSIX mode' is in effect:
23. Assignment statements preceding POSIX 1003.2 special builtins
persist in the shell environment after the builtin completes.

24. The `export' and `readonly' builtin commands display their output
24. 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.

25. The `export' and `readonly' builtin commands display their output
in the format required by POSIX 1003.2.

26. The `trap' builtin displays signal names without the leading `SIG'.

27. The `.' and `source' builtins do not search the current directory
for the filename argument if it is not found by searching `PATH'.

28. Subshells spawned to execute command substitutions inherit the
value of the `-e' option from the parent shell. When not in POSIX
mode, Bash clears the `-e' option in such subshells.

29. Alias expansion is always enabled, even in non-interactive shells.

30. When the `set' builtin is invoked without options, it does not
display shell function names and definitions.


There is other POSIX 1003.2 behavior that Bash does not implement.
Specifically:

1. Assignment statements affect the execution environment of all
builtins, not just special ones.

2. When a subshell is created to execute a shell script with execute
permission, but without a leading `#!', Bash sets `$0' to the full
pathname of the script as found by searching `$PATH', rather than
the command as typed by the user.

3. When using `.' to source a shell script found in `$PATH', bash
checks execute permission bits rather than read permission bits,
just as if it were searching for a command.


Loading

0 comments on commit 28ef6c3

Please sign in to comment.