Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: syntax check of 'echo $HOME' crashes in ksh emulation mode
On Mon, 5 Oct 2015 18:09:22 +0200
Kamil Dudka <kdudka@xxxxxxxxxx> 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);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author