]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20110506 snapshot
authorChet Ramey <chet.ramey@case.edu>
Thu, 29 Dec 2011 18:07:43 +0000 (13:07 -0500)
committerChet Ramey <chet.ramey@case.edu>
Thu, 29 Dec 2011 18:07:43 +0000 (13:07 -0500)
13 files changed:
CWRU/CWRU.chlog
MANIFEST
builtins/printf.def
doc/bash.1
doc/bashref.texi
pathexp.c
pcomplib.c
sig.h
tests/errors.right
tests/errors.tests
tests/errors1.sub [new file with mode: 0644]
tests/read.right
tests/read3.sub

index b26e93992ba031c31f9692b566040111d225df8f..b9c6398115b3bf563dddd825f8e90fb01daf2aa2 100644 (file)
@@ -11549,3 +11549,31 @@ lib/sh/eaccess.c
          of the actual file permissions), so reorganize code to check the
          file permissions as with eaccess.  Report and fix from Johan Hattne
          <johan.hattne@utsouthwestern.edu>
+
+                                   5/2
+                                   ---
+doc/{bash.1,bashref.texi}
+       - add forward reference to `Pattern Matching' from `Pathname
+         Expansion', suggested by Greg Wooledge <wooledg@eeg.ccf.org>
+
+                                   5/5
+                                   ---
+pcomplib.c
+       - the bash_completion project now distributes over 200 completions
+         for various programs, with no end in sight, so increase the value
+         of COMPLETE_HASH_BUCKETS from 32 to 128
+
+pathexp.c
+       - quote_string_for_globbing: make sure CTLESC quoting CTLESC is
+         translated into \<CTLESC> even if the flags include QGLOB_REGEXP.
+         We don't want to process the second CTLESC as a quote character.
+         Fixes bug reported by Shawn Bohrer <sbohrer@rgmadvisors.com>
+
+                                   5/6
+                                   ---
+builtins/printf.def
+       - change PRETURN to not call fflush if ferror(stdout) is true
+       - if a call to one of the stdio functions or printstr leaves
+         ferror(stdout) true, and PRETURN is going to be called, let PRETURN
+         print the error message rather than doubling up the messages.  Fixes
+         problem reported by Roman Rakus <rrakus@redhat.com>
index 880609753e7b9b961c2527747f6930d7d2a2f7d6..4449ac0f6361f1db63ea5425b6e7370a95764c2f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -845,6 +845,7 @@ tests/dstack2.tests f
 tests/dstack2.right    f
 tests/errors.tests     f
 tests/errors.right     f
+tests/errors1.sub      f
 tests/execscript       f
 tests/exec.right       f
 tests/exec1.sub                f       755
index 9eca2152147a9ac33fd3111d43498a1bed41a3a9..6dac76010527bd221f914b423b32bfe4327a25f9 100644 (file)
@@ -158,7 +158,8 @@ extern int errno;
       else if (vbuf) \
        vbuf[0] = 0; \
       terminate_immediately--; \
-      fflush (stdout); \
+      if (ferror (stdout) == 0) \
+       fflush (stdout); \
       if (ferror (stdout)) \
        { \
          sh_wrerror (); \
@@ -481,8 +482,11 @@ printf_builtin (list)
                n = printstr (start, timebuf, strlen (timebuf), fieldwidth, precision); /* XXX - %s for now */
                if (n < 0)
                  {
-                   sh_wrerror ();
-                   clearerr (stdout);
+                   if (ferror (stdout) == 0)
+                     {
+                       sh_wrerror ();
+                       clearerr (stdout);
+                     }
                    PRETURN (EXECUTION_FAILURE);
                  }
                break;
@@ -522,8 +526,11 @@ printf_builtin (list)
                    r = printstr (start, xp, rlen, fieldwidth, precision);
                    if (r < 0)
                      {
-                       sh_wrerror ();
-                       clearerr (stdout);
+                       if (ferror (stdout) == 0)
+                         {
+                           sh_wrerror ();
+                           clearerr (stdout);
+                         }
                        retval = EXECUTION_FAILURE;
                      }
                    free (xp);
@@ -645,8 +652,7 @@ printf_builtin (list)
 
       if (ferror (stdout))
        {
-         sh_wrerror ();
-         clearerr (stdout);
+         /* PRETURN will print error message. */
          PRETURN (EXECUTION_FAILURE);
        }
     }
index a5e62a2d72662130e29ecfdd0e596a84dbbd9559..61c46b4e2f69ca9f1728fd30bbae0556e32097c2 100644 (file)
@@ -3124,7 +3124,11 @@ If one of these characters appears, then the word is
 regarded as a
 .IR pattern ,
 and replaced with an alphabetically sorted list of
-file names matching the pattern.
+file names matching the pattern
+(see
+.SM
+.B "Pattern Matching"
+below).
 If no matching file names are found,
 and the shell option
 .B nullglob
index df2620fc4986ac7e8dd2e990a8e591f15437de86..7c1bbb3a042b4a828e23d8cfe3222b610f8586dd 100644 (file)
@@ -2044,7 +2044,8 @@ After word splitting, unless the @option{-f} option has been set
 If one of these characters appears, then the word is
 regarded as a @var{pattern},
 and replaced with an alphabetically sorted list of
