From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25834 invoked by alias); 9 Jan 2015 13:26:20 -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: 34181 Received: (qmail 4184 invoked from network); 9 Jan 2015 13:26:18 -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:date:message-id:subject:from:to:content-type; bh=XOGF0Mpqgv3K8q6UfirgOkmfzaPjQj8ABkUyH/tSfeM=; b=1KTmhZzQTRMGPS/3ulfLWdMMoCNb5ZufZb8dnqv2uooojuBeRgQeIXw/lobsChLgof F3lU+H6QY/QSyars7EB9SrbBy9e7U9JI1JPuRNOWSt3rlR6fC9e4w3H80Mk2DEoHlDqE jDLKRgMVZ36shxA0o5HGvSUXnKHXQForO5UHoMg22HfHnJa/jeYhyJvVYHvwG9Keb7eN C88wpQDQrFXj1og7RLs7+cmXB/ulCoZzaZhdbs99bGiaFejSwRvT9xXaypa1ZTlgcaB0 AnMv95sV8qbu5wFzK3NGamDXdUAi/NUqlgFRv0GtcR8NKqW1PjMBRZOgkFnUnMBjp2wG 4Png== MIME-Version: 1.0 X-Received: by 10.42.38.9 with SMTP id a9mr12770979ice.68.1420809972852; Fri, 09 Jan 2015 05:26:12 -0800 (PST) Date: Fri, 9 Jan 2015 14:26:12 +0100 Message-ID: Subject: Crash when exporting scalar without value and getsparam fails From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 2086 if (!(pm->node.flags & PM_UNSET) && !pm->env && !value) 30. returned_null: getsparam returns null (checked 46 out of 57 times). [show details] CID 439066 (#1 of 1): Dereference null return value (NULL_RETURNS)31. dereference: Dereferencing a pointer that might be null getsparam(pname) when calling addenv. [show details] 2087 addenv(pm, getsparam(pname)); The issue has this comment by Oliver on it, but I couldn't find any thread about it with a cursory search, so I'm repeating it here; Comment: The line of code occurs when you export an existing scalar variable without giving a new value. It isn't easy to find ways of making getsparam to fail but I've found one which is enough to declare this a bug: unset IFS export IFS memory allocation failing, such as dupstring would also do the job. Arguably these cases need fixing but the code highlighted here should perhaps default to adding the variable to the environment with an empty value. and sure enough, zsh: segmentation fault (core dumped) zsh -fc '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 guess if we do the former, then the environment would get out of sync with the internal parameter value. -- Mikael Magnusson