Re: [PATCH 4/4] [VAR] Replace cmdenviron with localvars

2010-05-26 Thread Herbert Xu
On Thu, May 27, 2010 at 12:37:23AM +0200, Jilles Tjoelker wrote: > > This change breaks passing variable assignments to regular builtins. > For example, > dash -c 'HOME=/ cd; pwd' > This should print /. (For some reason, this does not work in ksh93 > either.) Thanks, I have fixed it as follows.

Re: [PATCH 1/4] [VAR] Add localvars nesting

2010-05-26 Thread Herbert Xu
On Wed, May 26, 2010 at 11:55:33PM +0200, Jilles Tjoelker wrote: > > > @@ -950,13 +947,13 @@ evalfun(struct funcnode *func, int argc, char **argv, > > int flags) > > shellparam.p = argv + 1; > > shellparam.optind = 1; > > shellparam.optoff = -1; > > + pushlocalvars(); > > evaltre

Re: [PATCH 4/4] [VAR] Replace cmdenviron with localvars

2010-05-26 Thread Jilles Tjoelker
On Wed, May 26, 2010 at 09:00:34PM +1000, Herbert Xu wrote: > [VAR] Replace cmdenviron with localvars > This patch replaces the cmdenviron mechanism for temporary command > variables with the localvars mechanism used by functions. > This reduces code size, and more importantly, makes the variable

Re: [PATCH 1/4] [VAR] Add localvars nesting

2010-05-26 Thread Jilles Tjoelker
On Wed, May 26, 2010 at 09:00:31PM +1000, Herbert Xu wrote: > [VAR] Add localvars nesting > This patch adds localvars nesting infrastructure so we can reuse > the localvars mechanism for command evaluation. localvars could already nest, it's just that this change makes the nesting explicit instea

[PATCH 4/4] [VAR] Replace cmdenviron with localvars

2010-05-26 Thread Herbert Xu
[VAR] Replace cmdenviron with localvars This patch replaces the cmdenviron mechanism for temporary command variables with the localvars mechanism used by functions. This reduces code size, and more importantly, makes the variable assignment take effect immediately as required by POSIX. Signed-of

[PATCH 1/4] [VAR] Add localvars nesting

2010-05-26 Thread Herbert Xu
[VAR] Add localvars nesting This patch adds localvars nesting infrastructure so we can reuse the localvars mechanism for command evaluation. Signed-off-by: Herbert Xu --- ChangeLog |4 src/eval.c |7 ++- src/var.c | 50 -- sr

[PATCH 3/4] [VAR] Move unsetvar functionality into setvareq

2010-05-26 Thread Herbert Xu
[VAR] Move unsetvar functionality into setvareq This patch moves the unsetvar code into setvareq so that we can no have a pathological case of an unset variable hanging around unless it has a bit pinning it like VEXPORT. Signed-off-by: Herbert Xu --- ChangeLog |1 + src/var.c | 54 ++

[PATCH 2/4] [VAR] Fix poplocalvar leak

2010-05-26 Thread Herbert Xu
[VAR] Fix poplocalvar leak When a variable is marked as local, we set VSTRFIXED on its vp recored. However, poplocalvar never clears this flag for variables that were unset to begin with. Thus if you ever made an unset variable local, it would get the VSTRFIXED bit and stick around forever. Sig

Re: Assignment with command: export only, or sets variable, too?

2010-05-26 Thread Herbert Xu
On Fri, Apr 09, 2010 at 09:26:02AM +0100, Geoff Clare wrote: > Herbert Xu wrote, on 09 Apr 2010: > > > > While we're on this topic, what is the correct output for > > > > X=a Y=${X=b} Z=$X sh -c 'echo $Z' > > My reading of the standard is that this should output "b" > (assuming X is unset be