diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-08-04 05:54:56 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-08-04 05:54:56 +0000 |
commit | f7571319b3d693059705b5d20682bea44cb7d195 (patch) | |
tree | 12b62f5fc5d49a63cc543f011fd214673a9bce0f /MDK/Common/System.pm | |
parent | 658c477f1ea4b2f6e6b2370561dbde383a33bdb7 (diff) | |
download | perl-MDK-Common-f7571319b3d693059705b5d20682bea44cb7d195.tar perl-MDK-Common-f7571319b3d693059705b5d20682bea44cb7d195.tar.gz perl-MDK-Common-f7571319b3d693059705b5d20682bea44cb7d195.tar.bz2 perl-MDK-Common-f7571319b3d693059705b5d20682bea44cb7d195.tar.xz perl-MDK-Common-f7571319b3d693059705b5d20682bea44cb7d195.zip |
setVarsInSh() now tries to use quoting only when really needed,
otherwise it breaks program parsing the generated file (eg: /usr/sbin/autologin)
Diffstat (limited to 'MDK/Common/System.pm')
-rw-r--r-- | MDK/Common/System.pm | 14 |
1 files changed, 6 insertions, 8 deletions
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 |