Don't export variables with parentheses in their names

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2015-10-27 17:45:22 -07:00
parent 35b90c2709
commit 081cf30447

View File

@ -5188,12 +5188,15 @@ sub get_params( $ ) {
$shell = BASH; $shell = BASH;
for ( @params ) { for ( @params ) {
my $var = $1;
unless ( $var =~ /\(/ ) {
if ( /^declare -x (.*?)="(.*[^\\])"$/ ) { if ( /^declare -x (.*?)="(.*[^\\])"$/ ) {
$params{$1} = $2 unless $1 eq '_'; $params{$var} = $2 unless $1 eq '_';
} elsif ( /^declare -x (.*?)="(.*)$/ ) { } elsif ( /^declare -x (.*?)="(.*)$/ ) {
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n"; $params{$variable=$var} = $2 eq '"' ? '' : "${2}\n";
} elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) { } elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) {
$params{$1} = ''; $params{$var} = '';
} else { } else {
chomp; chomp;
if ($variable) { if ($variable) {
@ -5204,6 +5207,7 @@ sub get_params( $ ) {
} }
} }
} }
}
} elsif ( $params[0] =~ /^export .*?="/ || $params[0] =~ /^export [^\s=]+\s*$/ ) { } elsif ( $params[0] =~ /^export .*?="/ || $params[0] =~ /^export [^\s=]+\s*$/ ) {
# #
# getparams interpreted by older (e.g., RHEL 5) Bash # getparams interpreted by older (e.g., RHEL 5) Bash
@ -5216,12 +5220,15 @@ sub get_params( $ ) {
$shell = OLDBASH; $shell = OLDBASH;
for ( @params ) { for ( @params ) {
my $var = $1;
unless ( $var =~ /\(/ ) {
if ( /^export (.*?)="(.*[^\\])"$/ ) { if ( /^export (.*?)="(.*[^\\])"$/ ) {
$params{$1} = $2 unless $1 eq '_'; $params{$var} = $2 unless $1 eq '_';
} elsif ( /^export (.*?)="(.*)$/ ) { } elsif ( /^export (.*?)="(.*)$/ ) {
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n"; $params{$variable=$var} = $2 eq '"' ? '' : "${2}\n";
} elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) { } elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) {
$params{$1} = ''; $params{$var} = '';
} else { } else {
chomp; chomp;
if ($variable) { if ($variable) {
@ -5232,6 +5239,7 @@ sub get_params( $ ) {
} }
} }
} }
}
} else { } else {
# #
# getparams was interpreted by dash/ash/busybox # getparams was interpreted by dash/ash/busybox