Commit 60f42358 authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor

Import Upstream version 1.14.7

This diff is collapsed.
The version of bash in this directory has been compiled on the
following systems:
Sun 690 SunOS 4.1.2
Sparcstation SunOS 5.3
Sparcstation NetBSD 0.9a
386 BSDI BSD/386 1.0, 1.1
NeXTstation NeXT OS 2.1
Motorola Delta 88K SVR3.2
Decstation 3100 Ultrix 4.3
Dec 4000 Alpha AXP DEC OSF/1 V1.3
386 ISC UNIX 3.0.1
386 FreeBSD 1.1
IBM RS/6000 AIX 3.2
Amiga Amiga UNIX 2.1
HP 9000/834 HP/UX 7.0
Starting bash with the `-posix' command-line option or setting the variable
POSIXLY_CORRECT while bash is running will cause bash to conform more
closely to the Posix.2 standard by changing the behavior to match that
specified by Posix.2 in areas where the bash default differs.
The following list is what's changed when `posixly_correct' is enabled:
1. When a command in the hash table no longer exists, bash will re-search
$PATH to find the new location.
2. The >& redirection does not redirect stdout and stderr.
3. The message printed by the job control code and builtins when a job
exits with a non-zero status is `Done(status)'.
4. The <> redirection does not open a file for both stdin and stdout, but
rather opens it for read-write on fd 0.
5. Reserved words may not be aliased.
6. The Posix.2 PS1 and PS2 expansions of `!' -> history number and `!!' -> `!'
are enabled.
7. Interactive comments are enabled by default. (Note that this version has
them on by default anyway.)
8. The Posix.2 startup files are executed ($ENV) rather than the normal bash
9. 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 (default value of $HISTFILE).
11. The output of `kill -l' prints all the signal names on a single line,
separated by spaces.
12. Non-interactive shells exit if `file' in `. file' is not found.
13. Redirection operators do not perform pathname expansion on the word
in the redirection unless the shell is interactive
14. Function names must be valid shell identifiers. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit
There is other Posix.2 behavior that bash does not implement. Specifically:
1. There are no `special builtins' and `regular builtins'. All builtins
are equivalent. This means that:
o assignment statements affect the execution environment of all
builtins, not just special ones
o temporary assignments do not persist after Posix.2 special
builtins complete
o Functions are found before Posix.2 special builtins
o The shell does not exit upon errors while executing Posix.2
special builtins
2. $LINENO does not represent the line number of a command within a function
3. The arithmetic evaluator does not implement the `e ? e1 : e2' conditional
ISC 386 machines must compile test.c without -O. The resultant shell dumps
core when test is invoked.
There have been reports that SCO 3.2v4.2 requires -DPRGP_PIPE in SCO_CFLAGS,
and that it has too many -D defines for SCO's cc (rcc works).
Contents of this directory:
CWRU.chlog - my change log since the last release
KSH.README - list of similarities with ksh. Slightly out of date
PLATFORMS.113 - list of platforms I have built this release on
POSIX.NOTES - list of what changes for `posix mode'
README - this file
RSH.README - explanation of the bash `restricted shell' mode
misc - directory with some useful tools
OS-BUGS - directory with messages detailing some OS bugs and
the bash workarounds
This diff is collapsed.
/* ************************ */
/* */
/* A/UX 3.0 System */
/* */
/* ************************ */
#if defined (mc68k32) && !defined (M_MACHINE)
# define M_MACHINE "Macintosh"
# define M_OS "AUX"
# define HAVE_DIRENT
#endif /* A/UX */
#! /bin/sh
if [ "$1" = '-y' ]; then
exec /usr/bin/yacc ${1+"$@"}
#include <sys/types.h>
#include <fcntl.h>
#include <sys/file.h>
#include <stdio.h>
register int i;
for (i = 0; i < getdtablesize(); i++) {
if (fcntl(i, F_GETFD, 0) != -1)
fprintf(stderr, "fd %d: open\n", i);
#include <stdio.h>
fprintf(stderr, "%d\n", getpid());
#include <signal.h>
#include <stdio.h>
extern char *sys_siglist[];
typedef void sighandler();
main(argc, argv)
int argc;
char **argv;
register int i;
sighandler *h;
for (i = 1; i < NSIG; i++) {
h = signal(i, SIG_DFL);
if (h != SIG_DFL) {
if (h == SIG_IGN)
fprintf(stderr, "%d: ignored (%s)\n", i, sys_siglist[i]);
fprintf(stderr, "%d: caught (%s)\n", i, sys_siglist[i]);
* sigstat - print out useful information about signal arguments
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
extern char *strrchr();
static char *signames[NSIG];
char *progname;
void sigstat();
main(argc, argv)
int argc;
char **argv;
register int i;
char *t;
if (t = strrchr(argv[0], '/'))
progname = ++t;
progname = argv[0];
if (argc == 1) {
for (i = 1; i < NSIG; i++)
for (i = 1; i < argc; i++)
int sig;
struct sigaction oact;
char *signame;
sigset_t set, oset;
int blocked;
if (sig < 0 || sig >= NSIG) {
fprintf(stderr, "%s: %d: signal out of range\n", progname, sig);
signame = signames[sig];
sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
if (sigismember(&oset, sig))
printf("%s: signal is blocked\n", signame);
sigaction(sig, (struct sigaction *)NULL, &oact);
if (oact.sa_handler == SIG_IGN)
printf("%s: signal is ignored\n", signame);
else if (oact.sa_handler == SIG_DFL)
printf("%s: signal is defaulted\n", signame);
printf("%s: signal is trapped (?)\n", signame);
register int i;
bzero(signames, sizeof(signames));
#if defined (SIGHUP) /* hangup */
signames[SIGHUP] = "SIGHUP";
#if defined (SIGINT) /* interrupt */
signames[SIGINT] = "SIGINT";
#if defined (SIGQUIT) /* quit */
signames[SIGQUIT] = "SIGQUIT";
#if defined (SIGILL) /* illegal instruction (not reset when caught) */
signames[SIGILL] = "SIGILL";
#if defined (SIGTRAP) /* trace trap (not reset when caught) */
signames[SIGTRAP] = "SIGTRAP";
#if defined (SIGABRT) /* */
signames[SIGABRT] = "SIGABRT";
#if defined (SIGIOT) /* IOT instruction */
signames[SIGIOT] = "SIGIOT";
#if defined (SIGEMT) /* EMT instruction */
signames[SIGEMT] = "SIGEMT";
#if defined (SIGFPE) /* floating point exception */
signames[SIGFPE] = "SIGFPE";
#if defined (SIGKILL) /* kill (cannot be caught or ignored) */
signames[SIGKILL] = "SIGKILL";
#if defined (SIGBUS) /* bus error */
signames[SIGBUS] = "SIGBUS";
#if defined (SIGSEGV) /* segmentation violation */
signames[SIGSEGV] = "SIGSEGV";
#if defined (SIGSYS) /* bad argument to system call */
signames[SIGSYS] = "SIGSYS";
#if defined (SIGPIPE) /* write on a pipe with no one to read it */
signames[SIGPIPE] = "SIGPIPE";
#if defined (SIGALRM) /* alarm clock */
signames[SIGALRM] = "SIGALRM";
#if defined (SIGTERM) /* software termination signal from kill */
signames[SIGTERM] = "SIGTERM";
#if defined (SIGCLD) /* Like SIGCHLD. */
signames[SIGCLD] = "SIGCLD";
#if defined (SIGPWR) /* Magic thing for some machines. */
signames[SIGPWR] = "SIGPWR";
#if defined (SIGPOLL) /* For keyboard input? */
signames[SIGPOLL] = "SIGPOLL";
#if defined (SIGURG) /* urgent condition on IO channel */
signames[SIGURG] = "SIGURG";
#if defined (SIGSTOP) /* sendable stop signal not from tty */
signames[SIGSTOP] = "SIGSTOP";
#if defined (SIGTSTP) /* stop signal from tty */
signames[SIGTSTP] = "SIGTSTP";
#if defined (SIGCONT) /* continue a stopped process */
signames[SIGCONT] = "SIGCONT";
#if defined (SIGCHLD) /* to parent on child stop or exit */
signames[SIGCHLD] = "SIGCHLD";
#if defined (SIGTTIN) /* to readers pgrp upon background tty read */
signames[SIGTTIN] = "SIGTTIN";
#if defined (SIGTTOU) /* like TTIN for output if (tp->t_local&LTOSTOP) */
signames[SIGTTOU] = "SIGTTOU";
#if defined (SIGIO) /* input/output possible signal */
signames[SIGIO] = "SIGIO";
#if defined (SIGXCPU) /* exceeded CPU time limit */
signames[SIGXCPU] = "SIGXCPU";
#if defined (SIGXFSZ) /* exceeded file size limit */
signames[SIGXFSZ] = "SIGXFSZ";
#if defined (SIGVTALRM) /* virtual time alarm */
#if defined (SIGPROF) /* profiling time alarm */
signames[SIGPROF] = "SIGPROF";
#if defined (SIGWINCH) /* window changed */
signames[SIGWINCH] = "SIGWINCH";
#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
signames[SIGLOST] = "SIGLOST";
#if defined (SIGUSR1) /* user defined signal 1 */
signames[SIGUSR1] = "SIGUSR1";
#if defined (SIGUSR2) /* user defined signal 2 */
signames[SIGUSR2] = "SIGUSR2";
#if defined (SIGMSG) /* HFT input data pending */
signames[SIGMSG] = "SIGMSG";
#if defined (SIGPWR) /* power failure imminent (save your data) */
signames[SIGPWR] = "SIGPWR";
#if defined (SIGDANGER) /* system crash imminent */
#if defined (SIGMIGRATE) /* migrate process to another CPU */
#if defined (SIGPRE) /* programming error */
signames[SIGPRE] = "SIGPRE";
#if defined (SIGGRANT) /* HFT monitor mode granted */
signames[SIGGRANT] = "SIGGRANT";
#if defined (SIGRETRACT) /* HFT monitor mode retracted */
#if defined (SIGSOUND) /* HFT sound sequence has completed */
signames[SIGSOUND] = "SIGSOUND";
for (i = 0; i < NSIG; i++)
if (signames[i] == (char *)NULL) {
signames[i] = (char *)malloc (16);;
sprintf (signames[i], "signal %d", i);
Add to `subshell' production in parse.y and recompile -DREDIRECTION_HACK to
get `< xx (command)' sh compatibility.
| redirections '(' list ')'
#if defined (REDIRECTION_HACK)
/* XXX - C News sh compatibility hack - XXX */
$3->redirects = $1;
$3->flags |= CMD_WANT_SUBSHELL;
$$ = $3;
yyerror ();
File:, Node: Install, Next: Invoke, Prev: Built-in, Up: Top
Installing BASH
To install BASH you simply type `make'. The BASH `Makefile' tries
to dynamically figure out what kind of machine and operating system
you are using. It makes an educated guess based on the information
it finds.
During the `make' process, a message is displayed describing what
machine and operating system has been chosen for you. This
information is also saved in the file `.machine' so you can look at
it later.
Therefore, for most machines, simply follow this simple checklist
to install BASH:
1. Type `make'. If you want to use GCC to compile bash, type
`make CC=gcc CPPNAME='$(CC) -E''.
2. Wait for the compilation to finish.
3. Type `./bash' to see if the compile worked.
4. Type `make install prefix=/usr/gnu/' (or the appropriate root
of your local GNU software installation tree) to copy bash to
your binaries directory, assumed to be ${prefix}/bin. This will
also attempt to install the manual pages under ${prefix}/man
and the info file under ${prefix}/info.
* Menu:
* Problems:: What to do if BASH doesn't install quite so easily.
* Files:: Files used in the `make' process.
* Porting:: Porting BASH to a new machine.
* Bugs:: What to do if you Discover Bugs in BASH.
File:, Node: Problems, Next: Files, Prev: Install, Up: Install
What if it Doesn't Install so Easily?
Sometimes BASH gets confused and will make the wrong assumptions
about your machine or operating system. If the displayed
information (also found in `.machine') is incorrect, you will have
to edit the file `machines.h' and provide the appropriate
information so that BASH can be installed correctly. The complete
instructions for doing this are located in the `machines.h' file.
However, if BASH says that your machine type is an
"UNKNOWN_MACHINE", or BASH thought it knew something about your
machine but was wrong, then reading the next few sections could
be of use to you (*note Files::., and *note Porting::., for more
On the MIPSEB with the BSD universe, you must:
1) Place /bsd43/bin in your PATH before /bin
2) Use $(CC) -E instead of /lib/cpp to build cpp-Makefile.
On SCO Xenix 386, you must:
1) Use $(CC) -E instead of /lib/cpp to build cpp-Makefile.
On Interactive Unix version 3 or 4, you must:
1) Edit cpp-Makefile to remove either -O or -g from DEBUG_FLAGS
File:, Node: Files, Next: Porting, Prev: Problems, Up: Install
Files Used in the `make' Process.
The following files are used during the installation of BASH, in
the `make' process:
This is responsible for making the actual `Makefile' that is
used to create Bash. It runs the C preprocessor (usually
located in `/lib/cpp') on the file `cpp-Makefile', producing
the output file `bash-Makefile'.
This is a file of C comments and text. It contains a
reasonable number of `ifdefs' which control what files get
compiled and which flags are passed to the various C files
comprising BASH. It includes files named `machines.h',
`sysdefs.h', and `config.h'.
This file contains the basic compilation parameters for all of
the machines to which BASH has been ported. This file
consists of a series of conditional blocks, one per machine
These conditional blocks are depend upon the unique identifier
that `cpp' has predefined for this machine. In some cases,
additional information can be passed from `Makefile'. It is
possible to pass information such as whether or not a
particular file is available on this system, and so on.
This file is dynamically made at build time by running the shell
script `support/mksydefs'. If there appears to be something wrong
in this file, then edit the `mksysdefs' script, and mail the
changes that you make to
This is the output from the initial stage of `make'. It is a
stripped down version of `cpp-Makefile' which is tailor-made
for your machine and operating system. All subsequent `makes'
use this file.
File:, Node: Porting, Next: Bugs, Prev: Files, Up: Install
What if You Have to Port to a New Machine?
Sometimes you may want to port BASH to a new, previously
unsupported machine. To do so you need to create a block in
`machines.h' which is conditional based on a unique identifier
present in your version of the C preprocessor.
If you don't know what that symbol is, you might try the following
simple test:
echo "main () { }" > foo.c
cc -v foo.c
You are looking for `-DMACHINE', where `MACHINE' is an identifier
for your machine. If you are very unlucky and your machine's C
preprocessor doesn't have a unique identifier, you will have to
define the identifier in Makefile manually.
Let's say you have a machine from Yoyodyne Industries, called the
YoYo. It runs a version of BSD, so it is reasonably compatible.
However, the `cpp' on this YoYo machine doesn't define any unique
identifiers. You should change the `Makefile' line for `CPPFLAGS'
Then, in `machines.h', you copy the block for `UNKNOWN_MACHINE',
and change the conditional to;
#if defined (YoYo)
Inside of the YoYo block you define `M_MACHINE="YoYo"', and
`M_OS=Bsd'. You also modify the existing defines to match your
machine's software.
If BASH still won't compile, perhaps because of missing code that
is required for your YoYo machine, you will have to write that code
and place it within a conditional block based on YoYo.
Most machines aren't that difficult; simply redefining a few of the
default values is sufficient. If you do run across a difficult
machine, please send all fixes and changes to in the form of context diffs: