Skip to content

Commit b61443e

Browse files
committed
Apk: support comments at the end of a line
1 parent 6a0a615 commit b61443e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Build/Apk.pm

+4-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ sub expandvars {
140140
sub quote {
141141
my ($str, $q, $vars) = @_;
142142
$str = expandvars($str, $vars) if $q ne "'" && $str =~ /\$/;
143-
$str =~ s/([ \t\"\'\$])/sprintf("%%%02X", ord($1))/ge;
143+
$str =~ s/([ \t\"\'\$#])/sprintf("%%%02X", ord($1))/ge;
144144
$str = "%00" if $str eq ''; # so that split sees something
145145
return $str;
146146
}
@@ -149,7 +149,9 @@ sub unquotesplit {
149149
my ($str, $vars, $unbalanced) = @_;
150150
$str =~ s/%/%25/g;
151151
$str =~ s/^[ \t]+//;
152-
while ($str =~ /([\"\'])/) {
152+
my $re = $unbalanced ? qr{([\"\'\#])} : qr{([\"\'])};
153+
while ($str =~ /$re/) {
154+
last if $1 eq '#';
153155
my $q = $1;
154156
if ($str !~ s/$q(.*?)$q/quote($1, $q, $vars)/se) {
155157
return (undef) if $unbalanced;

0 commit comments

Comments
 (0)