From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22549 invoked by alias); 10 Jan 2015 08:09:44 -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: 34208 Received: (qmail 21542 invoked from network); 10 Jan 2015 08:09:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ulZpiIITyXO+CFCUUxQ8k9E4Vv8mgNpS2WHqrq63fXs=; b=Y+35WFey/czfH0VUU0qdJR1GsiEpdjZCKDbjY5McRqyttSVyszK3HJwJYc6nNKa4Fd v41F7CGTJqglUq82ZDTLmfCWbN7cha4EGMtjaeeIOF8Q+SPG9VfLe+uATkjYTPJRKyio 7ZAR9lVqELLNoST4SQ7UmrNvqDMZJA3oMuqWkrx47MqV3q04pjMb23iGv43E8pa3SFr+ X/0skO2u4YU62pU7cbYmkwidOq7XG46PpX2m6Xv7/Ws9m+H7ksB5Js9r1s37lZOeYsNx dJZ71JIJWXWVH+3iXBIhMn+vnLgMMwql6Re39W3uhLOFmZ+Kr7SGGUg3ihmjdnxBFax+ noNg== MIME-Version: 1.0 X-Received: by 10.152.3.9 with SMTP id 9mr26158224lay.54.1420877379376; Sat, 10 Jan 2015 00:09:39 -0800 (PST) In-Reply-To: References: <150109225231.ZM24510@torch.brasslantern.com> Date: Sat, 10 Jan 2015 09:09:39 +0100 Message-ID: Subject: Re: Crash when exporting scalar without value and getsparam fails From: Mikael Magnusson To: Bart Schaefer Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Sat, Jan 10, 2015 at 8:56 AM, Mikael Magnusson wrote: > On Sat, Jan 10, 2015 at 7:52 AM, Bart Schaefer > wrote: >> On Jan 9, 2:26pm, Mikael Magnusson wrote: >> } bug: >> } unset IFS >> } export IFS >> } >> } Would the non-gnu equivalent of addenv(pm, getsparam(pname) ?: ""); do >> } the trick here? Or should it just return with an error? >> >> I think it should do nothing to the environment and return success. >> >> % bash -c 'unset IFS; export IFS; echo $?; printenv | grep IFS' >> 0 >> % >> >> However, we need an unset parameter object with the export flag set, >> so that it will become both set and exported when next a value is >> assigned to it. I think that can be done but don't immediately >> recall how. > > Ah yes, this is what happens for other parameters in zsh too. > % unset foo > % export foo > % printenv|grep foo > % foo=3 > % printenv|grep foo > foo=3 So just to check, I tried both of the things anyway. With setting it to "" on failure, it gets exported as the empty string, and this if (!(pm->node.flags & PM_UNSET) && !pm->env && !value) { void *foo = getsparam(pname); if (foo) addenv(pm, foo); } results in almost the correct behaviour, except that after unsetting the parameter and setting it again, it still gets exported. (This doesn't happen for other parameters). Maybe bin_unset or unsetparam_pm has some special code that needs changing too? -- Mikael Magnusson