Disable caching in OpamSystem.resolve_command #3164
Conversation
Conceptually flawed, as it doesn't allow for overriding commands (for example, opam-repository's ocamlfind package installs a custom ocaml script when installed for a system compiler intended to wrap the actual ocaml command) Signed-off-by: David Allsopp <david.allsopp@metastack.com>
Nicely spotted! Could it be worth adding an optional argument to disable the cache only for commads from scripts ? |
I think it's correct to view it as an unnecessary optimisation (i.e. running those commands will take vastly more time than locating them). Personally, I'd drop it completely - it's already been a subtle issue, and it feels like it could be a subtle one in future (imagine if/when ocaml-git starts installing a If opam's internal invocations want to cache the location of |
If this PR could be merged soon, it'll make a huge usability difference to me. Right now local switches are very unreliable on the Mac with a system switch due to this. |
Yup, merging, I'll consider re-adding for non-script commands later. Thanks! |
OpamSystem.resolve_command
caches results. This cannot work - the ocamlfind package, for example, installs anocaml
script which is intended to wrap the system-installedocaml
command. This script is not invoked ifocaml
has been previously executed, because the path to the system-installedocaml
command is cached.There are various shims which could mitigate this for opam-installed binaries/scripts only, but it seems better just not to cache the results at all.