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

Bogus dependency specification leads to assertion failure #5139

Closed
dbuenzli opened this issue May 7, 2022 · 1 comment · Fixed by #5141
Closed

Bogus dependency specification leads to assertion failure #5139

dbuenzli opened this issue May 7, 2022 · 1 comment · Fixed by #5141
Projects
Milestone

Comments

@dbuenzli
Copy link
Contributor

dbuenzli commented May 7, 2022

With opam 2.1.2, a bogus dependency specification (>= build) does not disturb opam lint and leads to an assertion failure on pinning.

> opam lint ./opam    
/Users/dbuenzli/sync/repos/otfm/opam: Passed.
> grep topkg opam     
  "topkg" {>= build & >= "1.0.3"}
> opam pin add .      
otfm is now pinned to git+file:///Users/dbuenzli/sync/repos/otfm#master (version 0.4.0)

[NOTE] Pinning command successful, but your installed packages may be out of sync.
Fatal error:
File "src/solver/opamSolver.ml", line 265, characters 18-24: Assertion failed
Backtrace:
  Raised at OpamSolver.opam2cudf.preresolve_deps.(fun) in file "src/solver/opamSolver.ml", line 265, characters 18-30
  Called from OpamFormula.map in file "src/format/opamFormula.ml", line 139, characters 25-34
  Called from OpamFormula.map in file "src/format/opamFormula.ml", line 139, characters 35-44
  Called from OpamFormula.map in file "src/format/opamFormula.ml", line 139, characters 25-34
  Called from OpamSolver.opam2cudf.preresolve_deps in file "src/solver/opamSolver.ml", line 257, characters 4-399
  Called from OpamStd.Map.Make.map.(fun) in file "src/core/opamStd.ml", line 298, characters 18-27
  Called from OpamStd.Map.Make.fold.(fun) in file "src/core/opamStd.ml", line 292, characters 14-28
  Called from Stdlib__map.Make.iter in file "map.ml", line 297, characters 20-25
  Called from Stdlib__map.Make.iter in file "map.ml", line 297, characters 10-18
  Called from Stdlib__map.Make.iter in file "map.ml", line 297, characters 10-18
  Called from Stdlib__map.Make.iter in file "map.ml", line 297, characters 10-18
  Called from OpamStd.Map.Make.fold in file "src/core/opamStd.ml", line 291, characters 6-72
  Called from OpamSolver.opam2cudf in file "src/solver/opamSolver.ml", line 271, characters 4-80
  Called from OpamSolver.load_cudf_universe in file "src/solver/opamSolver.ml", line 323, characters 4-53
  Called from OpamSolver.resolve in file "src/solver/opamSolver.ml", line 420, characters 17-70
  Called from OpamSolution.resolve in file "src/client/opamSolution.ml", line 1286, characters 10-54
  Called from OpamClient.compute_upgrade_t in file "src/client/opamClient.ml", line 248, characters 2-263
  Called from OpamClient.upgrade_t in file "src/client/opamClient.ml", line 264, characters 8-84
  Called from OpamClient.PIN.post_pin_action in file "src/client/opamClient.ml", line 1515, characters 6-157
  Re-raised at OpamClient.PIN.post_pin_action in file "src/client/opamClient.ml", line 1523, characters 6-13
  Called from OpamCommands.pin.pin.(fun) in file "src/client/opamCommands.ml", line 3253, characters 9-127
  Called from OpamSwitchState.with_.(fun) in file "src/state/opamSwitchState.ml", line 1211, characters 14-18
  Re-raised at OpamStd.Exn.finalise in file "src/core/opamStd.ml", line 1372, characters 4-38
  Called from OpamStd.Exn.finally in file "src/core/opamStd.ml", line 1375, characters 10-14
  Re-raised at OpamStd.Exn.finalise in file "src/core/opamStd.ml", line 1372, characters 4-38
  Called from OpamGlobalState.with_ in file "src/state/opamGlobalState.ml", line 186, characters 14-18
  Re-raised at OpamStd.Exn.finalise in file "src/core/opamStd.ml", line 1372, characters 4-38
  Called from OpamStd.Exn.finally in file "src/core/opamStd.ml", line 1375, characters 10-14
  Re-raised at OpamStd.Exn.finalise in file "src/core/opamStd.ml", line 1372, characters 4-38
  Called from Cmdliner_term.app.(fun) in file "src_ext/cmdliner/src/cmdliner_term.ml", line 27, characters 19-24
  Called from Cmdliner.Term.ret.(fun) in file "src_ext/cmdliner/src/cmdliner.ml", line 27, characters 27-34
  Called from Cmdliner.Term.run in file "src_ext/cmdliner/src/cmdliner.ml", line 118, characters 32-39
  Called from Cmdliner.Term.term_eval in file "src_ext/cmdliner/src/cmdliner.ml", line 148, characters 18-36
  Called from Cmdliner.Term.eval_choice in file "src_ext/cmdliner/src/cmdliner.ml", line 266, characters 22-48
  Called from OpamCliMain.run.(fun) in file "src/client/opamCliMain.ml", line 441, characters 8-60
  Called from OpamCliMain.main_catch_all in file "src/client/opamCliMain.ml", line 328, characters 6-10
@rjbou
Copy link
Collaborator

rjbou commented May 11, 2022

There is an non handled case when a a constraint variable can't be resolved, linked PR fixes that.
Linting can't see it as it needs to resolve variables to check that is not resolved at some stage (lint does no variable resolving at all, switch state is not even loaded when a file is given).

@rjbou rjbou added this to the 2.2.0~alpha milestone May 12, 2022
@rjbou rjbou added this to To do in Opam 2.2.0 via automation May 12, 2022
@rjbou rjbou moved this from To do to In progress in Opam 2.2.0 May 12, 2022
Opam 2.2.0 automation moved this from In progress to Done May 19, 2022
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

Successfully merging a pull request may close this issue.

2 participants