dune icon indicating copy to clipboard operation
dune copied to clipboard

configurator: absolute paths in $PKG_CONFIG are mishandled

Open sauclovian opened this issue 2 years ago • 3 comments

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 of dune --version): 3.11.1, which is old; but the relevant code is the same on head
  • Version of ocaml (output of ocamlc --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.

sauclovian avatar Nov 30 '24 02:11 sauclovian

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)

sauclovian avatar Nov 30 '24 02:11 sauclovian

I looked into this and I think this was fixed by https://github.com/ocaml/dune/pull/10937

anmonteiro avatar Dec 02 '24 00:12 anmonteiro

released in 3.17 too

anmonteiro avatar Dec 02 '24 00:12 anmonteiro