Skip to content
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

Programs called from opam hooks need a way to display information to the user #4359

Closed
lefessan opened this issue Sep 15, 2020 · 5 comments · Fixed by #4382
Closed

Programs called from opam hooks need a way to display information to the user #4359

lefessan opened this issue Sep 15, 2020 · 5 comments · Fixed by #4382

Comments

@lefessan
Copy link
Contributor

For opam-bin, I would like to display information to the user about what happened during an opam install command, for example the number of binary packages that were built, and, if some binary packages could not be built, why, without making the full opam command fail.

A possibility would be to write append some text at the end of a file $OPAM_SWITCH_PREFIX/.opam-switch/plugins/post-install-message.txt for example, that would be cleared at the beginning of the session and displayed at the end.

@AltGr
Copy link
Member

AltGr commented Sep 15, 2020

Note: this is related to opam hooks, and tools leveraging them, rather than plugins in general

Another possible solution that was discussed: allow output from pre/post-session hooks, and let the plugin gather its own messages.
A way for the plugin to identify the session would be useful, though.

@avsm
Copy link
Member

avsm commented Sep 16, 2020

I don't really understand the overall feature request. What does opam-bin have to do with opam install? Does it invoke opam install internally?

@AltGr
Copy link
Member

AltGr commented Sep 16, 2020

@avsm It's the other way around, it's expected to be set as a hook in opam configuration to wrap package installs. It's true that at the moment, if you do this you have no way to report to the user except erroring out.

@lefessan
Copy link
Contributor Author

Let's take another example: if a package tries to read/write the /etc/passwd, sandboxing (in opam hooks) will prevent it, but the package will still be able to catch the error and install itself normally, and the user will notice nothing. It would be better to report to the user that the package tried to access /etc/passwd, even if it didn't manage to do it. For that, programs called from opam hooks should be able to display messages at the end of the session.

@lefessan lefessan changed the title Plugins need a way to display information to the user Programs called from opam hooks need a way to display information to the user Sep 16, 2020
@avsm
Copy link
Member

avsm commented Sep 17, 2020

Thanks, the original issue seemed to imply some interaction with plugins that I didn't understand. It's now clearer that it refers to the hooks mechanism instead.

@avsm avsm added this to To do in Feature Wish via automation Sep 17, 2020
@AltGr AltGr self-assigned this Oct 6, 2020
AltGr added a commit to OCamlPro/opam that referenced this issue Oct 7, 2020
@rjbou rjbou added this to the 2.1.0~beta3 milestone Oct 8, 2020
@rjbou rjbou added this to To do in Opam 2.1.x via automation Oct 8, 2020
rjbou pushed a commit to OCamlPro/opam that referenced this issue Oct 8, 2020
rjbou pushed a commit to OCamlPro/opam that referenced this issue Oct 8, 2020
Opam 2.1.x automation moved this from To do to Done Oct 9, 2020
Feature Wish automation moved this from To do to Done Oct 9, 2020
@rjbou rjbou modified the milestones: 2.1.0~beta4, 2.0.8 Dec 16, 2020
@rjbou rjbou added this to To Do in Opam 2.0.x via automation Dec 16, 2020
rjbou pushed a commit to OCamlPro/opam that referenced this issue Dec 17, 2020
@rjbou rjbou moved this from To Do to Done in Opam 2.0.x Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants