From 7e35c0c2fde152442b639dad9d031121cdd8c869 Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Tue, 9 Jun 2009 14:22:11 +0000 Subject: Correctly handling '#' when loading shell variables (#50670, #51457). --- lib/MDK/Common/System.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') 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; } -- cgit v1.2.1