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

Segmentation fault immediately after 'unset PATH'



I'm running the most recent version of zsh available on my system (I am not
an admin), which is:

------------------
 % zsh --version
zsh 5.3.1 (x86_64-unknown-linux-gnu)
------------------

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
------------------

------------------
 % ./run.zsh
[1]    13415 segmentation fault  ./run.zsh
------------------

As far as I can tell, the problem has to involve all three elements here:
(1) the type of 'path' has to be modified, (2) 'PATH' has to be unset, and
(3) this has to happen inside a function.

I can imagine that what's going on here is that, for some reason, changing
the type of 'path' from inside a function causes it and 'PATH' to fall "out
of sync" somehow, and this creates problems when 'PATH' is being unset.
But this is extremely vague and speculative, so I won't waste any more time
by discussing it.

Before anyone lectures me on this, I realize that unsetting 'PATH' is not
advisable in general!  It is unfortunately unavoidable in my particular
case.  'PATH' needs to be unset and then immediately set to a new value,
and (because this is being handled in an automated way for many environment
variables) I cannot just immediately re-assign its value.  I will find
another workaround on my end, but I'm reporting this here mainly because it
seems to be a genuine bug in zsh.

Thanks in advance for looking into this--
Shane


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