mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
bugfix: special characters like spaces in nginx configure option values (like --with-pcre-opt and --with-openssl-opt) were not passed correctly. thanks Andreas Lubbe for the report in #178.
This commit is contained in:
21
util/configure
vendored
21
util/configure
vendored
@ -144,7 +144,7 @@ for my $opt (@ARGV) {
|
||||
|
||||
if ($opt =~ /^--with-cc=(.+)/) {
|
||||
$cc = $1;
|
||||
push @ngx_opts, "'$opt'";
|
||||
push @ngx_opts, "$opt";
|
||||
next;
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ if (@ngx_ld_opts) {
|
||||
my $cmd = "sh ./configure --prefix=$ngx_prefix"
|
||||
. $resty_opts
|
||||
. $ld_opts
|
||||
. (@ngx_opts ? " \\\n @ngx_opts" : "");
|
||||
. (@ngx_opts ? " \\\n " . quote_cli_args(\@ngx_opts) : "");
|
||||
;
|
||||
|
||||
shell $cmd, $dry_run;
|
||||
@ -1290,3 +1290,20 @@ sub can_run {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub quote_cli_args {
|
||||
my $args = shift;
|
||||
my @quoted;
|
||||
for my $arg (@$args) {
|
||||
if ($arg =~ /[\\\s'"\$]/) {
|
||||
if ($arg =~ /'/) {
|
||||
$arg =~ s/([\\'])/\\$1/g;
|
||||
push @quoted, "\$'$arg'";
|
||||
} else {
|
||||
push @quoted, "'$arg'";
|
||||
}
|
||||
} else {
|
||||
push @quoted, $arg;
|
||||
}
|
||||
}
|
||||
join " ", @quoted;
|
||||
}
|
||||
|
Reference in New Issue
Block a user