]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20130809 snapshot
authorChet Ramey <chet@caleb.ins.cwru.edu>
Thu, 12 Sep 2013 12:54:38 +0000 (08:54 -0400)
committerChet Ramey <chet@caleb.ins.cwru.edu>
Thu, 12 Sep 2013 12:54:38 +0000 (08:54 -0400)
CWRU/CWRU.chlog
builtins/fc.def
builtins/hash.def
builtins/help.def
doc/bash.1
doc/bashref.texi
doc/version.texi
lib/glob/sm_loop.c
lib/readline/doc/rluser.texi
lib/readline/util.c

index 6c4063301f78217bb04d7069a25df55d3fa1b79c..62cfa45bd9805f7b8c9a3882a29498e50e416c97 100644 (file)
@@ -5130,10 +5130,39 @@ arrayfunc.c
        - assign_array_element_internal: before using array_max_index() when
          processing a negative subscript, make sure the variable is an array.
          if it's not, use 0 as array_max_index assuming it's a string.
-         Bug report from Geir Hauge <geir.hauge@gmail.com>
+         Fixes bug report from Geir Hauge <geir.hauge@gmail.com>
 
                                    8/3
                                    ---
 Makefile.in
        - pcomplete.o: add dependency on $(DEFDIR)/builtext.h. Suggested by
          Curtis Doty <curtis@greenkey.net>
