mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-24 23:28:59 +01:00
Don't export variables with parentheses in their names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
35b90c2709
commit
081cf30447
@ -5188,12 +5188,15 @@ sub get_params( $ ) {
|
||||
$shell = BASH;
|
||||
|
||||
for ( @params ) {
|
||||
my $var = $1;
|
||||
|
||||
unless ( $var =~ /\(/ ) {
|
||||
if ( /^declare -x (.*?)="(.*[^\\])"$/ ) {
|
||||
$params{$1} = $2 unless $1 eq '_';
|
||||
$params{$var} = $2 unless $1 eq '_';
|
||||
} elsif ( /^declare -x (.*?)="(.*)$/ ) {
|
||||
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n";
|
||||
$params{$variable=$var} = $2 eq '"' ? '' : "${2}\n";
|
||||
} elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) {
|
||||
$params{$1} = '';
|
||||
$params{$var} = '';
|
||||
} else {
|
||||
chomp;
|
||||
if ($variable) {
|
||||
@ -5204,6 +5207,7 @@ sub get_params( $ ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elsif ( $params[0] =~ /^export .*?="/ || $params[0] =~ /^export [^\s=]+\s*$/ ) {
|
||||
#
|
||||
# getparams interpreted by older (e.g., RHEL 5) Bash
|
||||
@ -5216,12 +5220,15 @@ sub get_params( $ ) {
|
||||
$shell = OLDBASH;
|
||||
|
||||
for ( @params ) {
|
||||
my $var = $1;
|
||||
|
||||
unless ( $var =~ /\(/ ) {
|
||||
if ( /^export (.*?)="(.*[^\\])"$/ ) {
|
||||
$params{$1} = $2 unless $1 eq '_';
|
||||
$params{$var} = $2 unless $1 eq '_';
|
||||
} elsif ( /^export (.*?)="(.*)$/ ) {
|
||||
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n";
|
||||
$params{$variable=$var} = $2 eq '"' ? '' : "${2}\n";
|
||||
} elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) {
|
||||
$params{$1} = '';
|
||||
$params{$var} = '';
|
||||
} else {
|
||||
chomp;
|
||||
if ($variable) {
|
||||
@ -5232,6 +5239,7 @@ sub get_params( $ ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# getparams was interpreted by dash/ash/busybox
|
||||
|
Loading…
Reference in New Issue
Block a user