zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-workers@zsh.org>
Subject: Re: Segmentation fault immediately after 'unset PATH'
Date: Thu, 11 Jul 2019 11:58:50 +0100	[thread overview]
Message-ID: <1562842730.4950.19.camel@samsung.com> (raw)
In-Reply-To: <1562842103.4950.12.camel@samsung.com>

On Thu, 2019-07-11 at 11:48 +0100, Peter Stephenson wrote:
> diff --git a/Src/params.c b/Src/params.c
> index 1859c7c12..95181f533 100644
> --- a/Src/params.c
> +++ b/Src/params.c
> @@ -3617,10 +3617,18 @@ unsetparam_pm(Param pm, int altflag, int exp)
>  	altpm = (Param) paramtab->getnode(paramtab, altremove);
>  	/* tied parameters are at the same local level as each other */
>  	oldpm = NULL;
> -	while (altpm && altpm->level > pm->level) {
> -	    /* param under alternate name hidden by a local */
> -	    oldpm = altpm;
> -	    altpm = altpm->old;
> +	/*
> +	 * Look for param under alternate name hidden by a local.
> +	 * If this parameter is special, however, the visible
> +	 * parameter is the special and the hidden one is keeping
> +	 * and old value --- we just mark the visible one as unset.
> +	 */
> +	if (altpm && !(altpm->node.flags & PM_SPECIAL))
> +	{
> +	    while (altpm && altpm->level > pm->level) {
> +		oldpm = altpm;
> +		altpm = altpm->old;
> +	    }
>  	}
>  	if (altpm) {
>  	    if (oldpm && !altpm->level) {

Hmm... can that loop I've "if"ed out ever be right?  It's meaning we're
unsetting the saved version of a parameter, not the visible one.  That
looks pretty fishy at any time.

pws


      reply	other threads:[~2019-07-11 10:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 20:55 Shane Squires
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 [this message]

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=1562842730.4950.19.camel@samsung.com \
    --to=p.stephenson@samsung.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).