134-upstream-bash43-034.patch (2120B)
1 BASH PATCH REPORT 2 ================= 3 4 Bash-Release: 4.3 5 Patch-ID: bash43-034 6 7 Bug-Reported-by: Dreamcat4 <dreamcat4@gmail.com> 8 Bug-Reference-ID: <CAN39uTpAEs2GFu4ebC_SfSVMRTh-DJ9YanrY4BZZ3OO+CCHjng@mail.gmail.com> 9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-05/msg00001.html 10 11 Bug-Description: 12 13 If neither the -f nor -v options is supplied to unset, and a name argument is 14 found to be a function and unset, subsequent name arguments are not treated as 15 variables before attempting to unset a function by that name. 16 17 Patch (apply with `patch -p0'): 18 19 --- a/builtins/set.def 20 +++ b/builtins/set.def 21 @@ -751,9 +751,11 @@ unset_builtin (list) 22 WORD_LIST *list; 23 { 24 int unset_function, unset_variable, unset_array, opt, nameref, any_failed; 25 + int global_unset_func, global_unset_var; 26 char *name; 27 28 unset_function = unset_variable = unset_array = nameref = any_failed = 0; 29 + global_unset_func = global_unset_var = 0; 30 31 reset_internal_getopt (); 32 while ((opt = internal_getopt (list, "fnv")) != -1) 33 @@ -761,10 +763,10 @@ unset_builtin (list) 34 switch (opt) 35 { 36 case 'f': 37 - unset_function = 1; 38 + global_unset_func = 1; 39 break; 40 case 'v': 41 - unset_variable = 1; 42 + global_unset_var = 1; 43 break; 44 case 'n': 45 nameref = 1; 46 @@ -777,7 +779,7 @@ unset_builtin (list) 47 48 list = loptend; 49 50 - if (unset_function && unset_variable) 51 + if (global_unset_func && global_unset_var) 52 { 53 builtin_error (_("cannot simultaneously unset a function and a variable")); 54 return (EXECUTION_FAILURE); 55 @@ -795,6 +797,9 @@ unset_builtin (list) 56 57 name = list->word->word; 58 59 + unset_function = global_unset_func; 60 + unset_variable = global_unset_var; 61 + 62 #if defined (ARRAY_VARS) 63 unset_array = 0; 64 if (!unset_function && valid_array_reference (name)) 65 --- a/patchlevel.h 66 +++ b/patchlevel.h 67 @@ -25,6 +25,6 @@ 68 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 69 looks for to find the patch level (for the sccs version string). */ 70 71 -#define PATCHLEVEL 33 72 +#define PATCHLEVEL 34 73 74 #endif /* _PATCHLEVEL_H_ */