commit bash-20040525 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 12:57:50 -05:00
parent f085a21f5f
commit 61deeb1329
28 changed files with 1683 additions and 1377 deletions
+11
View File
@@ -45,6 +45,13 @@ m. Fixed a few problems with `cd' and `pwd' when asked to operate on pathnames
n. Fixed a memory leak caused when creating multiple local array variables
with identical names.
o. Fixed a problem with calls to getcwd() so that bash now operates better
when the full pathname to the current directory is longer than PATH_MAX
bytes.
p. The `trap' builtin now reports an error if a single non-signal argument
is specified.
2. Changes to Readline
a. Fixed a problem that could cause readline to refer to freed memory when
@@ -67,6 +74,10 @@ e. Fixed a problem in vi-mode that caused the last text modification command
a. The `jobs', `kill', and `wait' builtins now accept job control notation
even if job control is not enabled.
b. The historical behavior of `trap' that allows a missing `action' argument
to cause each specified signal's handling to be reset to its default is
now only supported when `trap' is given a single non-option argument.
------------------------------------------------------------------------------
This document details the changes between this version, bash-3.0-beta1,
and the previous version, bash-3.0-alpha.
+32
View File
@@ -9458,3 +9458,35 @@ aclocal.m4
- change BASH_FUNC_GETCWD to check whether or not getcwd(0,0) will
allocate memory for the returned value -- nobody implements that
and getcwd-via-popen, so it should capture the old test as well
5/27
----
builtins/trap.def
- the historical behavior of assuming that a signal's handling should
be set to its original disposition is only in effect if a single
argument is given, otherwise the first argument is assumed to be a
command to execute
- when in posix mode, if trap gets a single argument, display an
error message and return EX_USAGE
- change the help message and usage string to better explain trap's
behavior
doc/{bash.1,bashref.texi}
- describe the new default behavior when the first argument is a
signal spec
- note that signal names are case insensitive and the SIG prefix is
optional in arguments to `trap'
- note that signal name arguments to `kill' are case-insensitive
lib/readline/display.c
- make sure rl_on_new_line_with_prompt sets rl_display_prompt to
rl_prompt (just to make sure it's set)
- have rl_on_new_line_with_prompt use local_prompt if it's set
6/2
---
subst.c
- in string_extract_double_quoted, cope with extract_delimited_string
returning NULL, as it can when attempting completion on an unclosed
command substitution
+32 -2
View File
@@ -9452,9 +9452,39 @@ lib/readline/text.c
----
builtins/common.c
- use getcwd(0,0) rather than providing a fixed pathname with a fixed
length (PATH_MAX)
length (PATH_MAX) so getcwd() will allocate sufficient memory
aclocal.m4
- change BASH_FUNC_GETCWD to check whether or not getcwd(0,0) will
allocate memory for the returned value -- nobody implements that
and getcwd-via-popen
and getcwd-via-popen, so it should capture the old test as well
5/27
----
builtins/trap.def
- the historical behavior of assuming that a signal's handling should
be set to its original disposition is only in effect if a single
argument is given, otherwise the first argument is assumed to be a
command to execute
- when in posix mode, if trap gets a single argument, display an
error message and return EX_USAGE
- change the help message and usage string to better explain trap's
behavior
doc/{bash.1,bashref.texi}
- describe the new default behavior when the first argument is a
signal spec
- note that signal names are case insensitive and the SIG prefix is
optional in arguments to `trap'
- note that signal name arguments to `kill' are case-insensitive
lib/readline/display.c
- make sure rl_on_new_line_with_prompt sets rl_display_prompt to
rl_prompt (just to make sure it's set)
- have rl_on_new_line_with_prompt use local_prompt if it's set
6/2
---
subst.c
- in
+4
View File
@@ -140,6 +140,10 @@ oo. Fixed a bug in the `shift' builtin that could cause core dumps when
pp. The `jobs', `kill', and `wait' builtins now accept job control notation
even if job control is not enabled.
qq. The historical behavior of `trap' that allows a missing `action' argument
to cause each specified signal's handling to be reset to its default is
now only supported when `trap' is given a single non-option argument.
2. New Features in Readline
a. History expansion has a new `a' modifier equivalent to the `g' modifier
+44
View File
@@ -115,6 +115,31 @@ gg. New `set -o pipefail' option that causes a pipeline to return a failure
status if any of the processes in the pipeline fail, not just the last
one.
hh. printf builtin understands two new escape sequences: \" and \?.
ii. `echo -e' understands two new escape sequences: \" and \?.
jj. The GNU `gettext' package and libintl have been integrated; the shell's
messages can be translated into different languages.
kk. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.
ll. The error message printed when bash cannot open a shell script supplied
as argument 1 now includes the name of the shell, to better identify
the error as coming from bash.
mm. A bug that caused here documents to not work if the directory the shell
used for the temporary files was not writable has been fixed.
nn. The parameter pattern removal and substitution expansions are now much
faster and more efficient when using multibyte characters.
oo. Fixed a bug in the `shift' builtin that could cause core dumps when
reporting an out-of-range argument.
pp. The `jobs', `kill', and `wait' builtins now accept job control notation
even if job control is not enabled.
2. New Features in Readline
a. History expansion has a new `a' modifier equivalent to the `g' modifier
@@ -146,6 +171,25 @@ h. Four new key binding functions have been added:
rl_bind_keyseq_if_unbound()
rl_bind_keyseq_if_unbound_in_map()
i. New application variable, rl_completion_quote_character, set to any
quote character readline finds before it calls the application completion
function.
j. New application variable, rl_completion_suppress_quote, settable by an
application completion function. If set to non-zero, readline does not
attempt to append a closing quote to a completed word.
k. New application variable, rl_completion_found_quote, set to a non-zero
value if readline determines that the word to be completed is quoted.
Set before readline calls any application completion function.
l. New function hook, rl_completion_word_break_hook, called when readline
needs to break a line into words when completion is attempted. Allows
the word break characters to vary based on position in the line.
m. New bindable command: unix-filename-rubout. Does the same thing as
unix-word-rubout, but adds `/' to the set of word delimiters.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-2.05b since
the release of bash-2.05a. As always, the manual page (doc/bash.1) is
+84 -84
View File
@@ -15,96 +15,96 @@
'configure.in'
],
{
'AC_CONFIG_SUBDIRS' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_HEADER_STAT' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_STRUCT_TM' => 1,
'm4_pattern_allow' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_PROG_INSTALL' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_CHECK_LIB' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_PROG_CC' => 1,
'AC_TYPE_PID_T' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_CHECK_TYPES' => 1,
'AC_C_CONST' => 1,
'AC_FUNC_STAT' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_PROG_INSTALL' => 1,
'AH_OUTPUT' => 1,
'AC_HEADER_TIME' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_PROG_AWK' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_HEADER_STDC' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_PROG_CPP' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_SUBST' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_CONFIG_HEADERS' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_INIT' => 1,
'm4_pattern_allow' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_FUNC_STRERROR_R' => 1,
'm4_include' => 1,
'AC_PROG_LN_S' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_PATH_X' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_REALLOC' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_C_INLINE' => 1,
'AC_PROG_RANLIB' => 1,
'AC_FUNC_STAT' => 1,
'AC_CHECK_FUNCS' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_PROG_CC' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_CONFIG_FILES' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_FUNC_ALLOCA' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_CONDITIONAL' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_CHECK_TYPES' => 1,
'AC_PROG_LEX' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_PROG_YACC' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_CHECK_LIB' => 1,
'AC_LIBSOURCE' => 1,
'AC_FUNC_STRNLEN' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_PROG_CXX' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_HEADER_TIME' => 1,
'AC_FUNC_MMAP' => 1,
'AC_TYPE_PID_T' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_HEADER_STAT' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_C_VOLATILE' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_TYPE_UID_T' => 1,
'AC_FUNC_GETPGRP' => 1,
'm4_include' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_FUNC_MMAP' => 1,
'AC_C_INLINE' => 1,
'AC_CONFIG_FILES' => 1,
'AC_C_VOLATILE' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_PROG_LN_S' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_LIBSOURCE' => 1,
'AC_PROG_CXX' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'm4_pattern_forbid' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_INIT' => 1,
'AC_PATH_X' => 1,
'AC_PROG_YACC' => 1,
'AC_PROG_LEX' => 1,
'AC_PROG_CPP' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_CHECK_FUNCS' => 1,
'include' => 1,
'AC_PROG_AWK' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_HEADER_STDC' => 1,
'AC_PROG_RANLIB' => 1,
'AC_FUNC_OBSTACK' => 1,
'AM_CONDITIONAL' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_FORK' => 1,
'AC_FUNC_STRERROR_R' => 1
'AC_STRUCT_TM' => 1,
'AC_C_CONST' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'm4_pattern_forbid' => 1,
'AC_CANONICAL_HOST' => 1,
'include' => 1
}
], 'Request' )
);
+21 -15
View File
@@ -23,20 +23,21 @@ $PRODUCES trap.c
$BUILTIN trap
$FUNCTION trap_builtin
$SHORT_DOC trap [arg] [signal_spec ...] or trap -l
$SHORT_DOC trap [-lp] [[arg] signal_spec ...]
The command ARG is to be read and executed when the shell receives
signal(s) SIGNAL_SPEC. If ARG is absent all specified signals are
reset to their original values. If ARG is the null string each
SIGNAL_SPEC is ignored by the shell and by the commands it invokes.
If a SIGNAL_SPEC is EXIT (0) the command ARG is executed on exit from
the shell. If a SIGNAL_SPEC is DEBUG, ARG is executed after every
command. If ARG is `-p' then the trap commands associated with
each SIGNAL_SPEC are displayed. If no arguments are supplied or if
only `-p' is given, trap prints the list of commands associated with
each signal number. Each SIGNAL_SPEC is either a signal name in <signal.h>
or a signal number. `trap -l' prints a list of signal names and their
corresponding numbers. Note that a signal can be sent to the shell
with "kill -signal $$".
signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC
is supplied) or `-', each specified signal is reset to its original
value. If ARG is the null string each SIGNAL_SPEC is ignored by the
shell and by the commands it invokes. If a SIGNAL_SPEC is EXIT (0)
the command ARG is executed on exit from the shell. If a SIGNAL_SPEC
is DEBUG, ARG is executed after every simple command. If the`-p' option
is supplied then the trap commands associated with each SIGNAL_SPEC are
displayed. If no arguments are supplied or if only `-p' is given, trap
prints the list of commands associated with each signal. Each SIGNAL_SPEC
is either a signal name in <signal.h> or a signal number. Signal names
are case insensitive and the SIG prefix is optional. `trap -l' prints
a list of signal names and their corresponding numbers. Note that a
signal can be sent to the shell with "kill -signal $$".
$END
#include <config.h>
@@ -126,12 +127,17 @@ trap_builtin (list)
signal handling disposition, use `-' as the first argument. */
if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg, opt))
signal_object_p (first_arg, opt) && list->next == 0)
operation = REVERT;
else
{
list = list->next;
if (*first_arg == '\0')
if (list == 0)
{
builtin_usage ();
return (EX_USAGE);
}
else if (*first_arg == '\0')
operation = IGNORE;
else if (first_arg[0] == '-' && !first_arg[1])
operation = REVERT;
+23 -17
View File
@@ -1,7 +1,7 @@
This file is trap.def, from which is created trap.c.
It implements the builtin "trap" in Bash.
Copyright (C) 1987-2002 Free Software Foundation, Inc.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -23,20 +23,21 @@ $PRODUCES trap.c
$BUILTIN trap
$FUNCTION trap_builtin
$SHORT_DOC trap [arg] [signal_spec ...] or trap -l
$SHORT_DOC trap [-lp] [[arg] signal_spec ]
The command ARG is to be read and executed when the shell receives
signal(s) SIGNAL_SPEC. If ARG is absent all specified signals are
reset to their original values. If ARG is the null string each
SIGNAL_SPEC is ignored by the shell and by the commands it invokes.
If a SIGNAL_SPEC is EXIT (0) the command ARG is executed on exit from
the shell. If a SIGNAL_SPEC is DEBUG, ARG is executed after every
command. If ARG is `-p' then the trap commands associated with
each SIGNAL_SPEC are displayed. If no arguments are supplied or if
only `-p' is given, trap prints the list of commands associated with
each signal number. Each SIGNAL_SPEC is either a signal name in <signal.h>
or a signal number. `trap -l' prints a list of signal names and their
corresponding numbers. Note that a signal can be sent to the shell
with "kill -signal $$".
signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC
is supplied) or `-', each specified signal is reset to its original
value. If ARG is the null string each SIGNAL_SPEC is ignored by the
shell and by the commands it invokes. If a SIGNAL_SPEC is EXIT (0)
the command ARG is executed on exit from the shell. If a SIGNAL_SPEC
is DEBUG, ARG is executed after every simple command. If the`-p' option
is supplied then the trap commands associated with each SIGNAL_SPEC are
displayed. If no arguments are supplied or if only `-p' is given, trap
prints the list of commands associated with each signal. Each SIGNAL_SPEC
is either a signal name in <signal.h> or a signal number. Signal names
are case insensitive and the SIG prefix is optional. `trap -l' prints
a list of signal names and their corresponding numbers. Note that a
signal can be sent to the shell with "kill -signal $$".
$END
#include <config.h>
@@ -121,17 +122,22 @@ trap_builtin (list)
operation = SET;
first_arg = list->word->word;
/* When not in posix mode, the historical behavior of looking for a
/* When in posix mode, the historical behavior of looking for a
missing first argument is disabled. To revert to the original
signal handling disposition, use `-' as the first argument. */
if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
signal_object_p (first_arg, opt))
signal_object_p (first_arg, opt) && list->next == 0)
operation = REVERT;
else
{
list = list->next;
if (*first_arg == '\0')
if (list == 0)
{
builtin_usage ();
return (EX_USAGE);
}
else if (*first_arg == '\0')
operation = IGNORE;
else if (first_arg[0] == '-' && !first_arg[1])
operation = REVERT;
+1184 -1184
View File
File diff suppressed because it is too large Load Diff
+23 -16
View File
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
.\" Last Change: Tue Apr 20 13:39:08 EDT 2004
.\" Last Change: Thu May 27 21:40:47 EDT 2004
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2004 Apr 20" "GNU Bash-3.0"
.TH BASH 1 "2004 May 27" "GNU Bash-3.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1871,6 +1871,12 @@ displays during an execution trace. The first character of
is replicated multiple times, as necessary, to indicate multiple
levels of indirection. The default is ``\fB+ \fP''.
.TP
.B SHELL
The full pathname to the shell is kept in this environment variable.
If it is not set when the shell starts,
.B bash
assigns to it the full pathname of the current user's login shell.
.TP
.B TIMEFORMAT
The value of this parameter is used as a format string specifying
how the timing information for pipelines prefixed with the
@@ -7083,18 +7089,15 @@ to the processes named by
or
.IR jobspec .
.I sigspec
is either a signal name such as
is either a case-insensitive signal name such as
.SM
.B SIGKILL
or a signal number;
.I signum
is a signal number. If
.I sigspec
is a signal name, the name may be
given with or without the
(with or without the
.SM
.B SIG
prefix.
prefix) or a signal number;
.I signum
is a signal number.
If
.I sigspec
is not present, then
@@ -8170,7 +8173,7 @@ using the rules listed above.
Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
.TP
\fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP ...]
\fBtrap\fP [\fB\-lp\fP] [[\fIarg\fP] \fIsigspec\fP ...]
The command
.I arg
is to be read and executed when the shell receives
@@ -8178,10 +8181,10 @@ signal(s)
.IR sigspec .
If
.I arg
is absent or
is absent (and there is a single \fIsigspec\fP) or
.BR \- ,
all specified signals are
reset to their original values (the values they had
each specified signal is
reset to its original disposition (the value it had
upon entrance to the shell).
If
.I arg
@@ -8199,7 +8202,7 @@ If no arguments are supplied or if only
.B \-p
is given,
.B trap
prints the list of commands associated with each signal number.
prints the list of commands associated with each signal.
The
.B \-l
option causes the shell to print a list of signal names and
@@ -8208,6 +8211,7 @@ Each
.I sigspec
is either
a signal name defined in <\fIsignal.h\fP>, or a signal number.
Signal names are case insensitive and the SIG prefix is optional.
If a
.I sigspec
is
@@ -8601,10 +8605,13 @@ turning off restricted mode with
.PP
These restrictions are enforced after any startup files are read.
.PP
When a command that is found to be a shell script is executed (see
.ie \n(zY=1 When a command that is found to be a shell script is executed,
.el \{ When a command that is found to be a shell script is executed
(see
.SM
.B "COMMAND EXECUTION"
above),
\}
.B rbash
turns off any restrictions in the shell spawned to execute the
script.
+38 -17
View File
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
.\" Last Change: Thu Nov 13 09:47:27 EST 2003
.\" Last Change: Thu May 27 21:40:47 EDT 2004
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2004 Jan 24" "GNU Bash-3.0"
.TH BASH 1 "2004 May 27" "GNU Bash-3.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1871,6 +1871,12 @@ displays during an execution trace. The first character of
is replicated multiple times, as necessary, to indicate multiple
levels of indirection. The default is ``\fB+ \fP''.
.TP
.B SHELL
The full pathname to the shell is kept in this environment variable.
If it is not set when the shell starts,
.B bash
assigns to it the full pathname of the current user's login shell.
.TP
.B TIMEFORMAT
The value of this parameter is used as a format string specifying
how the timing information for pipelines prefixed with the
@@ -3189,16 +3195,18 @@ builtin commands (see
.SM
.B SHELL BUILTIN COMMANDS
below).
The first word of each command, if unquoted,
The first word of each simple command, if unquoted,
is checked to see if it has an
alias. If so, that word is replaced by the text of the alias.
The alias name and the replacement text may contain any valid
shell input, including the
.I metacharacters
listed above, with the exception that the alias name may not
contain \fI=\fP. The first word of the replacement text is tested
The characters \fB/\fP, \fB$\fP, \fB`\fP, and \fB=\fP and
any of the shell \fImetacharacters\fP or quoting characters
listed above may not appear in an alias name.
The replacement text may contain any valid shell input,
including shell metacharacters.
The first word of the replacement text is tested
for aliases, but a word that is identical to an alias being expanded
is not expanded a second time. This means that one may alias
is not expanded a second time.
This means that one may alias
.B ls
to
.BR "ls \-F" ,
@@ -3272,7 +3280,7 @@ function become the positional parameters
during its execution.
The special parameter
.B #
is updated to reflect the change. Positional parameter 0
is updated to reflect the change. Special parameter 0
is unchanged.
The first element of the
.SM
@@ -3544,9 +3552,11 @@ builtin below.
.B \-z \fIstring\fP
True if the length of \fIstring\fP is zero.
.TP
.B \-n \fIstring\fP
.TP
\fIstring\fP
.PD 0
.TP
.B \-n \fIstring\fP
.PD
True if the length of
.I string
is non-zero.
@@ -5003,6 +5013,11 @@ Word boundaries are the same as those used by \fBbackward\-word\fP.
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
.TP
.B unix\-filename\-rubout
Kill the word behind point, using white space and the slash character
as the word boundaries.
The killed text is saved on the kill-ring.
.TP
.B delete\-horizontal\-space (M\-\e)
Delete all spaces and tabs around point.
.TP
@@ -8161,7 +8176,7 @@ using the rules listed above.
Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
.TP
\fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP ...]
\fBtrap\fP [\fB\-lp\fP] [[\fIarg\fP] \fIsigspec\fP ...]
The command
.I arg
is to be read and executed when the shell receives
@@ -8169,7 +8184,7 @@ signal(s)
.IR sigspec .
If
.I arg
is absent or
is absent (and there is a single \fIsigspec\fP) or
.BR \- ,
all specified signals are
reset to their original values (the values they had
@@ -8190,7 +8205,7 @@ If no arguments are supplied or if only
.B \-p
is given,
.B trap
prints the list of commands associated with each signal number.
prints the list of commands associated with each signal.
The
.B \-l
option causes the shell to print a list of signal names and
@@ -8199,6 +8214,7 @@ Each
.I sigspec
is either
a signal name defined in <\fIsignal.h\fP>, or a signal number.
Signal names are case insensitive and the SIG prefix is optional.
If a
.I sigspec
is
@@ -8592,10 +8608,13 @@ turning off restricted mode with
.PP
These restrictions are enforced after any startup files are read.
.PP
When a command that is found to be a shell script is executed (see
.ie \n(zY=1 When a command that is found to be a shell script is executed,
.el \{ When a command that is found to be a shell script is executed
(see
.SM
.B "COMMAND EXECUTION"
above),
\}
.B rbash
turns off any restrictions in the shell spawned to execute the
script.
@@ -8715,7 +8734,9 @@ a unit.
.PP
Commands inside of \fB$(\fP...\fB)\fP command substitution are not
parsed until substitution is attempted. This will delay error
reporting until some time after the command is entered.
reporting until some time after the command is entered. For example,
unmatched parentheses, even inside shell comments, will result in
error messages while the construct is being read.
.PP
Array variables may not (yet) be exported.
.zZ
+15 -9
View File
@@ -16,7 +16,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU Bash Reference Manual},
for @code{Bash}, Version @value{VERSION}.
Copyright @copyright{} 1988-2003 Free Software Foundation, Inc.
Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -2973,9 +2973,10 @@ The return status is zero.
trap [-lp] [@var{arg}] [@var{sigspec} @dots{}]
@end example
The commands in @var{arg} are to be read and executed when the
shell receives signal @var{sigspec}. If @var{arg} is absent or
equal to @samp{-}, all specified signals are reset to the values
they had when the shell was started.
shell receives signal @var{sigspec}. If @var{arg} is absent (and
there is a single @var{sigspec}) or
equal to @samp{-}, each specified signal's disposition is reset
to the value it had when the shell was started.
If @var{arg} is the null string, then the signal specified by
each @var{sigspec} is ignored by the shell and commands it invokes.
If @var{arg} is not present and @option{-p} has been supplied,
@@ -2986,9 +2987,8 @@ associated with each signal number in a form that may be reused as
shell input.
The @option{-l} option causes the shell to print a list of signal names
and their corresponding numbers.
Each @var{sigspec} is either a signal name such as @code{SIGINT} (with
or without the @code{SIG} prefix) or a signal number.
Each @var{sigspec} is either a signal name or a signal number.
Signal names are case insensitive and the @code{SIG} prefix is optional.
If a @var{sigspec}
is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
@@ -4653,6 +4653,11 @@ the count to the value assigned, and the expanded value
becomes the value assigned plus the number of seconds
since the assignment.
@item SHELL
The full pathname to the shell is kept in this environment variable.
If it is not set when the shell starts,
Bash assigns to it the full pathname of the current user's login shell.
@item SHELLOPTS
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the @option{-o} option to the
@@ -6194,8 +6199,9 @@ kill -l [@var{exit_status}]
@end example
Send a signal specified by @var{sigspec} or @var{signum} to the process
named by job specification @var{jobspec} or process @sc{id} @var{pid}.
@var{sigspec} is either a signal name such as @code{SIGINT} (with or without
the @code{SIG} prefix) or a signal number; @var{signum} is a signal number.
@var{sigspec} is either a case-insensitive signal name such as
@code{SIGINT} (with or without the @code{SIG} prefix)
or a signal number; @var{signum} is a signal number.
If @var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used.
The @option{-l} option lists the signal names.
If any arguments are supplied when @option{-l} is given, the names of the
+14 -5
View File
@@ -16,7 +16,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU Bash Reference Manual},
for @code{Bash}, Version @value{VERSION}.
Copyright @copyright{} 1988-2003 Free Software Foundation, Inc.
Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -2600,6 +2600,10 @@ facilities (@pxref{Programmable Completion Builtins}).
Many of the builtins have been extended by @sc{posix} or Bash.
Unless otherwise noted, each builtin command documented as accepting
options preceded by @samp{-} accepts @samp{--}
to signify the end of the options.
@node Bourne Shell Builtins
@section Bourne Shell Builtins
@@ -2969,7 +2973,8 @@ The return status is zero.
trap [-lp] [@var{arg}] [@var{sigspec} @dots{}]
@end example
The commands in @var{arg} are to be read and executed when the
shell receives signal @var{sigspec}. If @var{arg} is absent or
shell receives signal @var{sigspec}. If @var{arg} is absent (and
there is a single @var{sigspec}) or
equal to @samp{-}, all specified signals are reset to the values
they had when the shell was started.
If @var{arg} is the null string, then the signal specified by
@@ -2982,9 +2987,8 @@ associated with each signal number in a form that may be reused as
shell input.
The @option{-l} option causes the shell to print a list of signal names
and their corresponding numbers.
Each @var{sigspec} is either a signal name such as @code{SIGINT} (with
or without the @code{SIG} prefix) or a signal number.
Each @var{sigspec} is either a signal name or a signal number.
Signal names are case insensitive and the @code{SIG} prefix is optional.
If a @var{sigspec}
is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
@@ -4649,6 +4653,11 @@ the count to the value assigned, and the expanded value
becomes the value assigned plus the number of seconds
since the assignment.
@item SHELL
The full pathname to the shell is kept in this environment variable.
If it is not set when the shell starts,
Bash assigns to it the full pathname of the current user's login shell.
@item SHELLOPTS
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the @option{-o} option to the
+1 -1
View File
@@ -1374,4 +1374,4 @@ SSEEEE AALLSSOO
GNU Bash-2.05a 2001 November 27 BASH_BUILTINS(1)
GNU Bash-3.0 2004 Apr 20 BASH_BUILTINS(1)
+1 -1
View File
@@ -1,6 +1,6 @@
.\" This is a hack to force bash builtins into the whatis database
.\" and to get the list of builtins to come up with the man command.
.TH BASH_BUILTINS 1 "2001 November 27" "GNU Bash-2.05a"
.TH BASH_BUILTINS 1 "2004 Apr 20" "GNU Bash-3.0"
.SH NAME
bash, :, ., [, alias, bg, bind, break, builtin, cd, command, compgen, complete,
continue, declare, dirs, disown, echo, enable, eval, exec, exit,
+2 -3
View File
@@ -48,9 +48,8 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see CCOOMM--
MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
spawned to execute the script.
When a command that is found to be a shell script is executed, rrbbaasshh
turns off any restrictions in the shell spawned to execute the script.
SSEEEE AALLSSOO
bash(1)
+1 -1
View File
@@ -1,4 +1,4 @@
.TH RBASH 1 "1999 Nov 29" GNU
.TH RBASH 1 "2004 Apr 20" "GNU Bash-3.0"
.SH NAME
rbash \- restricted bash, see \fBbash\fR(1)
.SH RESTRICTED SHELL
+4 -4
View File
@@ -3,8 +3,8 @@ Copyright (C) 1988-2004 Free Software Foundation, Inc.
@end ignore
@set EDITION 3.0
@set VERSION 3.0-beta1
@set UPDATED 20 April 2004
@set UPDATED-MONTH April 2004
@set VERSION 3.0-rc1
@set UPDATED 27 May 2004
@set UPDATED-MONTH May 2004
@set LASTCHANGE Tue Apr 20 13:54:25 EDT 2004
@set LASTCHANGE Thu May 27 22:10:33 EDT 2004
+5 -5
View File
@@ -1,10 +1,10 @@
@ignore
Copyright (C) 1988-2003 Free Software Foundation, Inc.
Copyright (C) 1988-2004 Free Software Foundation, Inc.
@end ignore
@set EDITION 3.0
@set VERSION 3.0-alpha
@set UPDATED 13 November 2003
@set UPDATED-MONTH November 2003
@set VERSION 3.0-rc1
@set UPDATED 24 May 2004
@set UPDATED-MONTH May 2004
@set LASTCHANGE Thu Nov 13 09:47:04 EST 2003
@set LASTCHANGE Mon May 24 14:57:25 EDT 2004
+8 -4
View File
@@ -1493,12 +1493,13 @@ rl_on_new_line ()
/* Tell the update routines that we have moved onto a new line with the
prompt already displayed. Code originally from the version of readline
distributed with CLISP. */
distributed with CLISP. rl_expand_prompt must have already been called
(explicitly or implicitly). This still doesn't work exactly right. */
int
rl_on_new_line_with_prompt ()
{
int prompt_size, i, l, real_screenwidth, newlines;
char *prompt_last_line;
char *prompt_last_line, *lprompt;
/* Initialize visible_line and invisible_line to ensure that they can hold
the already-displayed prompt. */
@@ -1507,8 +1508,9 @@ rl_on_new_line_with_prompt ()
/* Make sure the line structures hold the already-displayed prompt for
redisplay. */
strcpy (visible_line, rl_prompt);
strcpy (invisible_line, rl_prompt);
lprompt = local_prompt ? local_prompt : rl_prompt;
strcpy (visible_line, lprompt);
strcpy (invisible_line, lprompt);
/* If the prompt contains newlines, take the last tail. */
prompt_last_line = strrchr (rl_prompt, '\n');
@@ -1543,6 +1545,8 @@ rl_on_new_line_with_prompt ()
vis_lbreaks[newlines] = l;
visible_wrap_offset = 0;
rl_display_prompt = rl_prompt; /* XXX - make sure it's set */
return 0;
}
+8 -2
View File
@@ -506,7 +506,7 @@ rl_redisplay ()
}
}
pmtlen = strlen (prompt_this_line);
prompt_physical_chars = pmtlen = strlen (prompt_this_line);
temp = pmtlen + out + 2;
if (temp >= line_size)
{
@@ -1543,6 +1543,8 @@ rl_on_new_line_with_prompt ()
vis_lbreaks[newlines] = l;
visible_wrap_offset = 0;
rl_display_prompt = rl_prompt; /* XXX - make sure it's set */
return 0;
}
@@ -1841,6 +1843,7 @@ static char *saved_local_prefix;
static int saved_last_invisible;
static int saved_visible_length;
static int saved_invis_chars_first_line;
static int saved_physical_chars;
void
rl_save_prompt ()
@@ -1850,10 +1853,11 @@ rl_save_prompt ()
saved_last_invisible = prompt_last_invisible;
saved_visible_length = prompt_visible_length;
saved_invis_chars_first_line = prompt_invis_chars_first_line;
saved_physical_chars = prompt_physical_chars;
local_prompt = local_prompt_prefix = (char *)0;
prompt_last_invisible = prompt_visible_length = 0;
prompt_invis_chars_first_line = 0;
prompt_invis_chars_first_line = prompt_physical_chars = 0;
}
void
@@ -1867,6 +1871,7 @@ rl_restore_prompt ()
prompt_last_invisible = saved_last_invisible;
prompt_visible_length = saved_visible_length;
prompt_invis_chars_first_line = saved_invis_chars_first_line;
prompt_physical_chars = saved_physical_chars;
}
char *
@@ -1899,6 +1904,7 @@ _rl_make_prompt_for_search (pchar)
prompt_last_invisible = saved_last_invisible;
prompt_visible_length = saved_visible_length + 1;
}
return pmt;
}
+12 -1
View File
@@ -678,6 +678,8 @@ add_one_character:
${ ... } pair through according to the Posix.2 specification. */
if (c == '$' && ((string[i + 1] == LPAREN) || (string[i + 1] == LBRACE)))
{
int free_ret = 1;
si = i + 2;
if (string[i + 1] == LPAREN)
ret = extract_delimited_string (string, &si, "$(", "(", ")", 0); /*)*/
@@ -687,12 +689,21 @@ add_one_character:
temp[j++] = '$';
temp[j++] = string[i + 1];
/* Just paranoia; ret will not be 0 unless no_longjmp_on_fatal_error
is set. */
if (ret == 0 && no_longjmp_on_fatal_error)
{
free_ret = 0;
ret = string + i + 2;
}
for (t = 0; ret[t]; t++, j++)
temp[j] = ret[t];
temp[j++] = string[si];
i = si + 1;
free (ret);
if (free_ret)
free (ret);
continue;
}
+25 -1
View File
@@ -678,6 +678,8 @@ add_one_character:
${ ... } pair through according to the Posix.2 specification. */
if (c == '$' && ((string[i + 1] == LPAREN) || (string[i + 1] == LBRACE)))
{
int free_ret = 1;
si = i + 2;
if (string[i + 1] == LPAREN)
ret = extract_delimited_string (string, &si, "$(", "(", ")", 0); /*)*/
@@ -687,12 +689,19 @@ add_one_character:
temp[j++] = '$';
temp[j++] = string[i + 1];
if (ret == 0 && no_longjmp_on_fatal_error)
{
free_ret = 0;
ret = string + i + 2;
}
for (t = 0; ret[t]; t++, j++)
temp[j] = ret[t];
temp[j++] = string[si];
i = si + 1;
free (ret);
if (free_ret)
free (ret);
continue;
}
@@ -2178,7 +2187,18 @@ pos_params (string, start, end, quoted)
t->next = (WORD_LIST *)NULL;
if (string[0] == '*')
#if 0
ret = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? string_list_dollar_star (quote_list (h)) : string_list (h);
#else
{
if (quoted & Q_DOUBLE_QUOTES)
ret = string_list_dollar_star (quote_list (h));
else if (quoted & Q_HERE_DOCUMENT)
ret = string_list (quote_list (h));
else
ret = string_list (h);
}
#endif
else
ret = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (h) : h);
if (t != params)
@@ -3457,7 +3477,11 @@ list_remove_pattern (list, pattern, patspec, itype, quoted)
l = REVERSE_LIST (new, WORD_LIST *);
if (itype == '*')
#if 0
tword = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? string_list_dollar_star (l) : string_list (l);
#else
tword = (quoted & Q_DOUBLE_QUOTES) ? string_list_dollar_star (l) : string_list (l);
#endif
else
tword = string_list ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? quote_list (l) : l);
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+1 -1
View File
@@ -85,7 +85,7 @@ command: usage: command [-pVv] command [arg ...]
./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 216: trap: NOSIG: invalid signal specification
./errors.tests: line 219: trap: -s: invalid option
trap: usage: trap [arg] [signal_spec ...] or trap -l
trap: usage: trap [-lp] [[arg] signal_spec ...]
./errors.tests: line 225: return: can only `return' from a function or sourced script
./errors.tests: line 229: break: 0: loop count out of range
./errors.tests: line 233: continue: 0: loop count out of range
+2 -2
View File
@@ -1,7 +1,7 @@
./errors.tests: line 17: alias: -x: invalid option
alias: usage: alias [-p] [name[=value] ... ]
./errors.tests: line 18: unalias: -x: invalid option
unalias: usage: unalias [-a] [name ...]
unalias: usage: unalias [-a] name [name ...]
./errors.tests: line 19: alias: hoowah: not found
./errors.tests: line 20: unalias: hoowah: not found
./errors.tests: line 23: `1': not a valid identifier
@@ -85,7 +85,7 @@ command: usage: command [-pVv] command [arg ...]
./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 216: trap: NOSIG: invalid signal specification
./errors.tests: line 219: trap: -s: invalid option
trap: usage: trap [arg] [signal_spec ...] or trap -l
trap: usage: trap [-lp] [[arg] signal_spec ...]
./errors.tests: line 225: return: can only `return' from a function or sourced script
./errors.tests: line 229: break: 0: loop count out of range
./errors.tests: line 233: continue: 0: loop count out of range
+1 -1
View File
@@ -81,6 +81,6 @@ trap -p SIGCHLD
# Now reset some of the signals the shell handles specially back to
# their default values (with or without the SIG prefix)
trap SIGINT QUIT TERM
trap - SIGINT QUIT TERM
trap
+86
View File
@@ -0,0 +1,86 @@
# test the trap code
trap 'echo exiting' 0
trap 'echo aborting' 1 2 3 6 15
# make sure a user-specified subshell runs the exit trap, but does not
# inherit the exit trap from a parent shell
( trap 'echo subshell exit' 0; exit 0 )
( exit 0 )
trap
func()
{
trap 'echo ${FUNCNAME:-$0}[$LINENO] funcdebug' DEBUG
echo funcdebug line
}
trap 'echo [$LINENO] debug' DEBUG
echo debug line
trap
func
trap
trap 'echo ${FUNCNAME:-$0}[$LINENO] debug' DEBUG
func2()
{
echo func2debug line
}
declare -ft func2
func2
unset -f func2
trap '' DEBUG
trap
trap - debug
trap
trap - HUP
trap hup
trap '' INT
trap '' int
trap
# exit 0 in exit trap should set exit status
(
set -e
trap 'exit 0' EXIT
false
echo bad
)
echo $?
# hmmm...should this set the handling to SIG_IGN for children, too?
trap '' USR2
./trap1.sub
# test ERR trap
./trap2.sub
#
# show that setting a trap on SIGCHLD is not disastrous.
#
set -o monitor
trap 'echo caught a child death' SIGCHLD
sleep 7 & sleep 6 & sleep 5 &
wait
trap -p SIGCHLD
# Now reset some of the signals the shell handles specially back to
# their default values (with or without the SIG prefix)
trap SIGINT QUIT TERM
trap