-file names matching the pattern. If no matching file names are found,
+file names matching the pattern (@pxref{Pattern Matching}).
+If no matching file names are found,
 and the shell option @code{nullglob} is disabled, the word is left
 unchanged.
 If the @code{nullglob} option is set, and no matches are found, the word
index 42f21e4c86edbb0d977ee75f941b5fd654bda4e0..f23995684acbe42a25af6bb4e7e68594890edc11 100644 (file)
--- a/pathexp.c
+++ b/pathexp.c
@@ -196,7 +196,7 @@ quote_string_for_globbing (pathname, qflags)
        {
          if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
            continue;
-         if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
+         if (pathname[i+1] != CTLESC && (qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
            continue;
          temp[j++] = '\\';
          i++;
index fe337e4aee3564a3ca31b937a291d5110bb99d52..7361bb17354c7144a1aa5db1c6d79d7525dbf610 100644 (file)
@@ -37,7 +37,7 @@
 #include "shell.h"
 #include "pcomplete.h"
 
-#define COMPLETE_HASH_BUCKETS  32      /* must be power of two */
+#define COMPLETE_HASH_BUCKETS  128     /* must be power of two */
 
 #define STRDUP(x)      ((x) ? savestring (x) : (char *)NULL)
 
diff --git a/sig.h b/sig.h
index 68b5497ce8c7da83f040796f7c4ce18419aa5988..dd3f81008bb7fa2d3d108aa2066dfa04f85d0a5c 100644 (file)
--- a/sig.h
+++ b/sig.h
@@ -96,13 +96,11 @@ do { \
   sigprocmask (SIG_BLOCK, &nvar, &ovar); \
 } while (0)
 
-#define UNBLOCK_SIGNAL(ovar)   sigprocmask (SIG_SETMASK, &ovar, (sigset_t)NULL)
+#define UNBLOCK_SIGNAL(ovar) sigprocmask (SIG_SETMASK, &ovar, (sigset_t *) NULL)
 
 #if defined (HAVE_POSIX_SIGNALS)
-#  define BLOCK_CHILD(nvar, ovar) \
-       BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
-#  define UNBLOCK_CHILD(ovar) \
-       sigprocmask (SIG_SETMASK, &ovar, (sigset_t *) NULL)
+#  define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
+#  define UNBLOCK_CHILD(ovar) UNBLOCK_SIGNAL(ovar)
 #else /* !HAVE_POSIX_SIGNALS */
 #  define BLOCK_CHILD(nvar, ovar) ovar = sigblock (sigmask (SIGCHLD))
 #  define UNBLOCK_CHILD(ovar) sigsetmask (ovar)
index 7dd80c415b69d3c73f858b18e4a3aace9bc94486..b3e0125fccf20be1a05de312b9c2045375be5fee 100644 (file)
@@ -98,4 +98,13 @@ trap: usage: trap [-lp] [[arg] signal_spec ...]
 ./errors.tests: line 250: kill: `': not a pid or valid job spec
 kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
 ./errors.tests: line 255: set: trackall: invalid option name
-./errors.tests: line 262: `!!': not a valid identifier
+./errors1.sub: line 1: .: -i: invalid option
+.: usage: . filename [arguments]
+./errors1.sub: line 9: shift: -4: shift count out of range
+./errors1.sub: line 5: return: -1: invalid option
+return: usage: return [n]
+./errors1.sub: line 14: break: -1: loop count out of range
+./errors1.sub: line 20: return: -2: invalid option
+return: usage: return [n]
+after f
+./errors.tests: line 264: `!!': not a valid identifier
index 4ead467b1807b0b5e5d08229c80df6299aa8fab3..e339f60dfe7a6ff7667865129f423cf8876236cd 100644 (file)
@@ -254,6 +254,8 @@ kill -INT
 # bad shell option names
 set -o trackall                # bash is not ksh
 
+${THIS_SH} ./errors1.sub
+
 # this must be last!
 # in posix mode, a function name must be a valid identifier
 # this can't go in posix2.tests, since it causes the shell to exit
diff --git a/tests/errors1.sub b/tests/errors1.sub
new file mode 100644 (file)
index 0000000..8e7440b
--- /dev/null
@@ -0,0 +1,27 @@
+. -i /dev/tty
+
+f()
+{
+       return -1
+}
+
+set -- a b c
+shift -4
+
+f
+
+for f in 1 2 3; do
+       break -1
+done
+
+
+f()
+{
+       return -25
+}
+
+f
+echo after f
+exit -25
+
+exit -56
index d9632a8bb8bdeb08029d5856b7923a05fbd626ba..73cb7042fbcaea2f1b7fdc37b2f1dcece65ece49 100644 (file)
@@ -44,6 +44,7 @@ abcde
 ./read3.sub: line 4: read: -1: invalid number
 abc
 ab
+abc
 #
 while read -u 3 var
 do
index 22088cbf3c71711628fc87b653029de30d1fc0be..af41e3f279309165c84f61a3c578e303c96e19fd 100644 (file)
@@ -15,5 +15,10 @@ echo ab | {
        echo $xyz
 }
 
+echo abc | {
+       read -N 4 -d$'\n' foo
+       echo $foo
+}
+
 read -n 1 < $0
 echo "$REPLY"