Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Anybody objects to the following change in createparamtable()?



On Jul 27, 12:12pm, Andrej Borsenkow wrote:
} Subject: Anybody objects to the following change in createparamtable()?
}
} In createparamtable() (copy environment loop):
} 
} ??if ((!(pm = (Param) paramtab->getnode(paramtab, iname)) ||

Where'd those '\232' characters come from?  Please don't let any of those
creep into the actual source code ...

} The reason is, if we have duplicated environment entries, last one
} wins and call to setsparam() will try to modify environment in the
} middle of traversing it.  I'd prefer, if check for PM_EXPORTED comes
} first - if parameter is already exported, just skip any environment
} with the same name.

This is probably OK.  Take a look at this (ignore zsh vs. tcsh hostname
confusion):

zagzig[267] tcsh
[schaefer@candle]$ setenv FOO FOO
[schaefer@candle]$ echo $FOO
FOO
[schaefer@candle]$ setenv FOO=BAR BAZ
[schaefer@candle]$ echo $FOO
FOO
[schaefer@candle]$ printenv | grep FOO
FOO=FOO
FOO=BAR=BAZ
[schaefer@candle]$ zsh -f
zagzig% echo $ZSH_VERSION $FOO
3.0.8 FOO
zagzig% printenv | grep FOO
FOO=FOO
zagzig% 
[schaefer@candle]$ zsh-3.1.9-dev-3 -f
zagzig% echo $ZSH_VERSION $FOO
3.1.9-dev-3 BAR=BAZ                            <-- Last appears to win but
zagzig% printenv | grep FOO
FOO=FOO                                        <-- does not match environ!
zagzig% 
[schaefer@candle]$ bash
[schaefer@zagzig current]$ echo $FOO
BAR=BAZ
[schaefer@zagzig current]$ printenv | grep FOO
FOO=BAR=BAZ

So we have zsh-3.0.8 where the first one wins consistently, and bash
where the last one wins consistently, and zsh-3.1.9-dev-3 which does
not behave consistently at all.

} At this point the only exported parameters are the ones resulted from
} importing environment so it should be safe.

This all depends on your definition of "safe" ...

-- 
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