From: Chet Ramey Date: Sat, 13 Jan 2024 23:20:47 +0000 (-0500) Subject: Bash-5.2 patch 23: fix local - from overwriting saved set of options X-Git-Tag: bash-5.3-alpha~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c22ce0d04a9097effb7d1245406cbcdcfa82a1cb;p=thirdparty%2Fbash.git Bash-5.2 patch 23: fix local - from overwriting saved set of options --- diff --git a/builtins/declare.def b/builtins/declare.def index 54db59c55..7a1b60c8a 100644 --- a/builtins/declare.def +++ b/builtins/declare.def @@ -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 (); } diff --git a/patchlevel.h b/patchlevel.h index e5e8cabd7..fb4c70c01 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -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_ */