+
+                                   8/5
+                                   ---
+lib/glob/sm_loop.c
+       - strcompare: short-circuit and return FNM_NOMATCH if the lengths of the
+         pattern and string (pe - p  and se - s, respectively) are not equal
+       - strcompare: don't bother trying to set *pe or *se to '\0' if that's
+         what they already are.  Fixes bug reported by Geir Hauge
+         <geir.hauge@gmail.com>
+
+                                   8/6
+                                   ---
+doc/{bash.1,bashref.texi},builtins/hash.def,lib/readline/doc/rluser.texi
+       - minor typo changes from Geir Hauge <geir.hauge@gmail.com>
+
+bultins/help.def
+       - show_longdoc: avoid trying to translate the empty string because it
+         often translates to some boilerplate about the project and
+         translation.  Report and fix from Geir Hauge <geir.hauge@gmail.com>
+
+                                   8/8
+                                   ---
+builtins/help.def
+       - help_builtin: try two passes through the list of help topics for each
+         argument: one doing exact string matching and one, if the first pass
+         fails to find a match, doing string prefix matching like previous
+         versions.  This prevents `help read' from matching both `read' and
+         `readonly', but allows `help r' to match everything beginning with
+         `r'.  Inspired by report from Geir Hauge <geir.hauge@gmail.com>
index 6394a6294d41642393f913f0d2fa73f18a057841..a4aa10e64658ed9a6b45b9d715e76dd3aac6ff08 100644 (file)
@@ -510,6 +510,10 @@ fc_gethnum (command, hlist)
   if (command == NULL)
     return (i);
 
+  /* back up from the end to the last non-null history entry */
+  while (hlist[real_last] == 0 && real_last > 0)
+    real_last--;
+
   /* Otherwise, there is a specification.  It can be a number relative to
      the current position, or an absolute history number. */
   s = command;
index b75a42d43e9e4a01efd38980d77eeb130e898afa..85ef364bc8be2b0cfdeb9f3af0186e04ecff5704 100644 (file)
@@ -1,7 +1,7 @@
 This file is hash.def, from which is created hash.c.
 It implements the builtin "hash" in Bash.
 
-Copyright (C) 1987-2010 Free Software Foundation, Inc.
+Copyright (C) 1987-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -31,7 +31,7 @@ no arguments are given, information about remembered commands is displayed.
 Options:
   -d           forget the remembered location of each NAME
   -l           display in a format that may be reused as input
-  -p pathname  use PATHNAME is the full pathname of NAME
+  -p pathname  use PATHNAME as the full pathname of NAME
   -r           forget all remembered locations
   -t           print the remembered location of each NAME, preceding
                each location with the corresponding NAME if multiple
index 7cf2608475af6b0aa5b0835f0cca97c2b828b12e..1894f177e12775db2c66d7562300b6b9e446a771 100644 (file)
@@ -1,7 +1,7 @@
 This file is help.def, from which is created help.c.
 It implements the builtin "help" in Bash.
 
-Copyright (C) 1987-2012 Free Software Foundation, Inc.
+Copyright (C) 1987-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -92,7 +92,7 @@ help_builtin (list)
 {
   register int i;
   char *pattern, *name;
-  int plen, match_found, sflag, dflag, mflag;
+  int plen, match_found, sflag, dflag, mflag, m, pass, this_found;
 
   dflag = sflag = mflag = 0;
   reset_internal_getopt ();
@@ -137,29 +137,43 @@ help_builtin (list)
       pattern = list->word->word;
       plen = strlen (pattern);
 
-      for (i = 0; name = shell_builtins[i].name; i++)
+      for (pass = 1, this_found = 0; pass < 3; pass++)
        {
-         QUIT;
-         if ((strcmp (pattern, name) == 0) ||
-             (strmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH))
+         for (i = 0; name = shell_builtins[i].name; i++)
            {
-             match_found++;
-             if (dflag)
-               {
-                 show_desc (name, i);
-                 continue;
-               }
-             else if (mflag)
-               {
-                 show_manpage (name, i);
-                 continue;
-               }
-
-             printf ("%s: %s\n", name, _(shell_builtins[i].short_doc));
-
-             if (sflag == 0)
-               show_longdoc (i);
+             QUIT;
+
+             /* First pass: look for exact string or pattern matches.
+                Second pass: look for prefix matches like bash-4.2 */
+             if (pass == 1)
+               m = (strcmp (pattern, name) == 0) ||
+                   (strmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH);
+             else
+               m = strncmp (pattern, name, plen) == 0;
+
+             if (m)
+               {
+                 this_found = 1;
+                 match_found++;
+                 if (dflag)
+                   {
+                     show_desc (name, i);
+                     continue;
+                   }
+                 else if (mflag)
+                   {
+                     show_manpage (name, i);
+                     continue;
+                   }
+
+                 printf ("%s: %s\n", name, _(shell_builtins[i].short_doc));
+
+                 if (sflag == 0)
+                   show_longdoc (i);
+               }
            }
+         if (pass == 1 && this_found == 1)
+           break;
        }
     }
 
index 6a0e98921d7195013f1b3046dd6d0d90c1412fdd..72568fecb0ee4810e67858daf54af48894e073cf 100644 (file)
@@ -5,12 +5,12 @@
 .\"    Case Western Reserve University
 .\"    chet@po.cwru.edu
 .\"
-.\"    Last Change: Thu Aug  1 15:59:19 EDT 2013
+.\"    Last Change: Tue Aug  6 09:55:50 EDT 2013
 .\"
 .\" bash_builtins, strip all but Built-Ins section
 .if \n(zZ=1 .ig zZ
 .if \n(zY=1 .ig zY
-.TH BASH 1 "2013 August 1" "GNU Bash 4.3"
+.TH BASH 1 "2013 August 6" "GNU Bash 4.3"
 .\"
 .\" There's some problem with having a `@'
 .\" in a tagged paragraph with the BSD man macros.
@@ -2372,7 +2372,7 @@ The value of \fIp\fP determines whether or not the fraction is
 included.
 .IP
 If this variable is not set, \fBbash\fP acts as if it had the
