From: Chet Ramey Date: Thu, 12 Sep 2013 12:54:38 +0000 (-0400) Subject: commit bash-20130809 snapshot X-Git-Tag: bash-4.4-alpha~133 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9353cc0550725ebfbb1bebd3cc336616f122001e;p=thirdparty%2Fbash.git commit bash-20130809 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 6c4063301..62cfa45bd 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -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 + Fixes bug report from Geir Hauge 8/3 --- Makefile.in - pcomplete.o: add dependency on $(DEFDIR)/builtext.h. Suggested by Curtis Doty + + 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 + + + 8/6 + --- +doc/{bash.1,bashref.texi},builtins/hash.def,lib/readline/doc/rluser.texi + - minor typo changes from Geir Hauge + +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 + + 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 diff --git a/builtins/fc.def b/builtins/fc.def index 6394a6294..a4aa10e64 100644 --- a/builtins/fc.def +++ b/builtins/fc.def @@ -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; diff --git a/builtins/hash.def b/builtins/hash.def index b75a42d43..85ef364bc 100644 --- a/builtins/hash.def +++ b/builtins/hash.def @@ -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 diff --git a/builtins/help.def b/builtins/help.def index 7cf260847..1894f177e 100644 --- a/builtins/help.def +++ b/builtins/help.def @@ -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; } } diff --git a/doc/bash.1 b/doc/bash.1 index 6a0e98921..72568fecb 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -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 diff --git a/doc/bashref.texi b/doc/bashref.texi index 14c2e72ef..d92d3056c 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -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} diff --git a/doc/version.texi b/doc/version.texi index a75f8575e..d358355a7 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -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 diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c index b4344b00b..7e7f538f5 100644 --- a/lib/glob/sm_loop.c +++ b/lib/glob/sm_loop.c @@ -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); } diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index 93ea3c048..d35713f77 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -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 diff --git a/lib/readline/util.c b/lib/readline/util.c index f43e02387..795cddd94 100644 --- a/lib/readline/util.c +++ b/lib/readline/util.c @@ -393,7 +393,7 @@ _rl_strnicmp (string1, string2, count) break; s2++; } - while (--count != 0) + while (--count != 0); return (0); }