]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20041118 snapshot
authorChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 18:39:51 +0000 (13:39 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 18:39:51 +0000 (13:39 -0500)
26 files changed:
CWRU/CWRU.chlog
CWRU/CWRU.chlog~
MANIFEST
autom4te.cache/requests
d1 [new file with mode: 0644]
d1a [new file with mode: 0644]
d1b [new file with mode: 0644]
doc/bash.1
doc/bash.1~
doc/bashref.texi
doc/bashref.texi~
doc/version.texi
doc/version.texi~
lib/intl/Makefile.in
lib/intl/dcigettext.c
redir.c
redir.c~
tests/RUN-ONE-TEST
tests/appendop.right [new file with mode: 0644]
tests/appendop.tests [new file with mode: 0644]
tests/new-exp.right
tests/new-exp.tests
tests/new-exp5.sub [new file with mode: 0644]
tests/run-appendop [new file with mode: 0644]
trap.c
trap.h

index 9c5bfbe01a3627f3923ee44987d2596bf0217caa..2e44b26000fb0c27dcb3e24997bfb1d877c6eaf7 100644 (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
index 7c33ff46af578d9085a7bc39f3962b79478d78ad..a56617dce70796f9d7b7102118ce51027c93a687 100644 (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
index 6edc5c73bd19152dc7be394c54b2f832b5826ad8..154e63ac14a98ffd60ff629a9a950a2a6252b256 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -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
index b2ba2eeb8cc309cbe775cdf0007ae22765cfc7a1..3782f115455923534f56d65b7c355ab5e6bdb2ce 100644 (file)
                         '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_TYPE_SIZE_T' => 1,
+                        'AC_TYPE_MODE_T' => 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_PROG_LEX' => 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_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_PROG_LEX' => 1,
-                        'AC_PROG_AWK' => 1,
-                        'AC_REPLACE_FNMATCH' => 1,
-                        'AM_PROG_CC_C_O' => 1,
+                        'AM_INIT_AUTOMAKE' => 1,
+                        'AC_DEFINE_TRACE_LITERAL' => 1,
+                        'AC_FUNC_ERROR_AT_LINE' => 1,
                         'AC_CHECK_TYPES' => 1,
-                        'AC_FUNC_GETLOADAVG' => 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,
-                        'include' => 1,
-                        'AC_PROG_GCC_TRADITIONAL' => 1,
-                        'AC_FUNC_REALLOC' => 1,
-                        'AC_HEADER_SYS_WAIT' => 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,
+                        'AC_PROG_INSTALL' => 1,
+                        'AC_FUNC_SETVBUF_REVERSED' => 1,
+                        'AC_HEADER_STDC' => 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_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_FUNC_LSTAT' => 1,
+                        'AC_FUNC_CHOWN' => 1,
+                        'AC_TYPE_UID_T' => 1,
+                        'AC_DECL_SYS_SIGLIST' => 1,
+                        'AC_FUNC_MKTIME' => 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_C_INLINE' => 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_TYPE_MODE_T' => 1,
-                        'AC_FUNC_SETPGRP' => 1,
-                        'AC_FUNC_MKTIME' => 1,
-                        'AC_TYPE_UID_T' => 1,
-                        'AC_FUNC_FORK' => 1,
-                        'AC_CONFIG_HEADERS' => 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_PROG_INSTALL' => 1,
-                        'AC_CONFIG_FILES' => 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,
-                        'AM_INIT_AUTOMAKE' => 1,
-                        'AC_FUNC_FSEEKO' => 1,
-                        'AC_C_INLINE' => 1,
-                        'AC_FUNC_SETVBUF_REVERSED' => 1,
-                        'AC_PROG_YACC' => 1
+                        'AC_FUNC_ALLOCA' => 1,
+                        'AC_PROG_GCC_TRADITIONAL' => 1,
+                        'AC_CANONICAL_HOST' => 1
                       }
                     ], 'Request' )
            );
