Skip to content

Commit

Permalink
Fix boolification in %if statement
Browse files Browse the repository at this point in the history
'%if ""' did not work correctly since the string simplification
done in commit bef4dff.

Nobody seems to write such if statements, though.
  • Loading branch information
mlschroe committed Jan 31, 2020
1 parent 0b6ef21 commit 151f79f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Build/Rpm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use Digest::MD5;

sub expr_boolify {
my ($v) = @_;
return !defined($v) || $v eq '"' || $v =~ /^0*$/ ? 0 : 1;
return !defined($v) || $v eq '"' || $v =~ /^0*$/s ? 0 : 1;
}

sub expr {
Expand Down Expand Up @@ -513,8 +513,7 @@ sub parse {
}
if ($line =~ /^\s*%if(.*)$/) {
my ($v, $r) = expr($1);
$v = 0 if $v && $v eq '\"\"';
$v =~ s/^0+/0/ if $v;
$v = expr_boolify($v);
$skip = 1 unless $v;
$hasif = 1;
next;
Expand Down

0 comments on commit 151f79f

Please sign in to comment.