bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: segmentation fault in unset typeset array variable


From: Chet Ramey
Subject: Re: segmentation fault in unset typeset array variable
Date: Mon, 16 Aug 2004 16:48:14 -0400

> Machine Type: i386-redhat-linux-gnu
> 
> Bash Version: 2.05b
> Patch Level: 0
> Release Status: release
> 
> Description:
>         If a variable is typeset in a bash function, then unset, 
>       then used with the ${v[@]} syntax it causes a segmentation
>         violation.

Here's a patch:

*** ../bash-3.0/arrayfunc.c     Fri Dec 19 00:03:09 2003
--- arrayfunc.c Sun Aug  1 20:43:00 2004
***************
*** 612,616 ****
  
    free (t);
!   return var;
  }
  
--- 612,616 ----
  
    free (t);
!   return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var;
  }
  

*** ../bash-3.0/variables.c     Sun Jul  4 13:57:26 2004
--- variables.c Wed Aug  4 15:28:04 2004
***************
*** 1600,1604 ****
    old_var = find_variable (name);
    if (old_var && local_p (old_var) && old_var->context == variable_context)
!     return (old_var);
  
    was_tmpvar = old_var && tempvar_p (old_var);
--- 1600,1607 ----
    old_var = find_variable (name);
    if (old_var && local_p (old_var) && old_var->context == variable_context)
!     {
!       VUNSETATTR (old_var, att_invisible);
!       return (old_var);
!     }
  
    was_tmpvar = old_var && tempvar_p (old_var);


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]