Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Crash when exporting scalar without value and getsparam fails
- X-seq: zsh-workers 34181
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Crash when exporting scalar without value and getsparam fails
- Date: Fri, 9 Jan 2015 14:26:12 +0100
- 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==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author