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,19 +5188,23 @@ sub get_params( $ ) {
$shell = BASH; $shell = BASH;
for ( @params ) { for ( @params ) {
if ( /^declare -x (.*?)="(.*[^\\])"$/ ) { my $var = $1;
$params{$1} = $2 unless $1 eq '_';
} elsif ( /^declare -x (.*?)="(.*)$/ ) { unless ( $var =~ /\(/ ) {
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n"; if ( /^declare -x (.*?)="(.*[^\\])"$/ ) {
} elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) { $params{$var} = $2 unless $1 eq '_';
$params{$1} = ''; } elsif ( /^declare -x (.*?)="(.*)$/ ) {
} else { $params{$variable=$var} = $2 eq '"' ? '' : "${2}\n";
chomp; } elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) {
if ($variable) { $params{$var} = '';
s/"$//;
$params{$variable} .= $_;
} else { } else {
warning_message "Param line ($_) ignored" unless $bug++; chomp;
if ($variable) {
s/"$//;
$params{$variable} .= $_;
} else {
warning_message "Param line ($_) ignored" unless $bug++;
}
} }
} }
} }
@ -5216,19 +5220,23 @@ sub get_params( $ ) {
$shell = OLDBASH; $shell = OLDBASH;
for ( @params ) { for ( @params ) {
if ( /^export (.*?)="(.*[^\\])"$/ ) { my $var = $1;
$params{$1} = $2 unless $1 eq '_';
} elsif ( /^export (.*?)="(.*)$/ ) { unless ( $var =~ /\(/ ) {
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n"; if ( /^export (.*?)="(.*[^\\])"$/ ) {
} elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) { $params{$var} = $2 unless $1 eq '_';
$params{$1} = ''; } elsif ( /^export (.*?)="(.*)$/ ) {
} else { $params{$variable=$var} = $2 eq '"' ? '' : "${2}\n";
chomp; } elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) {
if ($variable) { $params{$var} = '';
s/"$//;
$params{$variable} .= $_;
} else { } else {
warning_message "Param line ($_) ignored" unless $bug++; chomp;
if ($variable) {
s/"$//;
$params{$variable} .= $_;
} else {
warning_message "Param line ($_) ignored" unless $bug++;
}
} }
} }
} }