Skip to content

Lock file does not use disjunction for transitive dependencies of with-doc and with-dev-setup #6935

@sim642

Description

@sim642

The following is on opam 2.5.1.

opam file

opam-version: "2.0"
depends: [
  "odoc" {with-doc}
  "ocp-indent" {with-dev-setup}
]

Installing and locking with-doc

$ opam install --deps-only . --with-doc
$ opam lock .

Produces the following lock file:

opam-version: "2.0"
name: "opam-with-lock"
version: "dev"
depends: [
  "astring" {= "0.8.5" & with-doc}
  "base-bigarray" {= "base" & with-doc}
  "base-domains" {= "base" & with-doc}
  "base-nnp" {= "base" & with-doc}
  "base-threads" {= "base" & with-doc}
  "base-unix" {= "base" & with-doc}
  "camlp-streams" {= "5.0.1" & with-doc}
  "cmdliner" {= "2.1.1" & with-doc}
  "cppo" {= "1.8.0" & with-doc}
  "crunch" {= "4.0.0" & with-doc}
  "dune" {= "3.22.2" & with-doc}
  "fmt" {= "0.11.0" & with-doc}
  "fpath" {= "0.7.3" & with-doc}
  "ocaml" {= "5.2.1" & with-doc}
  "ocaml-base-compiler" {= "5.2.1" & with-doc}
  "ocaml-config" {= "3" & with-doc}
  "ocaml-options-vanilla" {= "1" & with-doc}
  "ocamlbuild" {= "0.16.1" & with-doc}
  "ocamlfind" {= "1.9.8" & with-doc}
  "odoc" {= "3.1.0" & with-doc}
  "odoc-parser" {= "3.1.0" & with-doc}
  "ptime" {= "1.2.0" & with-doc}
  "re" {= "1.14.0" & with-doc}
  "seq" {= "base" & with-doc}
  "topkg" {= "1.1.1" & with-doc}
  "tyxml" {= "4.6.0" & with-doc}
  "uutf" {= "1.0.4" & with-doc}
]

Installing and locking with-dev-setup

After doing the above.

$ opam install --deps-only . --with-dev-setup

Produces the following lock file change:

   "ocamlfind" {= "1.9.8" & with-doc}
+  "ocp-indent" {= "1.9.0" & with-dev-setup}
   "odoc" {= "3.1.0" & with-doc}
]

Problem?

ocp-indent also depends on cmdliner but the lock file still only specifies "cmdliner" {= "2.1.1" & with-doc}, not "cmdliner" {= "2.1.1" & (with-doc | with-dev-setup)}. The preference for with-doc seems arbitrary and perhaps this behavior isn't intended?
I suppose doing opam install --deps-only --locked . --with-dev-setup with that lock file on a clean switch doesn't actually guarantee that version of cmdliner with the current behavior?

This is an attempt at a minimized reproduction. Originally I encountered something similar in goblint/analyzer#2036. However, there re-locking yielded the equivalent of "cmdliner" {= "2.1.1"} with the constraints completely removed.
That's a bit different but still possibly a variant of the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions