commit bash-20050901 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:50:36 -05:00
parent ff247e749e
commit 7790f917d0
31 changed files with 2008 additions and 1117 deletions
+37
View File
@@ -12044,3 +12044,40 @@ doc/bash.1,lib/readline/doc/{rluser.texi,readline.3}
----
lib/sh/pathphys.c
- fix small memory leak in sh_realpath reported by Eric Blake
8/31
----
doc/bashref.texi
- add additional notes to posix mode section
9/3
---
parse.y
- if $'...' occurs within a ${...} parameter expansion within
double quotes, don't single-quote the expanded result -- the double
quotes will cause it to be expanded incorrectly
9/4
---
builtins/fc.def
- if STRICT_POSIX is defined, the posix mode default for the editor to
use is $FCEDIT, then ed
shell.c
- if STRICT_POSIX is defined, initialize `posixly_correct' to 1
config.h.in
- add #undef STRICT_POSIX
9/5
---
configure.in
- add new option argument, --enable-strict-posix-default, configures
bash to be posix-conformant (including defaulting echo to posix
conformance) by default
builtins/echo.def
- if STRICT_POSIX is defined, default echo to xpg-style
doc/bashref.texi
- describe the --enable-strict-posix-default option to configure
+36
View File
@@ -12039,3 +12039,39 @@ lib/readline/bind.c
doc/bash.1,lib/readline/doc/{rluser.texi,readline.3}
- clarified the language concerning parsing values for boolean
variables in assignment statements
8/28
----
lib/sh/pathphys.c
- fix small memory leak in sh_realpath reported by Eric Blake
8/31
----
doc/bashref.texi
- add additional notes to posix mode section
9/3
---
parse.y
- if $'...' occurs within a ${...} parameter expansion within
double quotes, don't single-quote the expanded result -- the double
quotes will cause it to be expanded incorrectly
9/4
---
builtins/fc.def
- if STRICT_POSIX is defined, the posix mode default for the editor to
use is $FCEDIT, then ed
shell.c
- if STRICT_POSIX is defined, initialize `posixly_correct' to 1
config.h.in
- add #undef STRICT_POSIX
9/5
---
configure.in
- add new option argument, --enable-strict-posix-default, configures
bash to be posix-conformant (including defaulting echo to posix
conformance) by default
+3 -1
View File
@@ -767,6 +767,8 @@ tests/history.right f
tests/history.list f 444
tests/ifs.tests f
tests/ifs.right f
tests/ifs-posix.tests f
tests/ifs-posix.right f
tests/input-line.sh f
tests/input-line.sub f
tests/input.right f
@@ -805,7 +807,6 @@ tests/posix2.tests f
tests/posix2.right f
tests/posixpat.tests f
tests/posixpat.right f
tests/posix-ifs.sh f
tests/prec.right f
tests/precedence f
tests/printf.tests f
@@ -865,6 +866,7 @@ tests/run-herestr f
tests/run-histexpand f
tests/run-history f
tests/run-ifs f
tests/run-ifs-posix f
tests/run-input-test f
tests/run-intl f
tests/run-iquote f
+15 -1
View File
@@ -1,5 +1,5 @@
@%:@! /bin/sh
@%:@ From configure.in for Bash 3.1, version 3.179.
@%:@ From configure.in for Bash 3.1, version 3.180.
@%:@ Guess values for system-dependent variables and create Makefiles.
@%:@ Generated by GNU Autoconf 2.59 for bash 3.1-alpha1.
@%:@
@@ -894,6 +894,8 @@ Optional Features:
--enable-single-help-strings
store help documentation as a single string to ease
translation
--enable-strict-posix-default
configure bash to be posix-conformant by default
--enable-usg-echo-default
a synonym for --enable-xpg-echo-default
--enable-xpg-echo-default
@@ -1714,6 +1716,7 @@ opt_brace_expansion=yes
opt_disabled_builtins=no
opt_command_timing=yes
opt_xpg_echo=no
opt_strict_posix=no
opt_cond_command=yes
opt_cond_regexp=yes
opt_arith_for_command=yes
@@ -1874,6 +1877,11 @@ if test "${enable_single_help_strings+set}" = set; then
enableval="$enable_single_help_strings"
opt_single_longdoc_strings=$enableval
fi;
# Check whether --enable-strict-posix-default or --disable-strict-posix-default was given.
if test "${enable_strict_posix_default+set}" = set; then
enableval="$enable_strict_posix_default"
opt_strict_posix=$enableval
fi;
# Check whether --enable-usg-echo-default or --disable-usg-echo-default was given.
if test "${enable_usg_echo_default+set}" = set; then
enableval="$enable_usg_echo_default"
@@ -1980,6 +1988,12 @@ cat >>confdefs.h <<\_ACEOF
@%:@define DEFAULT_ECHO_TO_XPG 1
_ACEOF
fi
if test $opt_strict_posix = yes; then
cat >>confdefs.h <<\_ACEOF
@%:@define STRICT_POSIX 1
_ACEOF
fi
if test $opt_extended_glob = yes ; then
cat >>confdefs.h <<\_ACEOF
+1027 -1023
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -72,7 +72,7 @@ $END
existing system shells won't barf. Regrettably, the SUS v2 has
standardized the Sys V echo behavior. This variable is external
so that we can have a `shopt' variable to control it at runtime. */
#if defined (DEFAULT_ECHO_TO_XPG)
#if defined (DEFAULT_ECHO_TO_XPG) || defined (STRICT_POSIX)
int xpg_echo = 1;
#else
int xpg_echo = 0;
+1 -6
View File
@@ -31,11 +31,6 @@ $PRODUCES echo.c
#include <stdio.h>
#include "../shell.h"
#include <errno.h>
#if !defined (errno)
extern int errno;
#endif
$BUILTIN echo
$FUNCTION echo_builtin
$DEPENDS_ON V9_ECHO
@@ -180,7 +175,7 @@ just_echo:
fflush (stdout);
if (ferror (stdout))
{
builtin_error ("write error: %s", strerror (errno));
sh_wrerror ();
clearerr (stdout);
return (EXECUTION_FAILURE);
}
+5 -1
View File
@@ -157,7 +157,11 @@ static void fc_addhist __P((char *));
/* String to execute on a file that we want to edit. */
#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-vi}}"
#define POSIX_FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-ed}}"
#if defined (STRICT_POSIX)
# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-ed}"
#else
# define POSIX_FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-ed}}"
#endif
int
fc_builtin (list)
+1 -1
View File
@@ -1,7 +1,7 @@
This file is fc.def, from which is created fc.c.
It implements the builtin "fc" in Bash.
Copyright (C) 1987-2003 Free Software Foundation, Inc.
Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+4
View File
@@ -144,6 +144,10 @@
bash debugger. */
#undef DEBUGGER
/* Define STRICT_POSIX if you want bash to be strictly posix.2 conformant by
default (except for echo; that is controlled separately). */
#undef STRICT_POSIX
/* Define MEMSCRAMBLE if you want the bash malloc and free to scramble
memory contents on malloc() and free(). */
#undef MEMSCRAMBLE
+18
View File
@@ -510,6 +510,9 @@
/* Define if you have the dup2 function. */
#undef HAVE_DUP2
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
@@ -534,6 +537,15 @@
/* Define if you have the getpeername function. */
#undef HAVE_GETPEERNAME
/* Define if you have the getpwent function. */
#undef HAVE_GETPWENT
/* Define if you have the getpwnam function. */
#undef HAVE_GETPWNAM
/* Define if you have the getpwuid function. */
#undef HAVE_GETPWUID
/* Define if you have the getrlimit function. */
#undef HAVE_GETRLIMIT
@@ -576,6 +588,9 @@
/* Define if you have the isxdigit function. */
#undef HAVE_ISXDIGIT
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the killpg function. */
#undef HAVE_KILLPG
@@ -791,6 +806,9 @@
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
Vendored
+15 -1
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in for Bash 3.1, version 3.179.
# From configure.in for Bash 3.1, version 3.180.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for bash 3.1-alpha1.
#
@@ -894,6 +894,8 @@ Optional Features:
--enable-single-help-strings
store help documentation as a single string to ease
translation
--enable-strict-posix-default
configure bash to be posix-conformant by default
--enable-usg-echo-default
a synonym for --enable-xpg-echo-default
--enable-xpg-echo-default
@@ -1714,6 +1716,7 @@ opt_brace_expansion=yes
opt_disabled_builtins=no
opt_command_timing=yes
opt_xpg_echo=no
opt_strict_posix=no
opt_cond_command=yes
opt_cond_regexp=yes
opt_arith_for_command=yes
@@ -1874,6 +1877,11 @@ if test "${enable_single_help_strings+set}" = set; then
enableval="$enable_single_help_strings"
opt_single_longdoc_strings=$enableval
fi;
# Check whether --enable-strict-posix-default or --disable-strict-posix-default was given.
if test "${enable_strict_posix_default+set}" = set; then
enableval="$enable_strict_posix_default"
opt_strict_posix=$enableval
fi;
# Check whether --enable-usg-echo-default or --disable-usg-echo-default was given.
if test "${enable_usg_echo_default+set}" = set; then
enableval="$enable_usg_echo_default"
@@ -1980,6 +1988,12 @@ cat >>confdefs.h <<\_ACEOF
#define DEFAULT_ECHO_TO_XPG 1
_ACEOF
fi
if test $opt_strict_posix = yes; then
cat >>confdefs.h <<\_ACEOF
#define STRICT_POSIX 1
_ACEOF
fi
if test $opt_extended_glob = yes ; then
cat >>confdefs.h <<\_ACEOF
+6 -1
View File
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_REVISION([for Bash 3.1, version 3.179])dnl
AC_REVISION([for Bash 3.1, version 3.180])dnl
define(bashvers, 3.1)
define(relstatus, alpha1)
@@ -173,6 +173,7 @@ opt_brace_expansion=yes
opt_disabled_builtins=no
opt_command_timing=yes
opt_xpg_echo=no
opt_strict_posix=no
opt_cond_command=yes
opt_cond_regexp=yes
opt_arith_for_command=yes
@@ -229,6 +230,7 @@ AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restri
AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval)
AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
@@ -282,6 +284,9 @@ fi
if test $opt_xpg_echo = yes ; then
AC_DEFINE(DEFAULT_ECHO_TO_XPG)
fi
if test $opt_strict_posix = yes; then
AC_DEFINE(STRICT_POSIX)
fi
if test $opt_extended_glob = yes ; then
AC_DEFINE(EXTENDED_GLOB)
fi
+6 -5
View File
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_REVISION([for Bash 3.1, version 3.178, from autoconf version] AC_ACVERSION)dnl
AC_REVISION([for Bash 3.1, version 3.180])dnl
define(bashvers, 3.1)
define(relstatus, alpha1)
@@ -173,6 +173,7 @@ opt_brace_expansion=yes
opt_disabled_builtins=no
opt_command_timing=yes
opt_xpg_echo=no
opt_strict_posix=no
opt_cond_command=yes
opt_cond_regexp=yes
opt_arith_for_command=yes
@@ -229,6 +230,7 @@ AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restri
AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval)
AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
@@ -282,6 +284,9 @@ fi
if test $opt_xpg_echo = yes ; then
AC_DEFINE(DEFAULT_ECHO_TO_XPG)
fi
if test $opt_strict_posix = yes; then
AC_DEFINE(STRICT_POSIX)
fi
if test $opt_extended_glob = yes ; then
AC_DEFINE(EXTENDED_GLOB)
fi
@@ -363,10 +368,6 @@ dnl test for Unix variants
AC_ISC_POSIX
AC_MINIX
dnl test for non-Unix variants
AC_CYGWIN
AC_MINGW32
AC_SYS_LARGEFILE
dnl BEGIN changes for cross-building (currently cygwin, minGW, and
+2
View File
@@ -64,6 +64,8 @@ shells (\fBksh\fP and \fBcsh\fP).
.B Bash
is intended to be a conformant implementation of the IEEE
POSIX Shell and Tools specification (IEEE Working Group 1003\.2).
.B Bash
can be configured to be POSIX-conformant by default.
.SH OPTIONS
In addition to the single-character shell options documented in the
description of the \fBset\fR builtin command, \fBbash\fR
+8 -3
View File
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
.\" Last Change: Wed Aug 24 17:20:03 EDT 2005
.\" Last Change: Sat Aug 27 13:28:44 EDT 2005
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2005 Aug 24" "GNU Bash-3.1-alpha1"
.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-alpha1"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -4565,7 +4565,12 @@ file with a statement of the form
Except where noted, readline variables can take the values
.B On
or
.BR Off .
.B Off
(without regard to case).
Unrecognized variable names are ignored.
When a variable value is read, empty or null values, "on" (case-insensitive),
and "1" are equivalent to \fBOn\fP. All other values are equivalent to
\fBOff\fP.
The variables and their default values are:
.PP
.PD 0
+60 -18
View File
@@ -5223,6 +5223,7 @@ shell to exit.
@item
When running in @sc{posix} mode, a special builtin returning an error
status will not cause the shell to exit (@pxref{Bash POSIX Mode}).
@item
A failed @code{exec} will not cause the shell to exit
(@pxref{Bourne Shell Builtins}).
@@ -5910,6 +5911,11 @@ The message printed by the job control code and builtins when a job
is stopped is `Stopped(@var{signame})', where @var{signame} is, for
example, @code{SIGTSTP}.
@item
The @code{bg} builtin uses the required format to describe each job placed
in the background, which does not include an indication of whether the job
is the current or previous job.
@item
Reserved words appearing in a context where reserved words are recognized
do not undergo alias expansion.
@@ -5963,7 +5969,7 @@ may not start with a digit. Declaring a function with an invalid name
causes a fatal syntax error in non-interactive shells.
@item
@sc{posix} 1003.2 `special' builtins are found before shell functions
@sc{posix} 1003.2 special builtins are found before shell functions
during command lookup.
@item
@@ -6057,6 +6063,11 @@ falling back to @var{physical} mode.
When the @code{pwd} builtin is supplied the @option{-P} option, it resets
@code{$PWD} to a pathname containing no symlinks.
@item
The @code{pwd} builtin verifies that the value it prints is the same as the
current directory, even if it is not asked to check the file system with the
@option{-P} option.
@item
When listing the history, the @code{fc} builtin does not include an
indication of whether or not a history entry has been modified.
@@ -6069,6 +6080,11 @@ The @code{type} and @code{command} builtins will not report a non-executable
file as having been found, though the shell will attempt to execute such a
file if it is the only so-named file found in @code{$PATH}.
@item
The @code{vi} editing mode will invoke the @code{vi} editor directly when
the @samp{v} command is run, instead of checking @code{$FCEDIT} and
@code{$EDITOR}.
@item
When the @code{xpg_echo} option is enabled, Bash does not attempt to interpret
any arguments to @code{echo} as options. Each argument is displayed, after
@@ -6076,27 +6092,27 @@ escape characters are converted.
@end enumerate
There is other @sc{posix} 1003.2 behavior that Bash does not implement.
There is other @sc{posix} 1003.2 behavior that Bash does not implement by
default even when in @sc{posix} mode.
Specifically:
@enumerate
@item
Assignment statements affect the execution environment of all
builtins, not just special ones.
@item
When a subshell is created to execute a shell script with execute permission,
but without a leading @samp{#!}, Bash sets @code{$0} to the full pathname of
the script as found by searching @code{$PATH}, rather than the command as
typed by the user.
The @code{fc} builtin checks @code{$EDITOR} as a program to edit history
entries if @code{FCEDIT} is unset, rather than defaulting directly to
@code{ed}. @code{fc} uses @code{ed} if @code{EDITOR} is unset.
@item
The @code{fc} builtin checks @code{$EDITOR} as a program to edit history lines
if @code{FCEDIT} is unset, rather than defaulting directly to @code{ed}.
@code{fc} uses @code{ed} if @code{EDITOR} is unset.
As noted above, Bash requires the @code{xpg_echo} option to be enabled for
the @code{echo} builtin to be fully conformant.
@end enumerate
Bash can be configured to be @sc{posix}-conformant by default, by specifying
the @option{--enable-strict-posix-default} to @code{configure} when building
(@pxref{Optional Features}).
@node Job Control
@chapter Job Control
@@ -6640,10 +6656,10 @@ Define if you are using the Andrew File System from Transarc.
@item --with-bash-malloc
Use the Bash version of
@code{malloc} in @file{lib/malloc/malloc.c}. This is not the same
@code{malloc} in the directory @file{lib/malloc}. This is not the same
@code{malloc} that appears in @sc{gnu} libc, but an older version
derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc} is
very fast, but wastes some space on each allocation.
originally derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc}
is very fast, but wastes some space on each allocation.
This option is enabled by default.
The @file{NOTES} file contains a list of systems for
which this should be turned off, and @code{configure} disables this
@@ -6830,6 +6846,9 @@ each help topic. This aids in translating the text to different languages.
You may need to disable this if your compiler cannot handle very long string
literals.
@item --enable-strict-posix-default
Make Bash @sc{posix}-conformant by default (@pxref{Bash Posix Mode}).
@item --enable-usg-echo-default
A synonym for @code{--enable-xpg-echo-default}.
@@ -6902,8 +6921,8 @@ differences between the traditional Bourne shell and Bash; this
section quickly details the differences of significance. A
number of these differences are explained in greater depth in
previous sections.
This section uses the version of @code{sh} included in SVR4.2 as
the baseline reference.
This section uses the version of @code{sh} included in SVR4.2 (the
last version of the historical Bourne shell) as the baseline reference.
@itemize @bullet
@@ -6955,6 +6974,8 @@ invocation options list the translatable strings found in a script
Bash implements the @code{!} keyword to negate the return value of
a pipeline (@pxref{Pipelines}).
Very useful when an @code{if} statement needs to act only if a test fails.
The Bash @samp{-o pipefail} option to @code{set} will cause a pipeline to
return a failure status if any command fails.
@item
Bash has the @code{time} reserved word and command timing (@pxref{Pipelines}).
@@ -6971,7 +6992,12 @@ generation of simple menus (@pxref{Conditional Constructs}).
@item
Bash includes the @code{[[} compound command, which makes conditional
testing part of the shell grammar (@pxref{Conditional Constructs}).
testing part of the shell grammar (@pxref{Conditional Constructs}), including
optional regular expression matching.
@item
Bash provides optional case-insensitive matching for the @code{case} and
@code{[[} constructs.
@item
Bash includes brace expansion (@pxref{Brace Expansion}) and tilde
@@ -6992,6 +7018,10 @@ exported to child processes. The Bourne shell does not normally do
this unless the variables are explicitly marked using the @code{export}
command.
@item
Bash supports the @samp{+=} assignment operator, which appends to the value
of the variable named on the left hand side.
@item
Bash includes the @sc{posix} pattern removal @samp{%}, @samp{#}, @samp{%%}
and @samp{##} expansions to remove leading or trailing substrings from
@@ -7083,6 +7113,14 @@ opened for both reading and writing, and the @samp{&>} redirection
operator, for directing standard output and standard error to the same
file (@pxref{Redirections}).
@item
Bash includes the @samp{<<<} redirection operator, allowing a string to
be used as the standard input to a command.
@item
Bash implements the @samp{[n]<&@var{word}} and @samp{[n]>&@var{word}}
redirection operators, which move one file descriptor to another.
@item
Bash treats a number of filenames specially when they are
used in redirection operators (@pxref{Redirections}).
@@ -7252,6 +7290,10 @@ job table (@pxref{Job Control Builtins}) or suppress the sending
of @code{SIGHUP} to a job when the shell exits as the result of a
@code{SIGHUP}.
@item
Bash includes a number of features to support a separate debugger for
shell scripts.
@item
The SVR4.2 shell has two privilege-related builtins
(@code{mldmode} and @code{priv}) not present in Bash.
+50 -11
View File
@@ -5223,6 +5223,7 @@ shell to exit.
@item
When running in @sc{posix} mode, a special builtin returning an error
status will not cause the shell to exit (@pxref{Bash POSIX Mode}).
@item
A failed @code{exec} will not cause the shell to exit
(@pxref{Bourne Shell Builtins}).
@@ -5910,6 +5911,11 @@ The message printed by the job control code and builtins when a job
is stopped is `Stopped(@var{signame})', where @var{signame} is, for
example, @code{SIGTSTP}.
@item
The @code{bg} builtin uses the required format to describe each job placed
in the background, which does not include an indication of whether the job
is the current or previous job.
@item
Reserved words appearing in a context where reserved words are recognized
do not undergo alias expansion.
@@ -5963,7 +5969,7 @@ may not start with a digit. Declaring a function with an invalid name
causes a fatal syntax error in non-interactive shells.
@item
@sc{posix} 1003.2 `special' builtins are found before shell functions
@sc{posix} 1003.2 special builtins are found before shell functions
during command lookup.
@item
@@ -6057,6 +6063,11 @@ falling back to @var{physical} mode.
When the @code{pwd} builtin is supplied the @option{-P} option, it resets
@code{$PWD} to a pathname containing no symlinks.
@item
The @code{pwd} builtin verifies that the value it prints is the same as the
current directory, even if it is not asked to check the file system with the
@option{-P} option.
@item
When listing the history, the @code{fc} builtin does not include an
indication of whether or not a history entry has been modified.
@@ -6069,6 +6080,11 @@ The @code{type} and @code{command} builtins will not report a non-executable
file as having been found, though the shell will attempt to execute such a
file if it is the only so-named file found in @code{$PATH}.
@item
The @code{vi} editing mode will invoke the @code{vi} editor directly when
the @samp{v} command is run, instead of checking @code{$FCEDIT} and
@code{$EDITOR}.
@item
When the @code{xpg_echo} option is enabled, Bash does not attempt to interpret
any arguments to @code{echo} as options. Each argument is displayed, after
@@ -6080,15 +6096,15 @@ There is other @sc{posix} 1003.2 behavior that Bash does not implement.
Specifically:
@enumerate
@item
Assignment statements affect the execution environment of all
builtins, not just special ones.
@item
When a subshell is created to execute a shell script with execute permission,
but without a leading @samp{#!}, Bash sets @code{$0} to the full pathname of
the script as found by searching @code{$PATH}, rather than the command as
typed by the user.
The @code{fc} builtin checks @code{$EDITOR} as a program to edit history lines
if @code{FCEDIT} is unset, rather than defaulting directly to @code{ed}.
@code{fc} uses @code{ed} if @code{EDITOR} is unset.
@item
As noted above, Bash requires the @code{xpg_echo} option to be enabled for
the @code{echo} builtin to be fully conformant.
@end enumerate
@@ -6897,8 +6913,8 @@ differences between the traditional Bourne shell and Bash; this
section quickly details the differences of significance. A
number of these differences are explained in greater depth in
previous sections.
This section uses the version of @code{sh} included in SVR4.2 as
the baseline reference.
This section uses the version of @code{sh} included in SVR4.2 (the
last version of the historical Bourne shell) as the baseline reference.
@itemize @bullet
@@ -6950,6 +6966,8 @@ invocation options list the translatable strings found in a script
Bash implements the @code{!} keyword to negate the return value of
a pipeline (@pxref{Pipelines}).
Very useful when an @code{if} statement needs to act only if a test fails.
The Bash @samp{-o pipefail} option to @code{set} will cause a pipeline to
return a failure status if any command fails.
@item
Bash has the @code{time} reserved word and command timing (@pxref{Pipelines}).
@@ -6966,7 +6984,12 @@ generation of simple menus (@pxref{Conditional Constructs}).
@item
Bash includes the @code{[[} compound command, which makes conditional
testing part of the shell grammar (@pxref{Conditional Constructs}).
testing part of the shell grammar (@pxref{Conditional Constructs}), including
optional regular expression matching.
@item
Bash provides optional case-insensitive matching for the @code{case} and
@code{[[} constructs.
@item
Bash includes brace expansion (@pxref{Brace Expansion}) and tilde
@@ -6987,6 +7010,10 @@ exported to child processes. The Bourne shell does not normally do
this unless the variables are explicitly marked using the @code{export}
command.
@item
Bash supports the @samp{+=} assignment operator, which appends to the value
of the variable named on the left hand side.
@item
Bash includes the @sc{posix} pattern removal @samp{%}, @samp{#}, @samp{%%}
and @samp{##} expansions to remove leading or trailing substrings from
@@ -7078,6 +7105,14 @@ opened for both reading and writing, and the @samp{&>} redirection
operator, for directing standard output and standard error to the same
file (@pxref{Redirections}).
@item
Bash includes the @samp{<<<} redirection operator, allowing a string to
be used as the standard input to a command.
@item
Bash implements the @samp{[n]<&@var{word}} and @samp{[n]>&@var{word}}
redirection operators, which move one file descriptor to another.
@item
Bash treats a number of filenames specially when they are
used in redirection operators (@pxref{Redirections}).
@@ -7247,6 +7282,10 @@ job table (@pxref{Job Control Builtins}) or suppress the sending
of @code{SIGHUP} to a job when the shell exits as the result of a
@code{SIGHUP}.
@item
Bash includes a number of features to support a separate debugger for
shell scripts.
@item
The SVR4.2 shell has two privilege-related builtins
(@code{mldmode} and @code{priv}) not present in Bash.
+3 -3
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2005 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sat Aug 27 13:54:54 EDT 2005
@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005
@set EDITION 3.1-alpha1
@set VERSION 3.1-alpha1
@set UPDATED 27 August 2005
@set UPDATED-MONTH August 2005
@set UPDATED 5 September 2005
@set UPDATED-MONTH September 2005
+3 -3
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2005 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Wed Aug 24 17:22:10 EDT 2005
@set LASTCHANGE Sat Sep 3 18:31:49 EDT 2005
@set EDITION 3.1-alpha1
@set VERSION 3.1-alpha1
@set UPDATED 24 August 2005
@set UPDATED-MONTH August 2005
@set UPDATED 3 September 2005
@set UPDATED-MONTH September 2005
+301
View File
@@ -0,0 +1,301 @@
/*
*
* Another test harness for the readline callback interface.
*
* Author: Bob Rossi <bob@brasko.net>
*/
#if defined (HAVE_CONFIG_H)
#include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <curses.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#if 0 /* LINUX */
#include <pty.h>
#else
#include <util.h>
#endif
#ifdef READLINE_LIBRARY
# include "readline.h"
#else
# include <readline/readline.h>
#endif
/**
* Master/Slave PTY used to keep readline off of stdin/stdout.
*/
static int masterfd = -1;
static int slavefd;
void
sigint (s)
int s;
{
tty_reset (STDIN_FILENO);
close (masterfd);
close (slavefd);
printf ("\n");
exit (0);
}
static int
user_input()
{
int size;
const int MAX = 1024;
char *buf = (char *)malloc(MAX+1);
size = read (STDIN_FILENO, buf, MAX);
if (size == -1)
return -1;
size = write (masterfd, buf, size);
if (size == -1)
return -1;
return 0;
}
static int
readline_input()
{
const int MAX = 1024;
char *buf = (char *)malloc(MAX+1);
int size;
size = read (masterfd, buf, MAX);
if (size == -1)
{
free( buf );
buf = NULL;
return -1;
}
buf[size] = 0;
/* Display output from readline */
if ( size > 0 )
fprintf(stderr, "%s", buf);
free( buf );
buf = NULL;
return 0;
}
static void
rlctx_send_user_command(char *line)
{
/* This happens when rl_callback_read_char gets EOF */
if ( line == NULL )
return;
if (strcmp (line, "exit") == 0) {
tty_reset (STDIN_FILENO);
close (masterfd);
close (slavefd);
printf ("\n");
exit (0);
}
/* Don't add the enter command */
if ( line && *line != '\0' )
add_history(line);
}
static void
custom_deprep_term_function ()
{
}
static int
init_readline (int inputfd, int outputfd)
{
FILE *inputFILE, *outputFILE;
inputFILE = fdopen (inputfd, "r");
if (!inputFILE)
return -1;
outputFILE = fdopen (outputfd, "w");
if (!outputFILE)
return -1;
rl_instream = inputFILE;
rl_outstream = outputFILE;
/* Tell readline what the prompt is if it needs to put it back */
rl_callback_handler_install("(rltest): ", rlctx_send_user_command);
/* Set the terminal type to dumb so the output of readline can be
* understood by tgdb */
if ( rl_reset_terminal("dumb") == -1 )
return -1;
/* For some reason, readline can not deprep the terminal.
* However, it doesn't matter because no other application is working on
* the terminal besides readline */
rl_deprep_term_function = custom_deprep_term_function;
using_history();
read_history(".history");
return 0;
}
static int
main_loop(void)
{
fd_set rset;
int max;
max = (masterfd > STDIN_FILENO) ? masterfd : STDIN_FILENO;
max = (max > slavefd) ? max : slavefd;
for (;;)
{
/* Reset the fd_set, and watch for input from GDB or stdin */
FD_ZERO(&rset);
FD_SET(STDIN_FILENO, &rset);
FD_SET(slavefd, &rset);
FD_SET(masterfd, &rset);
/* Wait for input */
if (select(max + 1, &rset, NULL, NULL, NULL) == -1)
{
if (errno == EINTR)
continue;
else
return -1;
}
/* Input received through the pty: Handle it
* Wrote to masterfd, slave fd has that input, alert readline to read it.
*/
if (FD_ISSET(slavefd, &rset))
rl_callback_read_char();
/* Input received through the pty.
* Readline read from slavefd, and it wrote to the masterfd.
*/
if (FD_ISSET(masterfd, &rset))
if ( readline_input() == -1 )
return -1;
/* Input received: Handle it, write to masterfd (input to readline) */
if (FD_ISSET(STDIN_FILENO, &rset))
if ( user_input() == -1 )
return -1;
}
return 0;
}
/* The terminal attributes before calling tty_cbreak */
static struct termios save_termios;
static struct winsize size;
static enum { RESET, TCBREAK } ttystate = RESET;
/* tty_cbreak: Sets terminal to cbreak mode. Also known as noncanonical mode.
* 1. Signal handling is still turned on, so the user can still type those.
* 2. echo is off
* 3. Read in one char at a time.
*
* fd - The file descriptor of the terminal
*
* Returns: 0 on sucess, -1 on error
*/
int tty_cbreak(int fd){
struct termios buf;
int ttysavefd = -1;
if(tcgetattr(fd, &save_termios) < 0)
return -1;
buf = save_termios;
buf.c_lflag &= ~(ECHO | ICANON);
buf.c_iflag &= ~(ICRNL | INLCR);
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
#if defined (VLNEXT) && defined (_POSIX_VDISABLE)
buf.c_cc[VLNEXT] = _POSIX_VDISABLE;
#endif
#if defined (VDSUSP) && defined (_POSIX_VDISABLE)
buf.c_cc[VDSUSP] = _POSIX_VDISABLE;
#endif
if(tcsetattr(fd, TCSAFLUSH, &buf) < 0)
return -1;
ttystate = TCBREAK;
ttysavefd = fd;
/* set size */
if(ioctl(fd, TIOCGWINSZ, (char *)&size) < 0)
return -1;
#ifdef DEBUG
err_msg("%d rows and %d cols\n", size.ws_row, size.ws_col);
#endif
return (0);
}
/* tty_reset: Sets the terminal attributes back to their previous state.
* PRE: tty_cbreak must have already been called.
*
* fd - The file descrioptor of the terminal to reset.
*
* Returns: 0 on success, -1 on error
*/
int tty_reset(int fd){
if(ttystate != TCBREAK)
return (0);
if(tcsetattr(fd, TCSAFLUSH, &save_termios) < 0)
return (-1);
ttystate = RESET;
return 0;
}
int
main()
{
int val;
val = openpty (&masterfd, &slavefd, NULL, NULL, NULL);
if (val == -1)
return -1;
val = init_readline (slavefd, slavefd);
if (val == -1)
return -1;
val = tty_cbreak (STDIN_FILENO);
if (val == -1)
return -1;
signal (SIGINT, sigint);
val = main_loop ();
tty_reset (STDIN_FILENO);
if (val == -1)
return -1;
return 0;
}
+11 -3
View File
@@ -2819,9 +2819,17 @@ parse_matched_pair (qc, open, close, lenp, flags)
ttrans = ansiexpand (nestret, 0, nestlen - 1, &ttranslen);
xfree (nestret);
nestret = sh_single_quote (ttrans);
free (ttrans);
nestlen = strlen (nestret);
if ((rflags & P_DQUOTE) == 0)
{
nestret = sh_single_quote (ttrans);
free (ttrans);
nestlen = strlen (nestret);
}
else
{
nestret = ttrans;
nestlen = ttranslen;
}
retind -= 2; /* back up before the $' */
}
else if MBTEST(was_dollar && ch == '"' && (extended_quote || (rflags & P_DQUOTE) == 0))
+2 -12
View File
@@ -2881,18 +2881,8 @@ add_nestret:
nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags);
else if (ch == '[') /* ] */
nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags);
if (nestret == &matched_pair_error)
{
free (ret);
return &matched_pair_error;
}
if (nestlen)
{
RESIZE_MALLOCED_BUFFER (ret, retind, nestlen, retsize, 64);
strcpy (ret + retind, nestret);
retind += nestlen;
}
FREE (nestret);
goto add_nestret;
}
was_dollar = MBTEST(ch == '$');
}
+7 -1
View File
@@ -197,12 +197,18 @@ static int want_initial_help; /* --help option */
int debugging_mode = 0; /* In debugging mode with --debugger */
int no_line_editing = 0; /* Don't do fancy line editing. */
int posixly_correct = 0; /* Non-zero means posix.2 superset. */
int dump_translatable_strings; /* Dump strings in $"...", don't execute. */
int dump_po_strings; /* Dump strings in $"..." in po format */
int wordexp_only = 0; /* Do word expansion only */
int protected_mode = 0; /* No command substitution with --wordexp */
#if defined (STRICT_POSIX)
int posixly_correct = 1; /* Non-zero means posix.2 superset. */
#else
int posixly_correct = 0; /* Non-zero means posix.2 superset. */
#endif
/* Some long-winded argument names. These are obviously new. */
#define Int 1
#define Charp 2
+19 -20
View File
@@ -1,6 +1,6 @@
/* shell.c -- GNU's idea of the POSIX shell specification. */
/* Copyright (C) 1987-2004 Free Software Foundation, Inc.
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -96,10 +96,11 @@ extern int shell_level;
extern int subshell_environment;
extern int last_command_exit_value;
extern int line_number;
extern char *primary_prompt, *secondary_prompt;
extern int expand_aliases;
extern char *this_command_name;
extern int array_needs_making;
extern int gnu_error_format;
extern char *primary_prompt, *secondary_prompt;
extern char *this_command_name;
/* Non-zero means that this shell has already been run; i.e. you should
call shell_reinitialize () if you need to start afresh. */
@@ -361,7 +362,7 @@ main (argc, argv, env)
#endif /* __CYGWIN__ */
/* Wait forever if we are debugging a login shell. */
while (debugging_login_shell);
while (debugging_login_shell) sleep (3);
set_default_locale ();
@@ -386,6 +387,8 @@ main (argc, argv, env)
/* Initialize `local' variables for all `invocations' of main (). */
arg_index = 1;
if (arg_index > argc)
arg_index = argc;
command_execution_string = (char *)NULL;
want_pending_command = locally_skip_execution = read_from_stdin = 0;
default_input = stdin;
@@ -511,7 +514,7 @@ main (argc, argv, env)
alias expansion in non-interactive shells, and other Posix.2 things. */
if (posixly_correct)
{
bind_variable ("POSIXLY_CORRECT", "y");
bind_variable ("POSIXLY_CORRECT", "y", 0);
sv_strict_posix ("POSIXLY_CORRECT");
}
@@ -532,13 +535,14 @@ main (argc, argv, env)
term = get_string_value ("TERM");
no_line_editing |= term && (STREQ (term, "emacs"));
emacs = get_string_value ("EMACS");
running_under_emacs = emacs ? ((strmatch ("*term*", emacs, 0) == 0) ? 2 : 1)
: 0;
running_under_emacs = emacs ? ((strstr (emacs, "term") != 0) ? 2 : 1) : 0;
#if 0
no_line_editing |= emacs && emacs[0] == 't' && emacs[1] == '\0';
#else
no_line_editing |= emacs && emacs[0] == 't' && emacs[1] == '\0' && STREQ (term, "dumb");
#endif
if (running_under_emacs)
gnu_error_format = 1;
}
top_level_arg_index = arg_index;
@@ -610,7 +614,7 @@ main (argc, argv, env)
/* If we are invoked as `sh', turn on Posix mode. */
if (act_like_sh)
{
bind_variable ("POSIXLY_CORRECT", "y");
bind_variable ("POSIXLY_CORRECT", "y", 0);
sv_strict_posix ("POSIXLY_CORRECT");
}
@@ -1270,7 +1274,7 @@ bind_args (argv, arg_start, arg_end, start_index)
register int i;
WORD_LIST *args;
for (i = arg_start, args = (WORD_LIST *)NULL; i != arg_end; i++)
for (i = arg_start, args = (WORD_LIST *)NULL; i < arg_end; i++)
args = make_word_list (make_word (argv[i]), args);
if (args)
{
@@ -1478,17 +1482,12 @@ set_bash_input ()
/* with_input_from_stdin really means `with_input_from_readline' */
if (interactive && no_line_editing == 0)
with_input_from_stdin ();
else
#if defined (BUFFERED_INPUT)
{
if (interactive == 0)
with_input_from_buffered_stream (default_buffered_input, dollar_vars[0]);
else
with_input_from_stream (default_input, dollar_vars[0]);
}
#else /* !BUFFERED_INPUT */
else if (interactive == 0)
with_input_from_buffered_stream (default_buffered_input, dollar_vars[0]);
#endif /* BUFFERED_INPUT */
else
with_input_from_stream (default_input, dollar_vars[0]);
#endif /* !BUFFERED_INPUT */
}
/* Close the current shell script input source and forget about it. This is
@@ -1526,7 +1525,7 @@ set_shell_name (argv0)
{
/* Here's a hack. If the name of this shell is "sh", then don't do
any startup files; just try to be more like /bin/sh. */
shell_name = base_pathname (argv0);
shell_name = argv0 ? base_pathname (argv0) : PROGRAM;
if (*shell_name == '-')
{
@@ -1539,7 +1538,7 @@ set_shell_name (argv0)
if (shell_name[0] == 's' && shell_name[1] == 'u' && shell_name[2] == '\0')
su_shell++;
shell_name = argv0;
shell_name = argv0 ? argv0 : PROGRAM;
FREE (dollar_vars[0]);
dollar_vars[0] = savestring (shell_name);
+1
View File
@@ -0,0 +1 @@
# tests 6856 passed 6856 failed 0
+257
View File
@@ -0,0 +1,257 @@
# Usage: $SHELL ifs.sh
#
# This script generates 6856 tests for the set(1) and read(1)
# builtins w.r.t. IFS whitespace and non-whitespace characters.
# Each failed test produces one line on the standard output that
# contains the test along with the expected and actual results.
# The last output line contains the test result counts. ordered>0
# are the number of tests where IFS=": " produced different results
# than IFS=" :". If a test fails the same way for IFS=": " and
# IFS=" :" then the second output line is suppressed.
TESTS=6856
ksh_read=0
echo 1 | read ksh_read
ksh_arith=0
eval '((ksh_arith+=1))' 2>/dev/null
failed=0
ordered=0
passed=0
split()
{
i=$1 s=$2 r=$3 S='' R=''
for ifs in ': ' ' :'
do IFS=$ifs
set x $i
shift
IFS=' '
g="[$#]"
while :
do case $# in
0) break ;;
esac
g="$g($1)"
shift
done
case $g in
"$s") case $ksh_arith in
1) ((passed+=1)) ;;
*) passed=`expr $passed + 1` ;;
esac
case $S in
'') S=$g
;;
"$g") ;;
*) case $ksh_arith in
1) ((ordered+=1)) ;;
*) ordered=`expr $ordered + 1` ;;
esac
;;
esac
;;
"$S") case $ksh_arith in
1) ((failed+=1)) ;;
*) failed=`expr $failed + 1` ;;
esac
;;
*) case $ksh_arith in
1) ((failed+=1)) ;;
*) failed=`expr $failed + 1` ;;
esac
case $s in
"$S") ;;
?0*) echo "IFS=\"$ifs\"; x=\"$i\"; set x \$x; shift; echo \"[\$#]\" # expected \"$s\" got \"$g\"" ;;
?1*) echo "IFS=\"$ifs\"; x=\"$i\"; set x \$x; shift; echo \"[\$#](\$1)\" # expected \"$s\" got \"$g\"" ;;
?2*) echo "IFS=\"$ifs\"; x=\"$i\"; set x \$x; shift; echo \"[\$#](\$1)(\$2)\" # expected \"$s\" got \"$g\"" ;;
?3*) echo "IFS=\"$ifs\"; x=\"$i\"; set x \$x; shift; echo \"[\$#](\$1)(\$2)(\$3)\" # expected \"$s\" got \"$g\"" ;;
*) echo TEST ERROR i="'$i'" s="'$s'" ;;
esac
case $S in
'') S=$g
;;
"$g") ;;
*) case $ksh_arith in
1) ((ordered+=1)) ;;
*) ordered=`expr $ordered + 1` ;;
esac
;;
esac
esac
case $ksh_read in
1) echo "$i" | IFS=$ifs read x y; g="($x)($y)" ;;
*) g=`export ifs; echo "$i" | ( IFS=$ifs; read x y; echo "($x)($y)" )` ;;
esac
case $g in
"$r") case $ksh_arith in
1) ((passed+=1)) ;;
*) passed=`expr $passed + 1` ;;
esac
case $R in
'') R=$g
;;
"$g") ;;
*) case $ksh_arith in
1) ((ordered+=1)) ;;
*) ordered=`expr $ordered + 1` ;;
esac
;;
esac
;;
"$R") case $ksh_arith in
1) ((failed+=1)) ;;
*) failed=`expr $failed + 1` ;;
esac
;;
*) case $ksh_arith in
1) ((failed+=1)) ;;
*) failed=`expr $failed + 1` ;;
esac
case $r in
"$R") ;;
*) echo "echo \"$i\" | ( IFS=\"$ifs\" read x y; echo \"(\$x)(\$y)\" ) # expected \"$r\" got \"$g\"" ;;
esac
case $R in
'') R=$g
;;
"$g") ;;
*) case $ksh_arith in
1) ((ordered+=1)) ;;
*) ordered=`expr $ordered + 1` ;;
esac
;;
esac
;;
esac
done
}
for str in \
'-' \
'a' \
'- -' \
'- a' \
'a -' \
'a b' \
'- - -' \
'- - a' \
'- a -' \
'- a b' \
'a - -' \
'a - b' \
'a b -' \
'a b c' \
do
IFS=' '
set x $str
shift
case $# in
0) continue ;;
esac
f1=$1
case $f1 in
'-') f1='' ;;
esac
shift
case $# in
0) for d0 in '' ' '
do
for d1 in '' ' ' ':' ' :' ': ' ' : '
do
case $f1$d1 in
'') split "$d0$f1$d1" "[0]" "()()" ;;
' ') ;;
*) split "$d0$f1$d1" "[1]($f1)" "($f1)()" ;;
esac
done
done
continue
;;
esac
f2=$1
case $f2 in
'-') f2='' ;;
esac
shift
case $# in
0) for d0 in '' ' '
do
for d1 in ' ' ':' ' :' ': ' ' : '
do
case ' ' in
$f1$d1|$d1$f2) continue ;;
esac
for d2 in '' ' ' ':' ' :' ': ' ' : '
do
case $f2$d2 in
'') split "$d0$f1$d1$f2$d2" "[1]($f1)" "($f1)()" ;;
' ') ;;
*) split "$d0$f1$d1$f2$d2" "[2]($f1)($f2)" "($f1)($f2)" ;;
esac
done
done
done
continue
;;
esac
f3=$1
case $f3 in
'-') f3='' ;;
esac
shift
case $# in
0) for d0 in '' ' '
do
for d1 in ':' ' :' ': ' ' : '
do
case ' ' in
$f1$d1|$d1$f2) continue ;;
esac
for d2 in ' ' ':' ' :' ': ' ' : '
do
case $f2$d2 in
' ') continue ;;
esac
case ' ' in
$f2$d2|$d2$f3) continue ;;
esac
for d3 in '' ' ' ':' ' :' ': ' ' : '
do
case $f3$d3 in
'') split "$d0$f1$d1$f2$d2$f3$d3" "[2]($f1)($f2)" "($f1)($f2)" ;;
' ') ;;
*) x=$f2$d2$f3$d3
x=${x#' '}
x=${x%' '}
split "$d0$f1$d1$f2$d2$f3$d3" "[3]($f1)($f2)($f3)" "($f1)($x)"
;;
esac
done
done
done
done
continue
;;
esac
done
case $ksh_arith in
1) ((tests=passed+failed)) ;;
*) tests=`expr $passed + $failed` ;;
esac
case $ordered in
0) ordered="" ;;
*) ordered=" ordered $ordered" ;;
esac
case $tests in
$TESTS) fatal="" ;;
*) fatal=" -- fundamental IFS error -- $TESTS tests expected"
esac
echo "# tests $tests passed $passed failed $failed$ordered$fatal"
+1 -1
View File
@@ -56,7 +56,7 @@ fg-bg 6
./jobs.tests: line 95: fg: -s: invalid option
fg: usage: fg [job_spec]
./jobs.tests: line 96: bg: -s: invalid option
bg: usage: bg [job_spec]
bg: usage: bg [job_spec ...]
./jobs.tests: line 101: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ...]
./jobs.tests: line 105: disown: %1: no such job
+105
View File
@@ -0,0 +1,105 @@
./jobs2.sub: line 9: fg: job 1 started without job control
fg: 1
Waiting for job 0
job 0 returns 0
Waiting for job 1
job 1 returns 0
Waiting for job 2
job 2 returns 0
Waiting for job 3
job 3 returns 0
Waiting for job 4
job 4 returns 0
Waiting for job 5
job 5 returns 0
Waiting for job 6
job 6 returns 0
Waiting for job 7
job 7 returns 0
[1] Running sleep 5 &
[2] Running sleep 5 &
[3] Running sleep 5 &
[4]- Running sleep 5 &
[5]+ Running ( sleep 5; exit 4 ) &
4
0
i killed it
0
./jobs.tests: line 19: wait: %1: no such job
./jobs.tests: line 24: fg: no job control
wait-for-pid
wait-errors
./jobs.tests: line 37: wait: `1-1': not a pid or valid job spec
./jobs.tests: line 38: wait: `-4': not a pid or valid job spec
wait-for-background-pids
async list wait-for-background-pids
async list wait for child
forked
wait-when-no-children
wait-for-job
./jobs.tests: line 60: wait: %2: no such job
127
async list wait-for-job
forked
fg-bg 1
sleep 5
fg-bg 2
sleep 5
fg-bg 3
sleep 5
fg-bg 4
sleep 5
fg-bg 5
./jobs.tests: line 87: fg: %2: no such job
./jobs.tests: line 88: bg: job 1 already in background
fg-bg 6
./jobs.tests: line 95: fg: -s: invalid option
fg: usage: fg [job_spec]
./jobs.tests: line 96: bg: -s: invalid option
bg: usage: bg [job_spec]
./jobs.tests: line 101: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ...]
./jobs.tests: line 105: disown: %1: no such job
./jobs.tests: line 108: disown: %2: no such job
wait-for-non-child
./jobs.tests: line 111: wait: pid 1 is not a child of this shell
127
3 -- 1 2 3 -- 1 - 2 - 3
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
running jobs:
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
./jobs.tests: line 127: kill: %4: no such job
./jobs.tests: line 129: jobs: %4: no such job
current job:
[3]+ Running sleep 400 &
previous job:
[2]- Running sleep 350 &
after kill -STOP
running jobs:
[1] Running sleep 300 &
[3]- Running sleep 400 &
stopped jobs:
[2]+ Stopped sleep 350
after disown
[2]+ Stopped sleep 350
[3]- Running sleep 400 &
running jobs:
[3]- Running sleep 400 &
stopped jobs:
[2]+ Stopped sleep 350
after kill -s CONT
running jobs:
[2]+ Running sleep 350 &
[3]- Running sleep 400 &
stopped jobs:
after kill -STOP, backgrounding %3:
[3]+ sleep 400 &
killing...
done
after KILL -STOP, foregrounding %1
sleep 10
done
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./ifs-posix.tests > /tmp/xx 2>&1
diff /tmp/xx ifs-posix.right && rm -f /tmp/xx
+1 -1
View File
@@ -27,7 +27,7 @@ do
*.orig|*~) ;;
run-dollars|run-execscript|run-func|run-getopts|run-heredoc) echo $x ; sh $x ;;
run-ifs-tests|run-input-test|run-invert|run-more-exp|run-nquote) echo $x ; sh $x ;;
run-posix2|run-posixpat) echo $x ; sh $x ;;
run-ifs-0posix|run-posix2|run-posixpat) echo $x ; sh $x ;;
run-precedence|run-quote|run-read|run-rhs-exp|run-strip|run-tilde) echo $x ; sh $x ;;
*) ;;
esac