summaryrefslogtreecommitdiffstats
path: root/source/a/bash/bash-5.2-patches/bash52-023
blob: 07ba4ae437782246ada0d1056ecbb94b27fe9016 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
			     BASH PATCH REPORT
			     =================

Bash-Release:	5.2
Patch-ID:	bash52-023

Bug-Reported-by:	Emanuele Torre <torreemanuele6@gmail.com>
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_ */