summaryrefslogtreecommitdiffstats
path: root/lib/MDK/Common/System.pm
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-04-14 15:39:03 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-04-14 15:39:03 +0000
commit4f3c32546b547af6262d8930a45dba1424528eeb (patch)
treebddfab1058bf96cc9d76de9ff6ae4356b3cdc24b /lib/MDK/Common/System.pm
parentd05d91c1964a43c3e5c80a2681dcbf76eca16ca6 (diff)
downloadperl-MDK-Common-4f3c32546b547af6262d8930a45dba1424528eeb.tar
perl-MDK-Common-4f3c32546b547af6262d8930a45dba1424528eeb.tar.gz
perl-MDK-Common-4f3c32546b547af6262d8930a45dba1424528eeb.tar.bz2
perl-MDK-Common-4f3c32546b547af6262d8930a45dba1424528eeb.tar.xz
perl-MDK-Common-4f3c32546b547af6262d8930a45dba1424528eeb.zip
decode ' inside '' properly in getVarsFromSh
Diffstat (limited to 'lib/MDK/Common/System.pm')
-rw-r--r--lib/MDK/Common/System.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/MDK/Common/System.pm b/lib/MDK/Common/System.pm
index 900f6aa..7ff4e4c 100644
--- a/lib/MDK/Common/System.pm
+++ b/lib/MDK/Common/System.pm
@@ -341,7 +341,12 @@ sub getVarsFromSh {
s/#.*//; # remove comments
s/^\s*//; # leading space
my ($v, $val) = /^(\w+)=(.*)/ or next;
- $val = $1 if $val =~ /^"(.*)"$/ || $val =~ /^'(.*)'$/;
+ if ($val =~ /^"(.*)"$/) {
+ $val = $1;
+ } elsif ($val =~ /^'(.*)'$/) {
+ $val = $1;
+ $val =~ s/(^|[^'])'\\''/$1'/g;
+ }
$l{$v} = $val;
}
%l;