]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
fix export environment if a local variable inherits the export attribute from a varia...
authorChet Ramey <chet.ramey@case.edu>
Wed, 19 Nov 2025 15:18:54 +0000 (10:18 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 19 Nov 2025 15:18:54 +0000 (10:18 -0500)
CWRU/CWRU.chlog
builtins/help.def
doc/bash.1
doc/bashref.texi
doc/version.texi
examples/loadables/fltexpr.c
lib/sh/winsize.c
sig.c
tests/builtins.right
variables.c

index fab80135c01a3877f4d97b6537a97ca6bc2179c0..6698b8378296acd4777e3752e9d8a69579ccc4e5 100644 (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>
index e7e9789d84e627110d511d9953227499872efbd8..f6db8a95f8e8426b707a9c4966779ba022af5d1c 100644 (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
index 42c89441b19f3329497b5b91d1a91d8675f361f6..afe320eeaffb4a9b20a94b6aca1355880772eedd 100644 (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
index f78bd7e57634395933712743afa2f95ad3dbebde..7012cf6c55e2caa6d31dd125c61b215cb7dff55d 100644 (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.
 
index 7bf929f58490ecc653565c8e437e5aff90ceb632..e6d9f225062e7ef5d0686df403f9c15694d6c784 100644 (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
index 5af6eeb84ceeef6d8fe752d461295aa7cb8beda5..76d13d3a66d9b0ee4c53bf645d510773af6a99fe 100644 (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)
index ed991ad43abe02918d98ace4669005368b40764e..713d58a0b124ac76ffa3da6b88e5092bcd1c0b90 100644 (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. */
diff --git a/sig.c b/sig.c
index 0662a2497fbbfb636183dd3dc533271dbbd7d695..6af1d5f02b85234a5f03ddf751df8da428c8e640 100644 (file)
--- a/sig.c
+++ b/sig.c
@@ -34,6 +34,8 @@
 
 #include "bashintl.h"
 
+#define NEED_FPURGE_DECL
+
 #include "shell.h"
 #include "execute_cmd.h"
 #if defined (JOB_CONTROL)
index c0194b86d01ad835b1555a92a357a20e463eb289..740dc47f082cbc40eb54b6f921eb463c6b8e7a94 100644 (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
index 5942337277ae8fac987aa2c4c84853df6822c3f0..6a03175e0bec83efb84fa73b07d8550234871a0d 100644 (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: