BASH PATCH REPORT ================= Bash-Release: 5.2 Patch-ID: bash52-023 Bug-Reported-by: Emanuele Torre Bug-Reference-ID: <20230206140824.1710288-1-torreemanuele6@gmail.com> Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-02/msg00045.html Bug-Description: Running `local -' multiple times in a shell function would overwrite the original saved set of options. Patch (apply with `patch -p0'): *** ../bash-5.2-patched/builtins/declare.def 2023-01-04 20:40:28.000000000 -0500 --- builtins/declare.def 2023-02-08 15:36:49.000000000 -0500 *************** *** 421,429 **** if (local_var && variable_context && STREQ (name, "-")) { var = make_local_variable ("-", 0); ! FREE (value_cell (var)); /* just in case */ ! value = get_current_options (); ! var_setvalue (var, value); ! VSETATTR (var, att_invisible); NEXT_VARIABLE (); } --- 421,437 ---- if (local_var && variable_context && STREQ (name, "-")) { + int o; + + o = localvar_inherit; + localvar_inherit = 0; var = make_local_variable ("-", 0); ! 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 (); } *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 22 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 23 #endif /* _PATCHLEVEL_H_ */