2014-09-30 17:06:22 +0100, Stephane Chazelas:
[...]
> $ env -i $'a\necho test\na=b' bash -c 'export -p'
> declare -x OLDPWD
> declare -x PWD="/home/stephane"
> declare -x SHLVL="1"
> declare -x a
> echo test
> a
[...]

Just reiterating in case that had gone unnoticed earlier:

$ env 'a;echo OOPS;: =' bash -c 'export -p' | bash
OOPS

That's because bash outputs:

declare -x a;echo OOPS;:

Since those environment variables cannot be mapped to shell
variables, they should not be included in the output of "export
-p".

Same applies for env variables called "1" or "#" or "*" for
instance.

I had already reported that 5 years ago actually:
http://thread.gmane.org/gmane.comp.shells.bash.bugs/11306
and it doesn't look like it was addressed at the time.

I can see there are a number of bugs at savannah
(https://savannah.gnu.org/support/?group=bash), but not much
activity on those bugs. Is that in use? Is it worth me adding an
entry there?

-- 
Stephane


Reply via email to