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

Erroneous message/return code with opam remove when are unavailable #4890

Closed
thierry-martinez opened this issue Nov 5, 2021 · 6 comments
Closed

Comments

@thierry-martinez
Copy link

I am facing some failures with opam-ci while trying to package libclang (ocaml/opam-repository#19824), and I don't understand the opam behavior here.

In the docker container created by opam-ci (based on the image ocaml/opam:alpine-3.13-ocaml-4.13), the command opam remove conf-libclang.12 fails with the following error:

[ERROR] Package conf-libclang.12 depends on the unavailable system package
        'llvm-dev'. You can use `--no-depexts' to attempt installation anyway.

I am a bit surprised that opam remove can fail on an uninstalled package for an unavailable dependency, but more surprisingly this package is available on the system: sudo apk add llvm-dev successfully installs llvm!

Moreover, if I try opam install --deps-only conf-libclang.12 (before installing the llvm-dev package manually via apk), the command answers Nothing to do..

Any hint about how to fix that? Thank you very much.

bash-5.1$ opam config report
# opam config report
# opam-version         2.1.0 (9c5bd41377e24f7409cf35ac83bfddeed01265e6) 
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=alpine os-version=3.13.6
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 47
# repositories         1 (local)
# pinned               2 (version)
# current-switch       4.13
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /home/opam/.opam/4.13/lib/ocaml/stublibs:/home/opam/.opam/4.13/lib/ocaml
# ocaml:preinstalled   false
# ocaml:compiler       4.13.1
@rjbou
Copy link
Collaborator

rjbou commented Nov 8, 2021

related to #4759 (comment)

@rjbou rjbou added the AREA: UI label Nov 8, 2021
@rjbou rjbou added this to To do in Opam 2.2.0 via automation Nov 8, 2021
@rjbou rjbou added this to the 2.2.0~alpha milestone Nov 8, 2021
@rjbou
Copy link
Collaborator

rjbou commented Nov 8, 2021

Thanks for the report!
Some more complete answers:

I am a bit surprised that opam remove can fail on an uninstalled package for an unavailable dependency,

In fact, it is not failing, the error message is misleading (and wrong) and the error code too. There is no removal possible as the package is not installed; If the package were installed, it would be another message, a warning that system dependency is no more in the system, and then package removal.

but more surprisingly this package is available on the system: sudo apk add llvm-dev successfully installs llvm!

It is a virtual package, and this is not handled for alpine yet, as pointed in linked issue.

Moreover, if I try opam install --deps-only conf-libclang.12 (before installing the llvm-dev package manually via apk), the command answers Nothing to do..

This one is an expected behavior. conf-libclang have no opam dependencies (depends: field empty), so when you try to install its opam dependencies, opam have nothing to do.. Maybe you wanted opam install conf-libclang --depexts-only?

@thierry-martinez
Copy link
Author

Thank you for your answer!

In fact, it is not failing, the error message is misleading (and wrong) and the error code too. There is no removal possible as the package is not installed; If the package were installed, it would be another message, a warning that system dependency is no more in the system, and then package removal.

Ok, I think I understand better now. Any chance that opam would exit with error code 0 in this case? The current behaviour seems to break opam-ci for centos as soon as there is a package with an external dependency, isn't it?

It is a virtual package, and this is not handled for alpine yet, as pointed in linked issue.

Indeed. Thank you very much for the reference to the other issue.

This one is an expected behavior. conf-libclang have no opam dependencies (depends: field empty), so when you try to install its opam dependencies, opam have nothing to do.. Maybe you wanted opam install conf-libclang --depexts-only?

You are right, I made a confusion between --deps-only and --depexts-only while reading the command-line that opam-ci executed.

@rjbou
Copy link
Collaborator

rjbou commented Nov 9, 2021

Any chance that opam would exit with error code 0 in this case?
Completely, I'll keep this issue open to track/fix that.

@rjbou rjbou added the KIND: BUG label Nov 9, 2021
@rjbou rjbou changed the title unavailable system package error with llvm-dev on alpine whereas apk add llvm-dev succeeds Erroneous message/return code with opam remove when are unavailable Nov 9, 2021
@kit-ty-kate
Copy link
Member

(somewhat) related to #4493

@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
@kit-ty-kate kit-ty-kate removed this from the 2.2.0~alpha milestone Jan 14, 2022
AltGr added a commit to AltGr/opam that referenced this issue Jan 14, 2022
AltGr added a commit to AltGr/opam that referenced this issue Jan 17, 2022
AltGr added a commit to AltGr/opam that referenced this issue Jan 17, 2022
kit-ty-kate pushed a commit to AltGr/opam that referenced this issue Jan 21, 2022
@rjbou rjbou closed this as completed in e14ffc4 Jan 24, 2022
Opam 2.3 automation moved this from To do to Done Jan 24, 2022
@rjbou
Copy link
Collaborator

rjbou commented Sep 11, 2023

fixed by #4995

@rjbou rjbou removed this from Done in Opam 2.3 Sep 11, 2023
@rjbou rjbou added this to the 2.2.0~alpha milestone Sep 11, 2023
@rjbou rjbou added this to Done in Opam 2.2.0 Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Opam 2.2.0
  
Done
Development

No branches or pull requests

3 participants