diff --git a/d1 b/d1
new file mode 100644 (file)
index 0000000..92d20ef
--- /dev/null
+++ b/d1
@@ -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;
+       }
diff --git a/d1a b/d1a
new file mode 100644 (file)
index 0000000..7e66dc4
--- /dev/null
+++ b/d1a
@@ -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;
+  }
+
+
+
diff --git a/d1b b/d1b
new file mode 100644 (file)
index 0000000..8d93c20
--- /dev/null
+++ b/d1b
@@ -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)
index 8158e7d0f341fcab8011c2d273d6a9a3c9160c45..2ad480414c8331d37e3aae11a532990521cf679a 100644 (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.
index 24eda81aabf86f0e2b610c9d9bf66daa63118b43..8158e7d0f341fcab8011c2d273d6a9a3c9160c45 100644 (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
index 79985e79b522fa253de8a34a20c5af68fbb5c663..56bd77275608765a6145771fb8465b17e7c85605 100644 (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
index fe1707643466a97dcefbdd26fb07b2e4300f2a57..79985e79b522fa253de8a34a20c5af68fbb5c663 100644 (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.
 
index cea6a587728f276615a025a42be30f611d29a4e1..5390950e096d46c122da238dd25cf7939c4b23b4 100644 (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
-
index a00628593b47e31282ccfeae2ea6e76074478f9d..cea6a587728f276615a025a42be30f611d29a4e1 100644 (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
index 70bafc9cd46cbba94ecd7651093483659a0c7c3e..8520ed2e3ab554d6e049fe2b7c0b5ceec4ffb93a 100644 (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@
index d4ea843f0a2fc2acc1c276389ea0a0c7bd5ac030..c7e696a8a3e8d8310cb033e7c782e28560755986 100644 (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
diff --git a/redir.c b/redir.c
index 3ee44ca96b96feba8ce62db947c07c8b478032ce..6c755ab18ac92df8fa7730d3669339a4dfdf7522 100644 (file)
--- a/redir.c
+++ b/redir.c
@@ -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);
 
index 8b587767f4dc32ed0d41fd9eb9451fef202c9876..1ec9a484b1edcbf00c7b3cfc76b1627a4dd24084 100644 (file)
--- a/redir.c~
+++ b/redir.c~
@@ -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"));
index 3efcf32d68e9722024b6ca9d67f9e81b2aa5ac04..72ec06a2c1fd8dde92acea5e8ac773e35f1d061b 100755 (executable)
@@ -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
 
diff --git a/tests/appendop.right b/tests/appendop.right
new file mode 100644 (file)
index 0000000..1e24333
--- /dev/null
@@ -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
diff --git a/tests/appendop.tests b/tests/appendop.tests
new file mode 100644 (file)
index 0000000..7b61f3f
--- /dev/null
@@ -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
index a2ad16f174a96c641ee87ea22eefe0e269b4f07c..c0ea065a9e31a7cefb6bd1f1d4c31fe8588dc9fd 100644 (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
index 5d806d6c9240e3de39565d5224cd23baeae22364..97837d0cd80e38fd5d8d0f61689997ee0389a7fe 100644 (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"}
diff --git a/tests/new-exp5.sub b/tests/new-exp5.sub
new file mode 100644 (file)
index 0000000..9b3e1b3
--- /dev/null
@@ -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}
diff --git a/tests/run-appendop b/tests/run-appendop
new file mode 100644 (file)
index 0000000..c5bffbc
--- /dev/null
@@ -0,0 +1,2 @@
+${THIS_SH} ./appendop.tests > /tmp/xx 2>&1
+diff /tmp/xx appendop.right && rm -f /tmp/xx
diff --git a/trap.c b/trap.c
index 3641caf38b1aef1b54e3caa416ac5ffba42d04a0..c2ee2961a008ca8afd856ddb06c08388f70a8765 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -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);
+}
diff --git a/trap.h b/trap.h
index f47fd8e6d62709e57f86e24216555a2c6ec553ee..d1600e0309997db4dab683aa3cc1d32f5a594048 100644 (file)
--- a/trap.h
+++ b/trap.h
@@ -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_ */