opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
The problem is that it is not possible for a package to prepend a directory before opam's bin directory in PATH and this feels like a mistake. Given, say, /usr/local/bin:/usr/bin:/bin etc. in a standard posix PATH, it feels reasonable that opam prepends the switch bin directory before packages - i.e. we have <package-PATH-directory>:<switch-PATH-directory>:/usr/local/bin:/usr/bin:/bin. This is also mildly more coherent with other environment variable updates in build-env, which the manual explicitly states can be overridden.
In the context of the opam-repository PR above, it means that
build-env: PATH += "%{some-package:share}%/bin"
doesn't allow binaries in the additional directory to override those in the switch directory, which seems incorrect.
Opening this is as a draft PR so it doesn't get forgotten. This has come up in the context of https://github.com/ocaml/opam-repository/pull/25928.
The problem is that it is not possible for a package to prepend a directory before opam's
bin
directory in PATH and this feels like a mistake. Given, say,/usr/local/bin:/usr/bin:/bin
etc. in a standard posix PATH, it feels reasonable that opam prepends the switchbin
directory before packages - i.e. we have<package-PATH-directory>:<switch-PATH-directory>:/usr/local/bin:/usr/bin:/bin
. This is also mildly more coherent with other environment variable updates in build-env, which the manual explicitly states can be overridden.In the context of the opam-repository PR above, it means that
doesn't allow binaries in the additional directory to override those in the switch directory, which seems incorrect.