From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12043 invoked by alias); 8 Oct 2015 12:14:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36816 Received: (qmail 887 invoked from network); 8 Oct 2015 12:14:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 From: Kamil Dudka To: Peter Stephenson Cc: zsh-workers@zsh.org Subject: Re: syntax check of 'echo $HOME' crashes in ksh emulation mode Date: Thu, 08 Oct 2015 14:13:58 +0200 Message-ID: <2527970.TQ0gWxIELj@kdudka.brq.redhat.com> User-Agent: KMail/4.14.9 (Linux/4.0.8-304.fc22.x86_64; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20151005174219.69ae85c4@pwslap01u.europe.root.pri> References: <1693579.IilOBOKrgc@kdudka.brq.redhat.com> <20151005174219.69ae85c4@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 On Monday 05 October 2015 17:42:19 Peter Stephenson wrote: > On Mon, 5 Oct 2015 18:09:22 +0200 > > Kamil Dudka 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 Thanks for the patch! I will get it included in Fedora/RHEL packages. Kamil > 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);