Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: expansion bug in 4.0.3?
- X-seq: zsh-workers 16215
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Danek Duvall <duvall@xxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: PATCH: Re: expansion bug in 4.0.3?
- Date: Sat, 3 Nov 2001 16:43:31 +0000
- In-reply-to: <20011103000021.A9262@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20011103000021.A9262@xxxxxxxxxxxxxxxxxx>
On Nov 3, 12:00am, Danek Duvall wrote:
}
} % echo $$
} 146
} % print -l ${$(</proc/$$/environ)}
} DISPLAY=:0.0 HOME=/home/duvall LOGNAME=duvall USER=duvall [ ... ]
} % print -l ${$(</proc/146/environ)}
} DISPLAY=:0.0
} HOME=/home/duvall
} LOGNAME=duvall
} USER=duvall
} [ ... ]
}
} Is this a bug, or is there some behavior I'm not understanding properly?
It's a bug. The optimization that causes $(<filename) to be implmented
without forking is not properly saving/restoring some state, such that
the expansion of $$ in the file name causes zsh to behave as if you'd
written it with double quotes, i.e. `print -l ${"$(</proc/$$/environ)"}'.
This bug doesn't exist in 3.0.x because the state that needs to be saved
and restored wasn't introduced until 3.1.9-pws-19. However, the bug has
probably been present ever since then -- for more than two years.
The following would appear to be the fix. "make check" still passes.
Index: Src/subst.c
===================================================================
--- Src/subst.c 2001/10/17 14:38:29 1.8
+++ Src/subst.c 2001/11/03 16:34:57
@@ -245,11 +245,13 @@
mod_export void
singsub(char **s)
{
+ int omi = mult_isarr;
local_list1(foo);
init_list1(foo, *s);
prefork(&foo, PF_SINGLE);
+ mult_isarr = omi;
if (errflag)
return;
*s = (char *) ugetnode(&foo);
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author