-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for META files rather than just directories to list plugins #10458
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me. it'd be nice to have a test case for this
List.concat | ||
(List.map | ||
(fun dir -> Array.to_list (Sys.readdir dir)) | ||
(fun dir -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can probably be a List.filter_map
instead.
It's available since OCaml 4.08, so it should be safe to use inside dune (https://github.com/ocaml/ocaml/blob/8b6b7cfbf26ae50ae87d5849c827e609a1309c98/stdlib/list.mli#L195-L200)
Signed-off-by: Samuel Hym <samuel.hym@rustyne.lautre.net>
If the plugin directory contains anything but directories that each contain a `META` file, loading plugins fails This can happen naturally in particular in the following scenario: - install a package providing a plugin to a command in another package - and remove that plugin package. This leaves an empty directory which triggers that failure. Co-authored-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> Signed-off-by: Samuel Hym <samuel.hym@rustyne.lautre.net>
Thank you for your review! I wasn’t sure about the best way to test this behaviour. I have added such a possible test, where the empty directory is explicitly created to mimick what happens with OPAM. Your suggestion to go with |
ping @anmonteiro |
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
Thanks. Can you add a changelog entry in |
Signed-off-by: Samuel Hym <samuel.hym@rustyne.lautre.net>
This PR proposes a possible fix for #10457.
If the plugin directory contains anything but directories that each contain a
META
file, loading plugins fails. This PR proposes to check additionally for the presence of theMETA
files and ignore other entries in the plugin directory.