fix export environment if a local variable inherits the export attribute from a variable with the same name at a previous scope; changes to help builtin and glob pattern arguments; fix for fpurge declaration in a source file; man page typesetting updates

This commit is contained in:
Chet Ramey
2025-11-19 10:18:54 -05:00
parent 2fd02c8387
commit bcac47f08a
10 changed files with 67 additions and 32 deletions
+25
View File
@@ -12228,3 +12228,28 @@ execute_cmd.c
- time_command: make usage of the various preprocessor defines that
determine how we measure the command's duration consistent
From andrew@andrewoates.com
variables.c
- make_local_variable: if we inherit the export attribute from an
existing variable at a previous scope, set array_needs_making
Report from Grisha Levit <grishalevit@gmail.com>
builtins/help.def
- help_builtin: treat each pattern individually; print one message per
glob pattern instead of printing a comma-separated list of all
patterns and print a potential error message once per failing
pattern
- help_builtin: suggest using man or info only if the pattern is not
a glob pattern
Suggestion from Martin D Kealey <martin@kurahaupo.gen.nz>
11/17
-----
sig.c
- NEED_FPURGE_DECL: add before including externs.h, since we now call
fpurge
Report by Emanuele Torre <torreemanuele6@gmail.com>
doc/bash.1,doc/bashref.texi
- fix some options typeset in the wrong font
Report and patch from Grisha Levit <grishalevit@gmail.com>
+14 -16
View File
@@ -91,9 +91,9 @@ static void show_longdoc (int);
int
help_builtin (WORD_LIST *list)
{
register int i;
int i;
char *pattern, *name;
int match_found, sflag, dflag, mflag, m, pass, this_found;
int match_found, sflag, dflag, mflag, m, pass, this_found, globpat;
size_t plen;
dflag = sflag = mflag = 0;
@@ -128,18 +128,15 @@ help_builtin (WORD_LIST *list)
/* We should consider making `help bash' do something. */
if (glob_pattern_p (list->word->word) == 1)
{
printf ("%s", ngettext ("Shell commands matching keyword `", "Shell commands matching keywords `", (list->next ? 2 : 1)));
print_word_list (list, ", ");
printf ("%s", _("'\n\n"));
}
for (match_found = 0, pattern = ""; list; list = list->next)
{
pattern = list->word->word;
plen = strlen (pattern);
globpat = glob_pattern_p (pattern);
if (globpat)
printf (_("Shell commands matching pattern '%s':\n\n"), pattern);
for (pass = 1, this_found = 0; pass < 3; pass++)
{
for (i = 0; name = shell_builtins[i].name; i++)
@@ -178,15 +175,16 @@ help_builtin (WORD_LIST *list)
if (pass == 1 && this_found == 1)
break;
}
if (this_found == 0)
{
if (globpat)
builtin_error (_("no help topics match '%s'."), pattern);
else
builtin_error (_("no help topics match '%s'. Try 'help help', 'man -k %s', or 'info %s'."), pattern, pattern, pattern);
}
}
if (match_found == 0)
{
builtin_error (_("no help topics match `%s'. Try `help help' or `man -k %s' or `info %s'."), pattern, pattern, pattern);
return (EXECUTION_FAILURE);
}
return (sh_chkwrite (EXECUTION_SUCCESS));
return (match_found ? sh_chkwrite (EXECUTION_SUCCESS) : sh_chkwrite (EXECUTION_FAILURE));
}
void
+9 -8
View File
@@ -5,7 +5,7 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Mon Oct 6 09:57:24 EDT 2025
.\" Last Change: Mon Nov 17 11:37:04 EST 2025
.\"
.\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section
.\" For rbash, strip all but "RESTRICTED SHELL" section
@@ -22,7 +22,7 @@
.ds zX \" empty
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2025 October 6" "GNU Bash 5.3"
.TH BASH 1 "2025 November 17" "GNU Bash 5.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
@@ -8525,7 +8525,7 @@ programmable completion performs \fBreadline\fP's default completion.
.PP
The options supplied to \fBcomplete\fP and \fBcompopt\fP
can control how \fBreadline\fP treats the completions.
For instance, the \fI\-o fullquote\fP option tells \fBreadline\fP
For instance, the \fB\-o fullquote\fP option tells \fBreadline\fP
to quote the matches as if they were filenames.
See the description of \fBcomplete\fP below
for details.
@@ -9080,8 +9080,8 @@ require \fB\-\-\fP to prevent this interpretation.
.PP
All builtins except
\fB:\fP, \fBtrue\fP, \fBfalse\fP, \fBecho\fP, and \fBtest\fP/\fB[\fP
accept \fB--help\fP as a special option.
If \fB--help\fP is supplied, these builtins output
accept \fB\-\-help\fP as a special option.
If \fB\-\-help\fP is supplied, these builtins output
a help message and exit with a status of 0.
.PP
.PD 0
@@ -10219,7 +10219,7 @@ to force a search of the current directory.
The
.B \-d
option will delete a builtin previously loaded with \fB\-f\fP.
If \fI\-s\fP is used with \fI\-f\fP, the new builtin becomes a
If \fB\-s\fP is used with \fB\-f\fP, the new builtin becomes a
.SM POSIX
special builtin.
.IP
@@ -11057,8 +11057,9 @@ the next to last.
.PD
.RE
.IP
If the top element of the directory stack is modified, and
the \fI\-n\fP option was not supplied, \fBpopd\fP uses the \fBcd\fP
If the top element of the directory stack is modified,
and the \fB\-n\fP option was not supplied,
\fBpopd\fP uses the \fBcd\fP
builtin to change to the directory at the top of the stack.
If the \fBcd\fP fails, \fBpopd\fP returns a non-zero value.
.IP
+4 -3
View File
@@ -5338,7 +5338,7 @@ special builtins.
The @option{-f} option means to load the new builtin command @var{name}
from shared object @var{filename}, on systems that support dynamic loading.
If @var{filename} does not contain a slash.
If @var{filename} does not contain a slash,
Bash will use the value of the @env{BASH_LOADABLES_PATH} variable as a
colon-separated list of directories in which to search for @var{filename}.
The default for @env{BASH_LOADABLES_PATH} is system-dependent,
@@ -8941,8 +8941,9 @@ Remove the @var{N}th directory (counting from the right of the
list printed by @code{dirs}), starting with zero, from the stack.
@end table
If the top element of the directory stack is modified, and
the @option{-n} option was not supplied, @code{popd} uses the @code{cd}
If the top element of the directory stack is modified,
and the @option{-n} option was not supplied,
@code{popd} uses the @code{cd}
builtin to change to the directory at the top of the stack.
If the @code{cd} fails, @code{popd} returns a non-zero value.
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2025 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Wed Sep 24 09:35:21 EDT 2025
@set LASTCHANGE Mon Nov 17 11:37:24 EST 2025
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 24 September 2025
@set UPDATED-MONTH September 2025
@set UPDATED 17 November 2025
@set UPDATED-MONTH November 2025
+4
View File
@@ -1607,6 +1607,10 @@ readtok (void)
c = GEQ;
else if ((c == LT) && (c1 == EQ))
c = LEQ;
else if ((c == '&') && (c1 == '&'))
c = LAND;
else if ((c == '|') && (c1 == '|'))
c = LOR;
else if ((c == '*') && (c1 == '*'))
c = POWER;
else if ((c == '-' || c == '+') && c1 == c && curtok == STR)
+1
View File
@@ -53,6 +53,7 @@
# endif /* HAVE_SYS_PTE_H */
#endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
#include <errno.h>
#include <stdio.h>
/* Return the fd from which we are actually getting input. */
+2
View File
@@ -34,6 +34,8 @@
#include "bashintl.h"
#define NEED_FPURGE_DECL
#include "shell.h"
#include "execute_cmd.h"
#if defined (JOB_CONTROL)
+2 -2
View File
@@ -414,7 +414,7 @@ shift: shift [n]
Returns success unless N is negative or greater than $#.
builtin: builtin [shell-builtin [arg ...]]
shift: shift [n]
Shell commands matching keyword `read*'
Shell commands matching pattern 'read*':
read: read [-Eers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
readarray: readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
@@ -495,7 +495,7 @@ A star (*) next to a name means that the command is disabled.
getopts optstring name [arg ...] while COMMANDS; do COMMANDS-2; done
hash [-lr] [-p pathname] [-dt] [name > { COMMANDS ; }
help [-dms] [pattern ...]
./builtins10.sub: line 39: help: no help topics match `bash'. Try `help help' or `man -k bash' or `info bash'.
./builtins10.sub: line 39: help: no help topics match 'bash'. Try 'help help', 'man -k bash', or 'info bash'.
builtins11.sub
unlimited
unlimited
+3
View File
@@ -2724,6 +2724,9 @@ make_local_variable (const char *name, int flags)
else
/* We inherit the export attribute, but no others. */
new_var->attributes = exported_p (old_var) ? att_exported : 0;
if (exported_p (new_var))
array_needs_making = 1;
}
set_local_var_flags: