zsh-workers
 help / color / mirror / code / Atom feed
From: Shane Squires <shane2squires@gmail.com>
To: zsh-workers@zsh.org
Subject: Segmentation fault immediately after 'unset PATH'
Date: Wed, 10 Jul 2019 13:55:31 -0700	[thread overview]
Message-ID: <CAPkN6ar45kY-bu=XBs-feUx2R4UFh1d2E6m7rZrbAAKm+3sd1A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]

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

             reply	other threads:[~2019-07-10 20:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 20:55 Shane Squires [this message]
2019-07-10 21:52 ` Mikael Magnusson
2019-07-11  8:44   ` Peter Stephenson
2019-07-11 10:48     ` Peter Stephenson
2019-07-11 10:58       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPkN6ar45kY-bu=XBs-feUx2R4UFh1d2E6m7rZrbAAKm+3sd1A@mail.gmail.com' \
    --to=shane2squires@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).