Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Segmentation fault immediately after 'unset PATH'



On Wed, 2019-07-10 at 23:52 +0200, Mikael Magnusson wrote:
> On 7/10/19, Shane Squires <shane2squires@xxxxxxxxx> wrote:
> > The following script, when executed, produces a segmentation fault for me.
> > This is the most minimal example I can construct.
> > 
> > ------------------
> > File run.zsh:
> > ------------------
> > #! /usr/bin/zsh
> > 
> > run() {
> >   typeset -U path=( $path )
> >   unset PATH
> > }
> > 
> > run
>
> This is the backtrace i get with debugging symbols,
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004832b8 in unsetparam_pm (pm=0x716a70, altflag=1, exp=1) at
> params.c:3614
> 3614		pm->gsu.s->unsetfn(pm, exp);
> (gdb) bt
> #0  0x00000000004832b8 in unsetparam_pm (pm=0x716a70, altflag=1,
> exp=1) at params.c:3614

The gsu element (get/set/unset handlers) of that parameter element,
which is the special one for path (N.B. not PATH which is linked), are
null.  That shouldn't ever happen, so it's already broken.  Presumably
this is somehow associated with the typeset.

The parameter structure looks otherwise reasonable, except the PM_UNIQUE
flag has gone by this point.  I'm seeing
PM_RESTRICTED|PM_DONTIMPORT|PM_SPECIAL|PM_TIED|PM_ARRAY
all of which make sense.

pws






Messages sorted by: Reverse Date, Date, Thread, Author