From f7571319b3d693059705b5d20682bea44cb7d195 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 4 Aug 2004 05:54:56 +0000 Subject: setVarsInSh() now tries to use quoting only when really needed, otherwise it breaks program parsing the generated file (eg: /usr/sbin/autologin) --- MDK/Common/System.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'MDK/Common') diff --git a/MDK/Common/System.pm b/MDK/Common/System.pm index 3b21a9d..427a9e5 100644 --- a/MDK/Common/System.pm +++ b/MDK/Common/System.pm @@ -327,14 +327,12 @@ sub setVarsInShMode { MDK::Common::File::output($file, map { my $val = $l->{$_}; - if ($val =~ /\W/) { - if ($val =~ /["\$]/) { - $val =~ s/(')/\\$1/; - $val = qq('$val'); - } else { - $val =~ s/(")/\\$1/; - $val = qq("$val"); - } + if ($val =~ /["`\$]/) { + $val =~ s/(')/\\$1/g; + $val = qq('$val'); + } elsif ($val =~ /['\s\\]/) { + $val =~ s/(["\\])/\\$1/g; + $val = qq("$val"); } "$_=$val\n"; } grep { $l->{$_} } @fields -- cgit v1.2.1