From: Michal Srb Subject: apparmor-utils: Fix quoting References: bnc#670979 This patch fixes the handling of empty strings. Acked-by: Jeff Mahoney --- SubDomain.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/SubDomain.pm.orig 2010-05-05 13:31:54.000000000 +0200 +++ b/SubDomain.pm 2011-03-06 10:25:19.000000000 +0100 @@ -5085,7 +5085,7 @@ $profile_data->{$profile}{$hat}{lvar}{$bool_var} = $value; } elsif (/^\s*(@\{?[[:alpha:]][[:alnum:]_]+\}?)\s*\+?=\s*(.+?)\s*,?\s*(#.*)?$/) { # variable additions both += and = doesn't mater my $list_var = strip_quotes($1); - my $value = strip_quotes($2); + my $value = $2; if ($profile) { unless (exists $profile_data->{$profile}{$hat}{lvar}) { @@ -5311,7 +5311,7 @@ my @data; # while ($vs =~ /\s*(((\"([^\"]|\\\"))+?\")|\S*)\s*(.*)$/) { - while ($vs =~ /\s*((\".+?\")|([^\"]\S+))\s*(.*)$/) { + while ($vs =~ /\s*((\".*?\")|([^\"]\S+))\s*(.*)$/) { my $tmp = $1; push @data, strip_quotes($tmp); $vs = $4; @@ -5359,7 +5359,7 @@ sub quote_if_needed ($) { my $data = shift; - $data = "\"$data\"" if $data =~ /\s/; + $data = "\"$data\"" if $data =~ /\s/ or $data eq ''; return $data; }