Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double quoting of pkg-config when package contains a space #1835

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/configurator/v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ module Process = struct
let command_line prog args =
String.concat ~sep:" " (List.map (prog :: args) ~f:quote_if_needed)

(* [cmd] which cannot be quoted (such as [t.c_compiler] which contains
some flags) followed by additional arguments. *)
(* [cmd] which cannot be quoted (such as [t.c_compiler] which contains
some flags) followed by additional arguments. *)
let command_args cmd args =
String.concat ~sep:" " (cmd :: List.map args ~f:quote_if_needed)

Expand Down Expand Up @@ -510,8 +510,6 @@ module Pkg_config = struct
}

let query t ~package =
let package = quote_if_needed package in
let pkg_config = quote_if_needed t.pkg_config in
let c = t.configurator in
let dir = c.dest_dir in
let env =
Expand All @@ -529,10 +527,10 @@ module Pkg_config = struct
end
| _ -> []
in
if Process.run_ok c ~dir ~env pkg_config [package] then
if Process.run_ok c ~dir ~env t.pkg_config [package] then
let run what =
match String.trim
(Process.run_capture_exn c ~dir ~env pkg_config [what; package])
match String.trim (Process.run_capture_exn c ~dir ~env
t.pkg_config [what; package])
with
| "" -> []
| s -> String.split s ~on:' '
Expand Down