-value \fB$\(aq\enreal\et%3lR\enuser\et%3lU\ensys\e\t%3lS\(aq\fP.
+value \fB$\(aq\enreal\et%3lR\enuser\et%3lU\ensys\ett%3lS\(aq\fP.
 If the value is null, no timing information is displayed.
 A trailing newline is added when the format string is displayed.
 .PD 0
@@ -6375,7 +6375,7 @@ completion function would load completions dynamically:
 .br
 }
 .br
-complete -D -F _completion_loader
+complete -D -F _completion_loader -o bashdefault -o default
 .br
 \fP
 .SH HISTORY
@@ -10081,7 +10081,7 @@ subsequently reset.  The exit status is true unless a
 .I name
 is readonly.
 .TP
-\fBwait\fP [\fB\--n\fP] [\fIn ...\fP]
+\fBwait\fP [\fB\-n\fP] [\fIn ...\fP]
 Wait for each specified child process and return its termination status.
 Each
 .I n
@@ -10091,7 +10091,7 @@ in that job's pipeline are waited for.  If
 .I n
 is not given, all currently active child processes
 are waited for, and the return status is zero.
-If the \fB\--n\fP option is supplied, \fBwait\fP waits for any job to
+If the \fB\-n\fP option is supplied, \fBwait\fP waits for any job to
 terminate and returns its exit status.
 If
 .I n
index 14c2e72ef804d815b60453d8a9cdbe2969fd9cee..d92d3056ced994c14fed5032077595a169352d7e 100644 (file)
@@ -7586,7 +7586,7 @@ or non-zero if an error occurs or an invalid option is encountered.
 @item wait
 @btindex wait
 @example
-wait [@var{jobspec} or @var{pid} @dots{}]
+wait [-n] [@var{jobspec} or @var{pid} @dots{}]
 @end example
 
 Wait until the child process specified by each process @sc{id} @var{pid}
index a75f8575e76d5be415734222cb858c5fe657b920..d358355a72f3d7ad2eae63d88632e37d9a5306c3 100644 (file)
@@ -2,9 +2,9 @@
 Copyright (C) 1988-2013 Free Software Foundation, Inc.
 @end ignore
 
-@set LASTCHANGE Thu Aug  1 15:58:51 EDT 2013
+@set LASTCHANGE Tue Aug  6 09:56:12 EDT 2013
 
 @set EDITION 4.3
 @set VERSION 4.3
-@set UPDATED 1 August 2013
+@set UPDATED 6 August 2013
 @set UPDATED-MONTH August 2013 
index b4344b00b67aef39b0d1d4fb7357ea227fa4c28d..7e7f538f53a55686fd447a92db859c7a30875f3d 100644 (file)
@@ -626,19 +626,32 @@ STRCOMPARE (p, pe, s, se)
 {
   int ret;
   CHAR c1, c2;
+  int l1, l2;
 
+  l1 = pe - p;
+  l2 = se - s;
+
+  if (l1 != l2)
+    return (FNM_NOMATCH);      /* unequal lengths, can't be identical */
+  
   c1 = *pe;
   c2 = *se;
 
-  *pe = *se = '\0';
+  if (c1 != 0)
+    *pe = '\0';
+  if (c2 != 0)
+    *se = '\0';
+    
 #if HAVE_MULTIBYTE || defined (HAVE_STRCOLL)
   ret = STRCOLL ((XCHAR *)p, (XCHAR *)s);
 #else
   ret = STRCMP ((XCHAR *)p, (XCHAR *)s);
 #endif
 
-  *pe = c1;
-  *se = c2;
+  if (c1 != 0)
+    *pe = c1;
+  if (c2 != 0)
+    *se = c2;
 
   return (ret == 0 ? ret : FNM_NOMATCH);
 }
index 93ea3c04812767941d0ccaac1337940e7532569f..d35713f77719451650fd6928fc5ddfbfc3aaec49 100644 (file)
@@ -1833,7 +1833,7 @@ _completion_loader()
 @{
     . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
 @}
-complete -D -F _completion_loader
+complete -D -F _completion_loader -o bashdefault -o default
 @end example
 
 @node Programmable Completion Builtins
index f43e02387997361847b96c891b60c4beb7566e1c..795cddd9417cb105f1e4e7a471b1a5c98ce45ba0 100644 (file)
@@ -393,7 +393,7 @@ _rl_strnicmp (string1, string2, count)
         break;
       s2++;
     }
-  while (--count != 0)
+  while (--count != 0);
 
   return (0);
 }