From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2073 invoked by alias); 5 Oct 2015 16:42:29 -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: 36780 Received: (qmail 3581 invoked from network); 5 Oct 2015 16:42:27 -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 X-AuditID: cbfec7f5-f794b6d000001495-ba-5612a86ddbd6 Date: Mon, 05 Oct 2015 17:42:19 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: syntax check of 'echo $HOME' crashes in ksh emulation mode Message-id: <20151005174219.69ae85c4@pwslap01u.europe.root.pri> In-reply-to: <1693579.IilOBOKrgc@kdudka.brq.redhat.com> References: <1693579.IilOBOKrgc@kdudka.brq.redhat.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPLMWRmVeSWpSXmKPExsVy+t/xK7q5K4TCDBruW1scbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujKl33rEXtHJVfPl4jamB8SF7FyMnh4SAicTOqcehbDGJC/fW s3UxcnEICSxllNj4+jFYQkhgBpPEiUPeEPZWRonm0z5djBwcLAKqEhMOhYKE2QQMJaZums0I YosIiEucXXueBaREWMBdYtJqFRCTV8Be4uqTdJAKTgFziY3ne5ggBppJbJy/EmwRv4C+xNW/ n5ggrrGXmHnlDNhEXgFBiR+T77GA2MwCWhKbtzWxQtjyEpvXvGWGmKMucePubvYJjEKzkLTM QtIyC0nLAkbmVYyiqaXJBcVJ6blGesWJucWleel6yfm5mxghwfp1B+PSY1aHGAU4GJV4eA/E C4YJsSaWFVfmHmKU4GBWEuFt6BAKE+JNSaysSi3Kjy8qzUktPsQozcGiJM47c9f7ECGB9MSS 1OzU1ILUIpgsEwenVAOjTY38ATGNPdd2hgXWcveu//lv/qFTP7sZ7L48maa1RF9uvuOrN5aP lkTrp707xOcttNCoOLRE3UTf/caP3GzTpTLTfH/PmjS19Ym59rIJ+5ZOe2bmWrBF07LGf51P gqPQ+4sCZ+zXJp40ZCyeJHe5d5VR3Jn/vzWXWVvVSPFs+6/DtOOt3GMlJZbijERDLeai4kQA O2HcdlICAAA= 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 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);