configurator: absolute paths in $PKG_CONFIG are mishandled
Expected Behavior
If $PKG_CONFIG contains an absolute path, that path will be used to run pkg-config.
Actual Behavior
It tries to splice the absolute path given to each entry in $PATH and then fails because (in normal circumstances) none of them exist.
Reproduction
In a package that depends on pkg-config (this came up with lablgtk), do export PKG_CONFIG=/usr/bin/pkg-config (or wherever), then run dune build.
Specifications
- Version of
dune(output ofdune --version): 3.11.1, which is old; but the relevant code is the same on head - Version of
ocaml(output ofocamlc --version) 4.12.2 (but irrelevant) - Operating system (distribution and version): NetBSD -current (also irrelevant, though our package system tickled the bug)
Fix
Check for an absolute path in which in otherlibs/configurator/src/v1.ml, e.g. with Filename.is_relative.
Downstream patch is here: https://mail-index.netbsd.org/pkgsrc-changes/2024/11/30/msg311600.html
(but it doesn't use Filename.is_relative, which would probably be better for upstream)
I looked into this and I think this was fixed by https://github.com/ocaml/dune/pull/10937
released in 3.17 too