bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with Bash-4.3 Official Patch 27


From: Steve Simmons
Subject: Re: Issue with Bash-4.3 Official Patch 27
Date: Wed, 15 Oct 2014 12:25:02 -0400

On Oct 15, 2014, at 9:38 AM, address@hidden wrote:

> Hello,
> in refer to 
> http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00278.html variables 
> with suffix "%%" can't be set/exported.
> This makes problems restoring environments which where saved by external 
> programs like printenv (see example below)
> 
> I saw this issue on Ubuntu 12.04 with
> bash version GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)
> 
> examples:
> 
> $ foo() { echo "bar"; }
> $ export -f foo
> $ echo "export BASH_FUNC_foo%%='$(printenv BASH_FUNC_foo%%)'" | tee ./env
> export BASH_FUNC_foo%%='() {  echo "bar"
> }'
> $ source ./env
> bash: export: `BASH_FUNC_foo%%=() {  echo "bar"
> }': not a valid identifier
> 
> 
> $ export BASH_FUNC_foo%%='() {  echo "bar"; }'
> bash: export: `BASH_FUNC_foo%%=() {  echo "bar"; }': not a valid 
> identifier

Given the changes made for shellshock, I doubt the above will ever work again. 
Try

   env | sed 's/^BASH_FUNC_\([^%]*\)%%=/\1/'

or

   echo "export BASH_FUNC_foo%%='$(printenv BASH_FUNC_foo%%)'" | sed 
's/^BASH_FUNC_\([^%]*\)%%=/\1/' | tee ./env

to strip function descriptors.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]