[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"export -p" output not suitable for input when env vars contain non-iden
From: |
Stephane Chazelas |
Subject: |
"export -p" output not suitable for input when env vars contain non-identifiers |
Date: |
Tue, 7 Oct 2014 17:28:53 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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
- "export -p" output not suitable for input when env vars contain non-identifiers,
Stephane Chazelas <=