diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-06-09 14:22:11 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-06-09 14:22:11 +0000 |
commit | 7e35c0c2fde152442b639dad9d031121cdd8c869 (patch) | |
tree | 373b5a3e34e167785d8dd541eebab1337c33d726 /lib | |
parent | 4f3c32546b547af6262d8930a45dba1424528eeb (diff) | |
download | perl-MDK-Common-7e35c0c2fde152442b639dad9d031121cdd8c869.tar perl-MDK-Common-7e35c0c2fde152442b639dad9d031121cdd8c869.tar.gz perl-MDK-Common-7e35c0c2fde152442b639dad9d031121cdd8c869.tar.bz2 perl-MDK-Common-7e35c0c2fde152442b639dad9d031121cdd8c869.tar.xz perl-MDK-Common-7e35c0c2fde152442b639dad9d031121cdd8c869.zip |
Correctly handling '#' when loading shell variables (#50670, #51457).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MDK/Common/System.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/MDK/Common/System.pm b/lib/MDK/Common/System.pm index 7ff4e4c..1b24f21 100644 --- a/lib/MDK/Common/System.pm +++ b/lib/MDK/Common/System.pm @@ -338,12 +338,12 @@ sub getVarsFromSh { open(my $F, $_[0]) or return; local $_; while (<$F>) { - s/#.*//; # remove comments + s/^\s*#.*//; # remove comment-only lines s/^\s*//; # leading space my ($v, $val) = /^(\w+)=(.*)/ or next; - if ($val =~ /^"(.*)"$/) { + if ($val =~ /^"(.*)"(\s+#.*)?$/) { $val = $1; - } elsif ($val =~ /^'(.*)'$/) { + } elsif ($val =~ /^'(.*)'(\s+#.*)?$/) { $val = $1; $val =~ s/(^|[^'])'\\''/$1'/g; } |