Re: export -p output not suitable for input when env vars contain non-identifiers

2014-10-11 Thread Linda Walsh



Stephane Chazelas wrote:

2014-09-30 17:06:22 +0100, Stephane Chazelas:
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;:




That funny... I think I'm pre-shock patches in v4.2.45.

When I do the above, I get:

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

bash: line 100: declare: _LOCAL_DIR_: readonly variable
bash: line 119: declare: `a:echo': not a valid identifier

So maybe the patch is causing, (*mock*shock*), new, invalid
and undesirable behavior?

But a;echo has never been a valid ID.  neither has anything
with a '/' in it:

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

bash: line 100: declare: _LOCAL_DIR_: readonly variable
bash: line 119: declare: `a/echo': not a valid identifier

Also, a bit surprising, I thought ':' was allowed, but
from this:


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

bash: line 100: declare: _LOCAL_DIR_: readonly variable
bash: line 119: declare: `a:echo': not a valid identifier
 ll /bin/bash
-rwxr-xr-x 1 689048 Mar 22  2013 /bin/bash*

^^^ Mar22 definitely precedes this mess.









export -p output not suitable for input when env vars contain non-identifiers

2014-10-07 Thread Stephane Chazelas
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




Re: export -p output not suitable for input when env vars contain non-identifiers

2014-10-07 Thread Chet Ramey
On 10/7/14, 12:28 PM, Stephane Chazelas wrote:

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

Thanks.  This will be fixed in the next release of bash.

 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?

I don't look there very often.  This mailing list is the best way
to report bugs.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/