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

Opam removes package when failing to recompile #3722

Open
thomas-huet opened this issue Jan 11, 2019 · 4 comments
Open

Opam removes package when failing to recompile #3722

thomas-huet opened this issue Jan 11, 2019 · 4 comments

Comments

@thomas-huet
Copy link

Trying to install a new package can remove previously installed packages if the installation of the new package fails. I think this behaviour is very unintuitive.

Example:

$ opam install conf-gnutls
The following actions will be performed:
  ∗ install   conf-gnutls     1
  ↻ recompile ocamlnet        4.1.6 [uses conf-gnutls]

...

┌─ The following actions failed
│ λ build conf-gnutls 1
└─ 
┌─ The following changes have been performed (the rest was aborted)
│ ⊘ remove  ocamlnet        4.1.6
└─ 

The installation failed because I was missing some library so I installed the missing library and ran opam install conf-gnutls again but didn't think about reinstalling ocamlnet too.

@AltGr
Copy link
Member

AltGr commented Jan 23, 2019

We took extra care in opam 2.0.0 to minimise the removals as much as possible, while guaranteeing that the set of installed packages remains consistent at all times. It seems you have hit a bug, or at least a corner case, though, as in your case the removal should certainly only have been done after the conf-gnutls package was successfully built. Could you provide some more context (logs, if possible the files foo-* generated when re-running with the option --cudf foo) to help us debug ?

Thanks for reporting.

@thomas-huet
Copy link
Author

Here are the logs and the small foo-* files:
https://gist.github.com/thomas-huet/6dc305ce66a44bf11548b703428941b3
Here are all the foo-* files:
https://github.com/thomas-huet/foo

The steps to reproduce:

  • install ocamlnet with opam
  • make sure libgnutls28-dev is not installed
  • opam install conf-gnutls

@AltGr
Copy link
Member

AltGr commented Jan 24, 2019

Thanks, that will be very helpful!

@dra27
Copy link
Member

dra27 commented Jul 14, 2021

This is still a bug in 2.1, and in fact it's got slightly worse. This (opam 2.0.8) doesn't remove ocamlnet:

FROM ocaml/opam
RUN opam install ocamlnet
RUN opam install conf-gnutls

it fails because pkg-config isn't in the image. Fix that by inserting RUN sudo apt-get update && sudo apt-get install -yy pkg-config before the last RUN and you have a reproduction case for this.

However, in opam 2.1 (which you can get by putting RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && opam update immediately after the FROM), ocamlnet is removed regardless of whether pkg-config is installed or not.

@dra27 dra27 added this to To do in Opam 2.2.0 via automation Jul 14, 2021
@dra27 dra27 removed this from To do in Opam 2.2.0 Jul 14, 2021
@dra27 dra27 added this to To do in Opam 2.2.0 via automation Jul 23, 2021
@dra27 dra27 removed this from To do in Opam 2.2.0 Jan 14, 2022
@dra27 dra27 added this to To do in Opam 2.3 via automation Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Opam 2.3
  
To do
Development

No branches or pull requests

4 participants