ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.64k stars 409 forks source link

Dune crashes when menhir_flags is in dune-workspace #9024

Open Tchou opened 1 year ago

Tchou commented 1 year ago

Expected Behavior

Dune should not crash with an unhandled exception when the (env ...) stanza of dune-workspace mentions menhir_flags

Actual Behavior

Dune crashes when menhir_flags appears in (env ...)

Reproduction

  1. create an empty directory mkdir foo
  2. add these two files, dune-project:
    (lang dune 3.0)
    (using menhir 2.0)

    and dune-workspace:

    (lang dune 3.0)
    (env
    (test (menhir_flags --table)))
  3. run dune build, dune immediately crashes with a stack trace.

Specifications

Additional information

emillon commented 1 year ago

Thanks. I added a reproduction case in #9120. This bug has been present since the introduction of menhir_flags in 2.2.0, so we can first add a proper error saying it's not supported. The issue is that the decoding of this field is versioned in term of the menhir extension, and extensions are not available in workspace files. We could probably version this (in workspace files) against lang dune.