ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

Hardens the interface of OpamUrl.local_{file,dir} #5975

Closed kit-ty-kate closed 1 month ago

kit-ty-kate commented 1 month ago

Would help to debug #5971

This change is done to be able to show an error message instead of a raw assert failure when an expected local file does not exist.

This is a breaking API change and will require a change in https://github.com/ocaml-opam/opam-publish/pull/138. While not strictly necessary, i believe this change is an overall improvement and will help track similar issues in the future.

One related issue i'm seeing with how these functions are used at the moment, is that if you have a url like file+git://<your-git-repo>/some/file/possibly/modified/or/untracked/since/HEAD this function would happily return the file in question, which it seems like it should not do. I'm not sure if this behaviour is exploited in the wild or in our code but i think this issue is separate and can be tracked in a later issue.

kit-ty-kate commented 1 month ago

Superseded by #5979 and #5978