commit bash-20041118 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:39:51 -05:00
parent ec2199bd30
commit f75912ae36
26 changed files with 631 additions and 109 deletions
+30 -1
View File
@@ -10373,7 +10373,7 @@ execute_cmd.c
builtin is not special, since `command' means that preceding variable
assignments don't persist in the environment. Fixes problem with
variable assignments preceding command preceding special builtin
kept those variable assignments around (when in posix mode)
keeping those variable assignments around (when in posix mode)
10/20
-----
@@ -10571,3 +10571,32 @@ lib/intl/dcigettext.c
lib/malloc/trace.c
- put extern declaration for imalloc_fopen inside the MALLOC_TRACE
#ifdef
11/16
-----
lib/intl/Makefile.in
- make sure SHELL is defined to cpp
lib/intl/dcigettext.c
- make sure we use getcwd() even if HAVE_GETCWD is not defined after
including config.h; if SHELL is defined, #define HAVE_GETCWD
11/18
-----
trap.[ch]
- new function, int signal_in_progress(int sig), returns TRUE if the
trap handler for signal SIG is currently executing
11/19
-----
redir.c
- slightly change do_redirection_internal to set the close-on-exec
flag for file descriptors > 2 used to save file descriptors < 2
using explicit redirections (e.g., `exec 3>&1'). This keeps file
descriptors pointing to pipes from being left open but doesn't
change the shell's file descriptor semantics
11/20
-----
doc/{bash.1,bashref.texi}
- correct some minor typos, forwarded from doko@debian.org
+29 -1
View File
@@ -10373,7 +10373,7 @@ execute_cmd.c
builtin is not special, since `command' means that preceding variable
assignments don't persist in the environment. Fixes problem with
variable assignments preceding command preceding special builtin
kept those variable assignments around (when in posix mode)
keeping those variable assignments around (when in posix mode)
10/20
-----
@@ -10567,3 +10567,31 @@ lib/readline/display.c
lib/intl/dcigettext.c
- make sure `raise' is defined if HAVE_RAISE is not before
eval-plurah.h is included
lib/malloc/trace.c
- put extern declaration for imalloc_fopen inside the MALLOC_TRACE
#ifdef
11/16
-----
lib/intl/Makefile.in
- make sure SHELL is defined to cpp
lib/intl/dcigettext.c
- make sure we use getcwd() even if HAVE_GETCWD is not defined after
including config.h; if SHELL is defined, #define HAVE_GETCWD
11/18
-----
trap.[ch]
- new function, int signal_in_progress(int sig), returns TRUE if the
trap handler for signal SIG is currently executing
11/19
-----
redir.c
- slightly change do_redirection_internal to set the close-on-exec
flag for file descriptors > 2 used to save file descriptors < 2
using explicit redirections (e.g., `exec 3>&1'). This keeps file
descriptors pointing to pipes from being left open but doesn't
change the shell's file descriptor semantics
+4
View File
@@ -675,6 +675,8 @@ examples/misc/cshtobash f
tests/README f
tests/alias.tests f
tests/alias.right f
tests/appendop.tests f
tests/appendop.right f
tests/arith-for.tests f
tests/arith-for.right f
tests/arith.tests f
@@ -784,6 +786,7 @@ tests/new-exp1.sub f
tests/new-exp2.sub f
tests/new-exp3.sub f
tests/new-exp4.sub f
tests/new-exp5.sub f
tests/new-exp.right f
tests/nquote.tests f
tests/nquote.right f
@@ -830,6 +833,7 @@ tests/rsh.right f
tests/run-all f
tests/run-minimal f
tests/run-alias f
tests/run-appendop f
tests/run-arith-for f
tests/run-arith f
tests/run-array f
+83 -83
View File
@@ -15,96 +15,96 @@
'configure.in'
],
{
'AM_GNU_GETTEXT' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_CANONICAL_HOST' => 1,
'AM_CONDITIONAL' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_C_CONST' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_PROG_LN_S' => 1,
'AC_LIBSOURCE' => 1,
'AC_PROG_CC' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_FUNC_ALLOCA' => 1,
'm4_pattern_forbid' => 1,
'AC_PROG_RANLIB' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_C_VOLATILE' => 1,
'AC_FUNC_GETPGRP' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_HEADER_MAJOR' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_TYPE_SIZE_T' => 1,
'AC_TYPE_PID_T' => 1,
'm4_pattern_allow' => 1,
'AC_PROG_CXX' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_SUBST' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AC_FUNC_MMAP' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AC_PROG_LEX' => 1,
'AC_PROG_AWK' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_CHECK_TYPES' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_PATH_X' => 1,
'include' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_FUNC_REALLOC' => 1,
'AC_CONFIG_FILES' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_TYPE_PID_T' => 1,
'AC_CHECK_LIB' => 1,
'AC_HEADER_SYS_WAIT' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_FUNC_FORK' => 1,
'AC_FUNC_GETPGRP' => 1,
'include' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_LIBSOURCE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_PROG_LN_S' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_HEADER_MAJOR' => 1,
'm4_pattern_forbid' => 1,
'AC_FUNC_GETLOADAVG' => 1,
'AC_FUNC_STRCOLL' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FUNC_UTIME_NULL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_CHECK_TYPES' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_FUNC_GETMNTENT' => 1,
'AC_STRUCT_TM' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_STRUCT_ST_BLOCKS' => 1,
'AC_PROG_CXX' => 1,
'AC_PATH_X' => 1,
'AC_PROG_INSTALL' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_HEADER_STDC' => 1,
'AH_OUTPUT' => 1,
'AC_FUNC_STRFTIME' => 1,
'AC_FUNC_MALLOC' => 1,
'AC_TYPE_SIGNAL' => 1,
'AC_PROG_YACC' => 1,
'AC_C_VOLATILE' => 1,
'AC_PROG_CPP' => 1,
'AC_INIT' => 1,
'm4_include' => 1,
'AC_HEADER_TIME' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_FUNC_STRERROR_R' => 1,
'AC_INIT' => 1,
'AC_FUNC_STRCOLL' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_CHECK_FUNCS' => 1,
'AH_OUTPUT' => 1,
'AC_FUNC_VPRINTF' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_CHECK_LIB' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_STRUCT_TM' => 1,
'AC_PROG_CPP' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AC_HEADER_DIRENT' => 1,
'AC_FUNC_ERROR_AT_LINE' => 1,
'AC_HEADER_STDC' => 1,
'AC_FUNC_SELECT_ARGTYPES' => 1,
'AC_STRUCT_TIMEZONE' => 1,
'AC_HEADER_STAT' => 1,
'AC_TYPE_MODE_T' => 1,
'AC_FUNC_SETPGRP' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_FUNC_LSTAT' => 1,
'AC_FUNC_CHOWN' => 1,
'AC_TYPE_UID_T' => 1,
'AC_FUNC_FORK' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_PROG_INSTALL' => 1,
'AC_CONFIG_FILES' => 1,
'AC_FUNC_STAT' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_DECL_SYS_SIGLIST' => 1,
'AC_FUNC_MKTIME' => 1,
'AC_FUNC_MBRTOWC' => 1,
'AC_C_INLINE' => 1,
'AC_FUNC_SETVBUF_REVERSED' => 1,
'AC_PROG_YACC' => 1
'AC_FUNC_REALLOC' => 1,
'AC_FUNC_STRNLEN' => 1,
'AC_PROG_CC' => 1,
'm4_pattern_allow' => 1,
'AC_PROG_AWK' => 1,
'AC_CHECK_MEMBERS' => 1,
'AC_FUNC_WAIT3' => 1,
'AC_C_CONST' => 1,
'AC_FUNC_MEMCMP' => 1,
'AC_PROG_RANLIB' => 1,
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
'AM_CONDITIONAL' => 1,
'AC_FUNC_MMAP' => 1,
'AC_FUNC_GETGROUPS' => 1,
'AC_HEADER_STAT' => 1,
'AC_PROG_MAKE_SET' => 1,
'AC_FUNC_CLOSEDIR_VOID' => 1,
'AC_FUNC_FSEEKO' => 1,
'AC_FUNC_OBSTACK' => 1,
'AC_CHECK_HEADERS' => 1,
'AC_FUNC_STRTOD' => 1,
'AC_TYPE_OFF_T' => 1,
'AC_SUBST' => 1,
'AC_CHECK_FUNCS' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_REPLACE_FNMATCH' => 1,
'AC_FUNC_STAT' => 1,
'AC_FUNC_ALLOCA' => 1,
'AC_PROG_GCC_TRADITIONAL' => 1,
'AC_CANONICAL_HOST' => 1
}
], 'Request' )
);
+52
View File
@@ -0,0 +1,52 @@
*** ../bash-2.05b-patched/builtins/common.c Fri Jun 28 12:24:31 2002
--- builtins/common.c Thu Sep 30 22:25:20 2004
***************
*** 455,464 ****
{
char *directory;
if (no_symbolic_links)
{
! if (the_current_working_directory)
! free (the_current_working_directory);
!
the_current_working_directory = (char *)NULL;
}
--- 469,477 ----
{
char *directory;
+ size_t dsize;
if (no_symbolic_links)
{
! FREE (the_current_working_directory);
the_current_working_directory = (char *)NULL;
}
***************
*** 466,480 ****
if (the_current_working_directory == 0)
{
! the_current_working_directory = (char *)xmalloc (PATH_MAX);
! the_current_working_directory[0] = '\0';
! directory = getcwd (the_current_working_directory, PATH_MAX);
! if (directory == 0)
{
! fprintf (stderr, "%s: could not get current directory: %s: %s\n",
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
! bash_getcwd_errstr, strerror (errno));
!
! free (the_current_working_directory);
! the_current_working_directory = (char *)NULL;
return (char *)NULL;
}
--- 479,488 ----
if (the_current_working_directory == 0)
{
! the_current_working_directory = getcwd (0, 0);
! if (the_current_working_directory == 0)
{
! fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
(for_whom && *for_whom) ? for_whom : get_name_for_error (),
! _(bash_getcwd_errstr), strerror (errno));
return (char *)NULL;
}
+144
View File
@@ -0,0 +1,144 @@
*** ../bash-2.05b-patched/builtins/cd.def Mon Jul 15 14:51:39 2002
--- builtins/cd.def Sun Nov 7 15:13:42 2004
***************
*** 122,126 ****
the_current_working_directory () */
static char *
! resetpwd ()
{
char *tdir;
--- 124,129 ----
the_current_working_directory () */
static char *
! resetpwd (caller)
! char *caller;
{
char *tdir;
***************
*** 128,132 ****
FREE (the_current_working_directory);
the_current_working_directory = (char *)NULL;
! tdir = get_working_directory ("cd");
return (tdir);
}
--- 131,135 ----
FREE (the_current_working_directory);
the_current_working_directory = (char *)NULL;
! tdir = get_working_directory (caller);
return (tdir);
}
***************
*** 333,336 ****
--- 340,349 ----
directory = tcwd ? (verbatim_pwd ? sh_physpath (tcwd, 0) : tcwd)
: get_working_directory ("pwd");
+
+ /* Try again using getcwd() if canonicalization fails (for instance, if
+ the file system has changed state underneath bash). */
+ if (tcwd && directory == 0)
+ directory = resetpwd ("pwd");
+
#undef tcwd
***************
*** 364,368 ****
{
char *t, *tdir;
! int err, canon_failed;
tdir = (char *)NULL;
--- 379,383 ----
{
char *t, *tdir;
! int err, canon_failed, r;
tdir = (char *)NULL;
***************
*** 399,403 ****
if (posixly_correct && nolinks == 0 && canon_failed)
{
! errno = ENOENT;
return (0);
}
--- 414,423 ----
if (posixly_correct && nolinks == 0 && canon_failed)
{
! #if defined ENAMETOOLONG
! if (errno != ENOENT && errno != ENAMETOOLONG)
! #else
! if (errno != ENOENT)
! #endif
! errno = ENOTDIR;
return (0);
}
***************
*** 409,418 ****
shell's idea of the_current_working_directory. */
if (canon_failed)
- resetpwd ();
- else
{
! FREE (the_current_working_directory);
! the_current_working_directory = tdir;
}
return (1);
--- 429,439 ----
shell's idea of the_current_working_directory. */
if (canon_failed)
{
! t = resetpwd ("cd");
! if (t == 0)
! set_working_directory (tdir);
}
+ else
+ set_working_directory (tdir);
return (1);
***************
*** 425,429 ****
err = errno;
- free (tdir);
/* We're not in physical mode (nolinks == 0), but we failed to change to
--- 446,449 ----
***************
*** 432,445 ****
if (chdir (newdir) == 0)
{
! tdir = resetpwd ();
! FREE (tdir);
! return (1);
}
else
{
errno = err;
! return (0);
}
}
--- 452,471 ----
if (chdir (newdir) == 0)
{
! t = resetpwd ("cd");
! if (t == 0)
! set_working_directory (tdir);
! else
! free (t);
! r = 1;
}
else
{
errno = err;
! r = 0;
}
+
+ free (tdir);
+ return r;
}
+91
View File
@@ -0,0 +1,91 @@
*** ../bash-2.05b-patched/aclocal.m4 Tue Jun 25 09:45:43 2002
--- aclocal.m4 Sat Oct 9 15:03:28 2004
***************
*** 686,691 ****
AC_DEFUN(BASH_FUNC_GETCWD,
! [AC_MSG_CHECKING([if getcwd() calls popen()])
! AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
[AC_TRY_RUN([
#include <stdio.h>
--- 686,691 ----
AC_DEFUN(BASH_FUNC_GETCWD,
! [AC_MSG_CHECKING([if getcwd() will dynamically allocate memory])
! AC_CACHE_VAL(bash_cv_getcwd_malloc,
[AC_TRY_RUN([
#include <stdio.h>
***************
*** 694,748 ****
#endif
- #ifndef __STDC__
- #ifndef const
- #define const
- #endif
- #endif
-
- int popen_called;
-
- FILE *
- popen(command, type)
- const char *command;
- const char *type;
- {
- popen_called = 1;
- return (FILE *)NULL;
- }
-
- FILE *_popen(command, type)
- const char *command;
- const char *type;
- {
- return (popen (command, type));
- }
-
- int
- pclose(stream)
- FILE *stream;
- {
- return 0;
- }
-
- int
- _pclose(stream)
- FILE *stream;
- {
- return 0;
- }
-
main()
{
! char lbuf[32];
! popen_called = 0;
! getcwd(lbuf, 32);
! exit (popen_called);
}
! ], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
! [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
! bash_cv_getcwd_calls_popen=no]
)])
! AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
! if test $bash_cv_getcwd_calls_popen = yes; then
AC_DEFINE(GETCWD_BROKEN)
AC_LIBOBJ(getcwd)
--- 694,709 ----
#endif
main()
{
! char *xpwd;
! xpwd = getcwd(0, 0);
! exit (xpwd == 0);
}
! ], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
! [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
! bash_cv_getcwd_malloc=no]
)])
! AC_MSG_RESULT($bash_cv_getcwd_malloc)
! if test $bash_cv_getcwd_malloc = no; then
AC_DEFINE(GETCWD_BROKEN)
AC_LIBOBJ(getcwd)
+7 -8
View File
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
.\" Last Change: Sat Nov 13 15:05:55 EST 2004
.\" Last Change: Sat Nov 20 12:23:43 EST 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 Nov 13" "GNU Bash-3.1-devel"
.TH BASH 1 "2004 Nov 20" "GNU Bash-3.1-devel"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -951,7 +951,7 @@ below).
.PP
Words of the form \fB$\fP'\fIstring\fP' are treated specially. The
word expands to \fIstring\fP, with backslash-escaped characters replaced
as specifed by the ANSI C standard. Backslash escape sequences, if
as specified by the ANSI C standard. Backslash escape sequences, if
present, are decoded as follows:
.RS
.PD 0
@@ -2273,7 +2273,7 @@ interpreted as part of the name.
.PP
When braces are used, the matching ending brace is the first `\fB}\fP'
not escaped by a backslash or within a quoted string, and not within an
embedded arithmetic expansion, command substitution, or paramter
embedded arithmetic expansion, command substitution, or parameter
expansion.
.PP
.PD 0
@@ -3471,7 +3471,7 @@ If \fIbase#\fP is omitted, then base 10 is used.
The digits greater than 9 are represented by the lowercase letters,
the uppercase letters, @, and _, in that order.
If \fIbase\fP is less than or equal to 36, lowercase and uppercase
letters may be used interchangably to represent numbers between 10
letters may be used interchangeably to represent numbers between 10
and 35.
.PP
Operators are evaluated in order of precedence. Sub-expressions in
@@ -4594,7 +4594,7 @@ attempts word completion.
.TP
.B history-preserve-point
If set to \fBon\fP, the history code attempts to place point at the
same location on each history line retrived with \fBprevious-history\fP
same location on each history line retrieved with \fBprevious-history\fP
or \fBnext-history\fP.
.TP
.B horizontal\-scroll\-mode (Off)
@@ -8531,8 +8531,7 @@ refers to a shell variable.
Read-only variables may not be unset.
If
.B \-f
is specifed,
each
is specified, each
.I name
refers to a shell function, and the function definition
is removed.
+4 -2
View File
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
.\" Last Change: Tue Nov 9 16:30:56 EST 2004
.\" Last Change: Sat Nov 13 15:05:55 EST 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 Nov 9" "GNU Bash-3.1-devel"
.TH BASH 1 "2004 Nov 13" "GNU Bash-3.1-devel"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -2375,6 +2375,8 @@ the result is the \fIlength\fP
members of the array beginning with ${\fIparameter\fP[\fIoffset\fP]}.
A negative \fIoffset\fP is taken relative to one greater than the maximum
index of the specified array.
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the :- expansion.
Substring indexing is zero-based unless the positional parameters
are used, in which case the indexing starts at 1.
.TP
+1 -1
View File
@@ -5444,7 +5444,7 @@ omitted, then base 10 is used.
The digits greater than 9 are represented by the lowercase letters,
the uppercase letters, @samp{@@}, and @samp{_}, in that order.
If @var{base} is less than or equal to 36, lowercase and uppercase
letters may be used interchangably to represent numbers between 10
letters may be used interchangeably to represent numbers between 10
and 35.
Operators are evaluated in order of precedence. Sub-expressions in
+2
View File
@@ -1601,6 +1601,8 @@ the result is the @var{length}
members of the array beginning with @code{$@{@var{parameter}[@var{offset}]@}}.
A negative @var{offset} is taken relative to one greater than the maximum
index of the specified array.
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the @samp{:-} expansion.
Substring indexing is zero-based unless the positional parameters
are used, in which case the indexing starts at 1.
+2 -3
View File
@@ -2,10 +2,9 @@
Copyright (C) 1988-2004 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sat Nov 13 15:06:31 EST 2004
@set LASTCHANGE Sat Nov 20 12:34:34 EST 2004
@set EDITION 3.1-devel
@set VERSION 3.1-devel
@set UPDATED 13 November 2004
@set UPDATED 20 November 2004
@set UPDATED-MONTH November 2004
+3 -2
View File
@@ -2,9 +2,10 @@
Copyright (C) 1988-2004 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sat Nov 13 15:06:31 EST 2004
@set EDITION 3.1-devel
@set VERSION 3.1-devel
@set UPDATED 9 November 2004
@set UPDATED 13 November 2004
@set UPDATED-MONTH November 2004
@set LASTCHANGE Tue Nov 9 16:30:45 EST 2004
+3 -1
View File
@@ -51,12 +51,14 @@ RANLIB = @RANLIB@
YACC = @INTLBISON@ -y -d
YFLAGS = --name-prefix=__gettext
LOCAL_DEFS = @LOCAL_DEFS@
DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
-DLIBDIR=\"$(prefix)/libdata\" -DIN_LIBINTL \
-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
-Dset_relocation_prefix=libintl_set_relocation_prefix \
-Drelocate=libintl_relocate \
-DDEPENDS_ON_LIBICONV=1 @DEFS@
-DDEPENDS_ON_LIBICONV=1 @DEFS@ @LOCAL_DEFS@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
+4
View File
@@ -134,6 +134,10 @@ extern int errno;
/* @@ end of prolog @@ */
#if defined (SHELL) && !defined (HAVE_GETCWD)
# define HAVE_GETCWD
#endif
#ifdef _LIBC
/* Rename the non ANSI C functions. This is required by the standard
because some ANSI C functions will require linking with this object
+6 -2
View File
@@ -893,10 +893,14 @@ do_redirection_internal (redirect, flags)
leaves the flag unset on the new descriptor, which means it
stays open. Only set the close-on-exec bit for file descriptors
greater than 2 in any case, since 0-2 should always be open
unless closed by something like `exec 2<&-'. */
unless closed by something like `exec 2<&-'. It should always
be safe to set fds > 2 to close-on-exec if they're being used to
save file descriptors < 2, since we don't need to preserve the
state of the close-on-exec flag for those fds -- they should
always be open. */
/* if ((already_set || set_unconditionally) && (ok_to_set))
set_it () */
if (((fcntl (redir_fd, F_GETFD, 0) == 1) || (flags & RX_CLEXEC)) &&
if (((fcntl (redir_fd, F_GETFD, 0) == 1) || redir_fd < 2 || (flags & RX_CLEXEC)) &&
(redirector > 2))
SET_CLOSE_ON_EXEC (redirector);
+2 -1
View File
@@ -896,7 +896,7 @@ do_redirection_internal (redirect, flags)
unless closed by something like `exec 2<&-'. */
/* if ((already_set || set_unconditionally) && (ok_to_set))
set_it () */
if (((fcntl (redir_fd, F_GETFD, 0) == 1) || (flags & RX_CLEXEC)) &&
if (((fcntl (redir_fd, F_GETFD, 0) == 1) || (flags & RX_CLEXEC) || redir_fd < 2) &&
(redirector > 2))
SET_CLOSE_ON_EXEC (redirector);
@@ -943,6 +943,7 @@ add_undo_redirect (fd)
REDIRECT *new_redirect, *closer, *dummy_redirect;
new_fd = fcntl (fd, F_DUPFD, SHELL_FD_BASE);
if (new_fd < 0)
{
sys_error (_("redirection error: cannot duplicate fd"));
+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
+18
View File
@@ -0,0 +1,18 @@
14
1 2 3 4 5 6
1 2 3 4 51 6
5
14
7
42
1 2 3 4 12
18
1 2 3 4 18
1 2 7 4 5
1 2 7 13 5 9
14
9
4
9
16
./appendop.tests: line 83: x: readonly variable
+83
View File
@@ -0,0 +1,83 @@
# basic cases
a=1
a+=4
echo $a
x=(1 2 3)
x+=(4 5 6)
echo ${x[@]}
x[4]+=1
echo ${x[@]}
# trickier cases
a+=5 printenv a
echo $a
# if the integer flag is set, ksh93 appears to do arithmetic += and evaluate
# old value as an arithmetic expression
a=
typeset -i a
a+=7
echo $a
b=4+1
typeset -i b
b+=37
echo $b
unset x
x=(1 2 3 4 5)
typeset -i x
x[4]+=7
echo ${x[@]}
unset x
typeset -i x
x=([0]=7+11)
echo ${x[@]}
unset x
x=(1 2 3 4 5)
typeset -i x
#x[4]=7+11
x=(1 2 3 4 [4]=7+11 )
echo ${x[@]}
x=( 1 2 [2]+=7 4 5 )
echo ${x[@]}
x+=( [3]+=9 [5]=9 )
echo ${x[@]}
unset a
a=1
export a+=4
printenv a
printenv a+
unset x
typeset -i x=4+5
echo $x
unset x
typeset x+=4
echo $x
typeset -i x+=5
echo $x
readonly x+=7
echo $x
x+=5
+18 -1
View File
@@ -479,4 +479,21 @@ argv[1] = </full/path/to>
argv[1] = </>
argv[1] = <full/path/to/x16>
argv[1] = <x16>
./new-exp.tests: line 545: ABXD: parameter unset
two
one
ne
one
one
one
one
1 2 3 4 5 6 7 8 9
9
9
0
9
8 9
123456789
9
9
./new-exp.tests: line 547: ABXD: parameter unset
+2
View File
@@ -540,6 +540,8 @@ recho ${1%%[!/]*}
recho ${1#*/}
recho ${1##*/}
${THIS_SH} ./new-exp5.sub
# this must be last!
expect $0: 'ABXD: parameter unset'
recho ${ABXD:?"parameter unset"}
+30
View File
@@ -0,0 +1,30 @@
x=(one two)
echo ${x[@]:1}
echo ${x[@]:0:1}
x=(one)
echo ${x[0]:1}
echo ${x[0]:0}
echo ${x[@]:1}
echo ${x[@]:0}
echo ${x[@]: -1}
echo ${x[@]: ${#x[@]}-1}
x=(0 1 2 3 4 5 6 7 8 9)
echo ${x[@]:1}
echo ${x[@]: -1}
echo ${x[@]: ${#x[@]}-1}
set -- ${x[@]}
echo $1
echo ${@: -1}
echo ${@: $#-1}
a=0123456789
echo ${a:1}
echo ${a: -1}
echo ${a: ${#a}-1}
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./appendop.tests > /tmp/xx 2>&1
diff /tmp/xx appendop.right && rm -f /tmp/xx
+9 -2
View File
@@ -384,8 +384,8 @@ set_sigchld_trap (command_string)
}
#endif
/* Make COMMAND_STRING be executed when SIGCHLD is caught iff the current
SIGCHLD trap handler is DEFAULT_SIG. */
/* Make COMMAND_STRING be executed when SIGCHLD is caught iff SIGCHLD
is not already trapped. */
void
maybe_set_sigchld_trap (command_string)
char *command_string;
@@ -985,3 +985,10 @@ set_signal_ignored (sig)
sigmodes[sig] |= SIG_HARD_IGNORE;
original_signals[sig] = SIG_IGN;
}
int
signal_in_progress (sig)
int sig;
{
return (sigmodes[sig] & SIG_INPROGRESS);
}
+1
View File
@@ -93,5 +93,6 @@ extern int signal_is_trapped __P((int));
extern int signal_is_ignored __P((int));
extern int signal_is_special __P((int));
extern void set_signal_ignored __P((int));
extern int signal_in_progress __P((int));
#endif /* _TRAP_H_ */