Commit 2ddf5302 authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor

Import Upstream version 2.03

parent 6dbe139d
This diff is collapsed.
This document details the incompatibilites between this version of bash,
bash-2.01, and the previous widely-available version, bash-1.14. These
were discovered by alpha and beta testers, so they will likely be
encountered by a significant number of users.
bash-2.03, 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
string translation. Users who have relied on the (undocumented)
......@@ -63,9 +63,11 @@ encountered by a significant number of users.
"\C-\\": self-insert
6. A number of people complained above having to use ESC to terminate an
incremental search, and asked for an alternate mechanism. Bash-2.0
allows ^J to terminate the search without accepting the line. Use
^M to terminate the search and accept the line, as in bash-1.14.
incremental search, and asked for an alternate mechanism. Bash-2.03
uses the value of the settable readline variable `isearch-terminators'
to decide which characters should terminate an incremental search. If
that variable has not been set, ESC and Control-J will terminate a
search.
7. Some variables have been removed: MAIL_WARNING, notify, history_control,
command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
......@@ -101,3 +103,24 @@ encountered by a significant number of users.
alias ulimit="ulimit -S"
9. Bash-2.01 uses a new quoting syntax, $'...' to do ANSI-C string
translation. Backslash-escaped characters in ... are expanded and
replaced as specified by the ANSI C standard.
10. The sourcing of startup files has changed somewhat. This is explained
more completely in the INVOCATION section of the manual page.
A non-interactive shell not named `sh' and not in posix mode reads
and executes commands from the file named by $BASH_ENV. A
non-interactive shell started by `su' and not in posix mode will read
startup files. No other non-interactive shells read any startup files.
An interactive shell started in posix mode reads and executes commands
from the file named by $ENV.
11. The <> redirection operator was changed to conform to the POSIX.2 spec.
In the absence of any file descriptor specification preceding the `<>',
file descriptor 0 is used. In bash-1.14, this was the behavior only
when in POSIX mode. The bash-1.14 behavior may be obtained with
<>filename 1>&0
......@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......
......@@ -6,7 +6,7 @@ By chet:
SunOS 4.1.4
SunOS 5.5
BSDI BSD/OS 2.1
FreeBSD 2.1.7
FreeBSD 2.2
NetBSD 1.2
AIX 4.2
AIX 4.1.4
......
......@@ -21,11 +21,11 @@ The following list is what's changed when `POSIX mode' is in effect:
5. The POSIX.2 `PS1' and `PS2' expansions of `!' to the history
number and `!!' to `!' are enabled, and parameter expansion is
performed on the value regardless of the setting of the
`promptvars' option.
performed on the values of `PS1' and `PS2' regardless of the
setting of the `promptvars' option.
6. Interactive comments are enabled by default. (Note that Bash has
them on by default anyway.)
6. Interactive comments are enabled by default. (Bash has them on by
default anyway.)
7. The POSIX.2 startup files are executed (`$ENV') rather than the
normal Bash files.
......@@ -42,42 +42,51 @@ The following list is what's changed when `POSIX mode' is in effect:
11. Non-interactive shells exit if FILENAME in `.' FILENAME is not
found.
12. Redirection operators do not perform filename expansion on the word
12. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
13. Redirection operators do not perform filename expansion on the word
in the redirection unless the shell is interactive.
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 illegal
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
14. POSIX.2 `special' builtins are found before shell functions during
15. POSIX.2 `special' builtins are found before shell functions during
command lookup.
15. If a POSIX.2 special builtin returns an error status, a
16. If a POSIX.2 special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX.2 standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
16. If the `cd' builtin finds a directory to change to using
17. If the `cd' builtin finds a directory to change to using
`$CDPATH', the value it assigns to the `PWD' variable does not
contain any symbolic links, as if `cd -P' had been executed.
17. A non-interactive shell exits with an error status if a variable
18. 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
given as an argument to `cd' exists in the current directory.
19. 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 read-only variable.
trying to assign a value to a readonly variable.
18. A non-interactive shell exits with an error status if the iteration
20. 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 read-only variable.
`select' statement is a readonly variable.
19. Process substitution is not available.
21. Process substitution is not available.
20. Assignment statements preceding POSIX.2 `special' builtins persist
22. Assignment statements preceding POSIX.2 special builtins persist
in the shell environment after the builtin completes.
21. The `export' and `readonly' builtin commands display their output
23. The `export' and `readonly' builtin commands display their output
in the format required by POSIX.2.
......
......@@ -14,4 +14,7 @@ modification.
sh-redir-hack - diff to parse.y to get redirections before
compound commands
empty-for-wordlist - diff to parse.y to allow an empty wordlist after
the `in' keyword in a `for' statement
mh-folder-comp - diffs that reportedly add MH folder completion
This source diff could not be displayed because it is too large. You can view the blob instead.
This patch is from Brian Fox, in reply to an email message from
"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>, who wrote:
I think that bash should accept such a syntax:
for var in ; do command; done
Of course it should do nothing. It would simplify some scripts.
Here is a patch for those who wish it:
*** parse.y.~1~ Wed Mar 4 09:39:46 1998
--- parse.y Mon Jul 13 14:40:23 1998
***************
*** 495,500 ****
--- 495,504 ----
{ $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
| FOR WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}'
{ $$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9); }
+ | FOR WORD newline_list IN list_terminator newline_list DO compound_list DONE
+ { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); }
+ | FOR WORD newline_list IN list_terminator newline_list '{' compound_list '}'
+ { $$ = make_for_command ($2, (WORD_LIST *)NULL, $8); }
;
/*
* If necessary, link with lib/sh/libsh.a
*/
#include <stdio.h>
#include <errno.h>
extern char *strerror();
extern int sys_nerr;
int
main(c, v)
int c;
char **v;
{
int i, n;
if (c == 1) {
for (i = 1; i < sys_nerr; i++)
printf("%d --> %s\n", i, strerror(i));
} else {
for (i = 1; i < c; i++) {
n = atoi(v[i]);
printf("%d --> %s\n", n, strerror(n));
}
}
exit (0);
}
programming_error(a, b)
char *a;
int b;
{
}
fatal_error()
{
}
/*
* HPUX 10.x stubs to implement dl* in terms of shl*
*
* Not needed for later versions; HPUX 11.x has dlopen() and friends.
*
* configure also needs to be faked out. You can create a dummy libdl.a
* with stub entries for dlopen, dlclose, dlsym, and dlerror:
*
* int dlopen() { return(0);}
* int dlclose() { return(0);}
* int dlsym() { return(0);}
* int dlerror() { return(0);}
*
* This has not been tested; I just read the manual page and coded this up.
*
* According to the ld manual page, you need to link bash with -dld and add
* the -E flag to LOCAL_LDFLAGS.
*/
#if !defined (__HPUX10_DLFCN_H__)
#define __HPUX10_DLFCN_H__
#include <dl.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#define RTLD_LAZY BIND_DEFERRED
#define RTLD_NOW BIND_IMMEDIATE
#define RTLD_GLOBAL DYNAMIC_PATH
char *bash_global_sym_addr;
#define dlopen(file,mode) (void *)shl_load((file), (mode), 0L)
#define dlclose(handle) shl_unload((shl_t)(handle))
#define dlsym(handle,name) (bash_global_sym_addr=0,shl_findsym((shl_t *)&(handle),name,TYPE_UNDEFINED,&bash_global_sym_addr), (void *)bash_global_sym_addr)
#define dlerror() strerror(errno)
#endif /* __HPUX10_DLFCN_H__ */
......@@ -16,10 +16,10 @@ compiler output (useful mainly for debugging `configure'). If at some
point `config.cache' contains results you don't want to keep, you may
remove or edit it.
If you need to do unusual things to compile the package, please try to
figure out how `configure' could check whether or not to do them, and
mail diffs or instructions to `bash-maintainers@prep.ai.mit.edu' so
they can be considered for the next release.
If you need to do unusual things to compile Bash, please try to figure
out how `configure' could check whether or not to do them, and mail
diffs or instructions to <bash-maintainers@gnu.org> so they can be
considered for the next release.
The file `configure.in' is used to create `configure' by a program
called Autoconf. You only need `configure.in' if you want to change it
......@@ -115,17 +115,17 @@ than `/usr/local' by giving `configure' the option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
`PATH' as the prefix for installing programs and libraries.
give `configure' the option `--exec-prefix=PATH', `make install' will
use `PATH' as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
automatically, but needs to determine by the type of host Bash will run
on. Usually `configure' can figure that out, but if it prints a
message saying it can not guess the host type, give it the
`--host=TYPE' option. `TYPE' can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
`CPU-COMPANY-SYSTEM' (e.g., `sparc-sun-sunos4.1.2').
......@@ -177,12 +177,11 @@ Optional Features
=================
The Bash `configure' has a number of `--enable-FEATURE' options, where
FEATURE indicates an optional part of the package. There are also
several `--with-PACKAGE' options, where PACKAGE is something like
`gnu-malloc' or `purify' (for the Purify memory allocation checker). To
turn off the default use of a package, use `--without-PACKAGE'. To
configure Bash without a feature that is enabled by default, use
`--disable-FEATURE'.
FEATURE indicates an optional part of Bash. There are also several
`--with-PACKAGE' options, where PACKAGE is something like `gnu-malloc'
or `purify'. To turn off the default use of a package, use
`--without-PACKAGE'. To configure Bash without a feature that is
enabled by default, use `--disable-FEATURE'.
Here is a complete list of the `--enable-' and `--with-' options that
the Bash `configure' recognizes.
......@@ -197,17 +196,25 @@ the Bash `configure' recognizes.
`--with-glibc-malloc'
Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'.
This is somewhat slower than the default `malloc', but wastes
considerably less space.
This is not the version of `malloc' that appears in glibc version
2, but a modified version of the `malloc' from glibc version 1.
This is somewhat slower than the default `malloc', but wastes less
space on a per-allocation basis, and will return memory to the
operating system under some circumstances.
`--with-gnu-malloc'
Use the GNU version of `malloc' in `lib/malloc/malloc.c'. This is
not the same `malloc' that appears in GNU libc, but an older
version derived from the 4.2 BSD `malloc'. This `malloc' is very
fast, but wastes a lot of space. This option is enabled by
default. The `NOTES' file contains a list of systems for which
this should be turned off, and `configure' disables this option
automatically for a number of systems.
fast, but wastes some space on each allocation. This option is
enabled by default. The `NOTES' file contains a list of systems
for which this should be turned off, and `configure' disables this
option automatically for a number of systems.
`--with-installed-readline'
Define this to make bash link with a locally-installed version of
Readline rather than the version in lib/readline. This works only
with readline 4.0 and later versions.
`--with-purify'
Define this to use the Purify memory allocation checker from Pure
......@@ -217,6 +224,17 @@ the Bash `configure' recognizes.
This produces a shell with minimal features, close to the
historical Bourne shell.
There are several `--enable-' options that alter how Bash is compiled
and linked, rather than changing run-time features.
`--enable-profiling'
This builds a Bash binary that produces profiling information to be
processed by `gprof' each time it is executed.
`--enable-static-link'
This causes Bash to be linked statically, if `gcc' is being used.
This could be used to build a version to use as root's shell.
The `minimal-config' option can be used to disable all of the following
options, but it is processed first, so individual options may be
enabled using `enable-FEATURE'.
......@@ -227,16 +245,19 @@ does not provide the necessary support.
`--enable-alias'
Allow alias expansion and include the `alias' and `unalias'
builtins.
builtins (*note Aliases::.).
`--enable-array-variables'
Include support for one-dimensional array shell variables.
Include support for one-dimensional array shell variables (*note
Arrays::.).
`--enable-bang-history'
Include support for `csh'-like history substitution.
Include support for `csh'-like history substitution (*note History
Interaction::.).
`--enable-brace-expansion'
Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
See *Note Brace Expansion::, for a complete description.
`--enable-command-timing'
Include support for recognizing `time' as a reserved word and for
......@@ -244,9 +265,13 @@ does not provide the necessary support.
This allows pipelines as well as shell builtins and functions to
be timed.
`--enable-cond-command'
Include support for the `[[' conditional command (*note
Conditional Constructs::.).
`--enable-directory-stack'
Include support for a `csh'-like directory stack and the `pushd',
`popd', and `dirs' builtins.
`popd', and `dirs' builtins (*note The Directory Stack::.).
`--enable-disabled-builtins'
Allow builtin commands to be invoked via `builtin xxx' even after
......@@ -255,7 +280,12 @@ does not provide the necessary support.
commands.
`--enable-dparen-arithmetic'
Include support for the `ksh' `((...))' command.
Include support for the `((...))' command (*note Conditional
Constructs::.).
`--enable-extended-glob'
Include support for the extended pattern matching features
described above under *Note Pattern Matching::.
`--enable-help-builtin'
Include the `help' builtin, which displays help on shell builtins
......@@ -266,20 +296,22 @@ does not provide the necessary support.
commands.
`--enable-job-control'
This enables job control features, if the OS supports them.
This enables the job control features (*note Job Control::.), if
the operating system supports them.
`--enable-process-substitution'
This enables process substitution (*note Process Substitution::.)
if the OS provides the necessary support.
if the operating system provides the necessary support.
`--enable-prompt-string-decoding'
Turn on the interpretation of a number of backslash-escaped
characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt
strings.
strings. See *Note Printing a Prompt::, for a complete list of
prompt string escape sequences.
`--enable-readline'
Include support for command-line editing and history with the Bash
version of the Readline library.
version of the Readline library (*note Command Line Editing::.).
`--enable-restricted'
Include support for a "restricted shell". If this is enabled,
......@@ -287,8 +319,8 @@ does not provide the necessary support.
The Restricted Shell::, for a description of restricted mode.
`--enable-select'
Include the `ksh' `select' builtin, which allows the generation of
simple menus.
Include the `select' builtin, which allows the generation of simple
menus (*note Conditional Constructs::.).
`--enable-usg-echo-default'
Make the `echo' builtin expand backslash-escaped characters by
......
This diff is collapsed.
This diff is collapsed.
This is a terse description of the new features added to bash-2.03 since
the release of bash-2.02. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. New `shopt' option, `restricted_shell', indicating whether or not the
shell was started in restricted mode, for use in startup files.
b. Filename generation is now performed on the words between ( and ) in
array assignments (which it probably should have done all along).
c. OLDPWD is now auto-exported, as POSIX.2 seems to require.
d. ENV and BASH_ENV are read-only variables in a restricted shell.
e. A change was made to the startup file code so that any shell begun with
the `--login' option, even non-interactive shells, will source the login
shell startup files.
2. New Features in Readline
a. Many changes to the signal handling:
o Readline now catches SIGQUIT and cleans up the tty before returning;
o A new variable, rl_catch_signals, is available to application writers
to indicate to readline whether or not it should install its own
signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
SIGTTIN, and SIGTTOU;
o A new variable, rl_catch_sigwinch, is available to application
writers to indicate to readline whether or not it should install its
own signal handler for SIGWINCH, which will chain to the calling
applications's SIGWINCH handler, if one is installed;
o There is a new function, rl_free_line_state, for application signal
handlers to call to free up the state associated with the current
line after receiving a signal;
o There is a new function, rl_cleanup_after_signal, to clean up the
display and terminal state after receiving a signal;
o There is a new function, rl_reset_after_signal, to reinitialize the
terminal and display state after an application signal handler
returns and readline continues
b. There is a new function, rl_resize_terminal, to reset readline's idea of
the screen size after a SIGWINCH.
c. New public functions: rl_save_prompt and rl_restore_prompt. These were
previously private functions with a `_' prefix.
d. New function hook: rl_pre_input_hook, called just before readline starts
reading input, after initialization.
e. New function hook: rl_display_matches_hook, called when readline would
display the list of completion matches. The new function
rl_display_match_list is what readline uses internally, and is available
for use by application functions called via this hook.
f. New bindable function, delete-char-or-list, like tcsh.
g. A new variable, rl_erase_empty_line, which, if set by an application using
readline, will cause readline to erase, prompt and all, lines on which the
only thing typed was a newline.
h. New bindable variable: `isearch-terminators'.
i. New bindable function: `forward-backward-delete-char' (unbound by default).
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-2.02 since
the release of bash-2.01.1. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. A new version of malloc, based on the older GNU malloc, that has many
changes, is more page-based, is more conservative with memory usage,
and does not `orphan' large blocks when they are freed.
b. A new version of gmalloc, based on the old GLIBC malloc, with many
changes and range checking included by default.
c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
Regular Expression matching, including character classes, collating
symbols, equivalence classes, and support for case-insensitive pattern
matching.
d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
implemented, controlled by a new `shopt' option, `extglob'.
e. There is a new ksh-like `[[' compound command, which implements
extended `test' functionality.
f. There is a new `printf' builtin, implemented according to the POSIX.2
specification.
g. There is a new feature for command substitution: $(< filename) now expands
to the contents of `filename', with any trailing newlines removed
(equivalent to $(cat filename)).
h. There are new tilde prefixes which expand to directories from the
directory stack.
i. There is a new `**' arithmetic operator to do exponentiation.
j. There are new configuration options to control how bash is linked:
`--enable-profiling', to allow bash to be profiled with gprof, and
`--enable-static-link', to allow bash to be linked statically.
k. There is a new configuration option, `--enable-cond-command', which
controls whether or not the `[[' command is included. It is on by
default.
l. There is a new configuration option, `--enable-extended-glob', which
controls whether or not the ksh extended globbing feature is included.
It is enabled by default.
m. There is a new configuration #define in config.h.top that, when enabled,
will cause all login shells to source /etc/profile and one of the user-
specific login shell startup files, whether or not the shell is
interactive.
n. There is a new invocation option, `--dump-po-strings', to dump
a shell script's translatable strings ($"...") in GNU `po' format.
o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
pattern matching when globbing filenames and using the `case' construct.
p. There is a new `shopt' option, `huponexit', which, when enabled, causes
the shell to send SIGHUP to all jobs when an interactive login shell
exits.
q. `bind' has a new `-u' option, which takes a readline function name as an
argument and unbinds all key sequences bound to that function in a
specified keymap.
r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
and running jobs, respectively.
s. The `shopt' `-p' option now causes output to be displayed in a reusable
format.
t. `test' has a new `-N' option, which returns true if the filename argument