]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-5.2 patch 23: fix local - from overwriting saved set of options
authorChet Ramey <chet.ramey@case.edu>
Sat, 13 Jan 2024 23:20:47 +0000 (18:20 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sat, 13 Jan 2024 23:20:47 +0000 (18:20 -0500)
builtins/declare.def
patchlevel.h

index 54db59c55d17447292b94cba22cfd08ba8f37eed..7a1b60c8a9c2453ee6d90259e8155c60b2850000 100644 (file)
@@ -420,11 +420,19 @@ declare_internal (list, local_var)
 
       if (local_var && variable_context && STREQ (name, "-"))
        {
+         int o;
+
+         o = localvar_inherit;
+         localvar_inherit = 0;
          var = make_local_variable ("-", 0);
-         FREE (value_cell (var));              /* just in case */
-         value = get_current_options ();
-         var_setvalue (var, value);
-         VSETATTR (var, att_invisible);
+         localvar_inherit = o;
+
+         if (value_cell (var) == NULL)         /* no duplicate instances */
+           {
+             value = get_current_options ();
+             var_setvalue (var, value);
+             VSETATTR (var, att_invisible);
+           }
          NEXT_VARIABLE ();
        }
 
index e5e8cabd778e31a763745ceba880c4fccc3b4555..fb4c70c018e121c3a47d1a60f539638f18a4a45c 100644 (file)
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 22
+#define PATCHLEVEL 23
 
 #endif /* _PATCHLEVEL_H_ */