zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: syntax check of 'echo $HOME' crashes in ksh emulation mode
Date: Mon, 05 Oct 2015 17:42:19 +0100	[thread overview]
Message-ID: <20151005174219.69ae85c4@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <1693579.IilOBOKrgc@kdudka.brq.redhat.com>

On Mon, 5 Oct 2015 18:09:22 +0200
Kamil Dudka <kdudka@redhat.com> wrote:
> The following command causes a SIGSEGV in zsh (built from upstream git HEAD):
> 
> $ ARGV0=ksh zsh -nc 'echo $HOME'
> zsh: segmentation fault (core dumped)  ARGV0=ksh Src/zsh -nc 'echo $HOME'

I'm not sure if we need to be more careful in paramsubst(), too, but if
we're not setting HOME because this is ksh emulation we should certainly
say so.

pws

diff --git a/Src/params.c b/Src/params.c
index de151a4..a8abb28 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -775,17 +775,18 @@ createparamtable(void)
 #endif
     opts[ALLEXPORT] = oae;
 
+    /*
+     * For native emulation we always set the variable home
+     * (see setupvals()).
+     */
+    pm = (Param) paramtab->getnode(paramtab, "HOME");
     if (EMULATION(EMULATE_ZSH))
     {
-	/*
-	 * For native emulation we always set the variable home
-	 * (see setupvals()).
-	 */
-	pm = (Param) paramtab->getnode(paramtab, "HOME");
 	pm->node.flags &= ~PM_UNSET;
 	if (!(pm->node.flags & PM_EXPORTED))
 	    addenv(pm, home);
-    }
+    } else if (!home)
+	pm->node.flags |= PM_UNSET;
     pm = (Param) paramtab->getnode(paramtab, "LOGNAME");
     if (!(pm->node.flags & PM_EXPORTED))
 	addenv(pm, pm->u.str);


  reply	other threads:[~2015-10-05 16:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 16:09 Kamil Dudka
2015-10-05 16:42 ` Peter Stephenson [this message]
2015-10-05 17:45   ` Bart Schaefer
2015-10-06  8:33     ` Peter Stephenson
2015-10-06  9:15       ` Peter Stephenson
2015-10-06 15:34         ` Bart Schaefer
2015-10-06 19:46           ` Peter Stephenson
2015-10-07  8:26             ` Peter Stephenson
2015-10-08 12:13   ` Kamil Dudka
2015-10-05 20:45 ` Axel Beckert

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=20151005174219.69ae85c4@pwslap01u.europe.root.pri \
    --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).