On 5/1/15 2:26 PM, Dreamcat4 wrote:
> Hello.
> If you unset a function, then a variable argument (argv) specified after
> that function will not be unset.

Thanks for the report.  Yes, once you unset a function, it's as if you
supplied the `-f' option.

This came in as the result of a fix for the unset-lets-you-unset-readonly-
functions problem in bash-4.2.

> [19:24] < dualbus> for every fix that Chet does, he introduces like 2 bugs.
> Nice way of keeping himself busy

That points to the importance of having a good, comprehensive test suite.
It's difficult to test the interaction between features otherwise.

I attached a patch for people to test.
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3-patched/builtins/set.def	2013-04-19 07:20:34.000000000 -0400
--- builtins/set.def	2015-05-05 13:25:36.000000000 -0400
***************
*** 752,758 ****
--- 797,805 ----
  {
    int unset_function, unset_variable, unset_array, opt, nameref, any_failed;
+   int global_unset_func, global_unset_var;
    char *name;
  
    unset_function = unset_variable = unset_array = nameref = any_failed = 0;
+   global_unset_func = global_unset_var = 0;
  
    reset_internal_getopt ();
***************
*** 762,769 ****
  	{
  	case 'f':
! 	  unset_function = 1;
  	  break;
  	case 'v':
! 	  unset_variable = 1;
  	  break;
  	case 'n':
--- 809,816 ----
  	{
  	case 'f':
! 	  global_unset_func = 1;
  	  break;
  	case 'v':
! 	  global_unset_var = 1;
  	  break;
  	case 'n':
***************
*** 778,782 ****
    list = loptend;
  
!   if (unset_function && unset_variable)
      {
        builtin_error (_("cannot simultaneously unset a function and a variable"));
--- 825,829 ----
    list = loptend;
  
!   if (global_unset_func && global_unset_var)
      {
        builtin_error (_("cannot simultaneously unset a function and a variable"));
***************
*** 796,799 ****
--- 843,849 ----
        name = list->word->word;
  
+       unset_function = global_unset_func;
+       unset_variable = global_unset_var;
+ 
  #if defined (ARRAY_VARS)
        unset_array = 0;

Reply via email to