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

dune describe workspace crashes if an executable is not enabled #10945

Closed
Khady opened this issue Sep 23, 2024 · 5 comments
Closed

dune describe workspace crashes if an executable is not enabled #10945

Khady opened this issue Sep 23, 2024 · 5 comments
Labels

Comments

@Khady
Copy link
Contributor

Khady commented Sep 23, 2024

Expected Behavior

dune describe workspace should always work, even if an executable is not enabled.

Here the interesting part is (enabled_if (>= %{ocaml_version} 5.0)) in this executable stanza while working with an opam switch that has ocaml 4.14.

(executable
 (enabled_if
  (>= %{ocaml_version} 5.0))
 (name an_exe)
 (package dune_bug)
 (public_name public_exe)
 (libraries
  unix
  ))

When this enabled_if is present, dune describe workspace is crashing. Without it things work as expected

/tmp/demo-dune-describe-crash$ git diff
patdiff -git a/dune b/dune
index 4b6f86e..0000000 100644
------  a/dune
++++++  b/dune
@|-1,9 +1,7 ============================================================
 |(executable
-| (enabled_if
-|  (>= %{ocaml_version} 5.0))
 | (name an_exe)
 | (package dune_bug)
 | (public_name public_exe)
 | (libraries
 |  unix
 |  ))
/tmp/demo-dune-describe-crash$ dune describe workspace
((root /tmp/demo-dune-describe-crash)
 (build_context _build/default)
 (executables
  ((names (an_exe))
   (requires (7c82c98fd32b5f392f3ad8c940ef1e9e))
   (modules
    (((name An_exe)
      (impl (_build/default/an_exe.ml))
      (intf ())
      (cmt (_build/default/.an_exe.eobjs/byte/dune__exe__An_exe.cmt))
      (cmti ()))))
   (include_dirs (_build/default/.an_exe.eobjs/byte))))
 (library
  ((name unix)
   (uid 7c82c98fd32b5f392f3ad8c940ef1e9e)
   (local false)
   (requires ())
   (source_dir /home/me/Code/ahrefs/monorepo/_opam/lib/ocaml)
   (modules ())
   (include_dirs (/home/me/Code/ahrefs/monorepo/_opam/lib/ocaml)))))

Actual Behavior

/tmp/demo-dune-describe-crash$ dune describe workspace --verbose
Shared cache: enabled
Shared cache location: /home/me/.cache/dune/db
Workspace root: /tmp/demo-dune-describe-crash
Auto-detected concurrency: 256
Dune context:
 { name = "default"
 ; kind = "default"
 ; profile = Dev
 ; merlin = true
 ; fdo_target_exe = None
 ; build_dir = In_build_dir "default"
 ; instrument_with = []
 }
Internal error, please report upstream including the contents of _build/log.
Description:
  ("modules_and_obj_dir: failed lookup",
  { keys = []; for_ = Exe { first_exe = "an_exe" } })
Raised at Stdune__Code_error.raise in file
  "otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from Fiber__Core.O.(>>|).(fun) in file "vendor/fiber/src/core.ml",
  line 253, characters 36-41
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
  line 76, characters 8-11

I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases. 
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.

Reproduction

  1. git clone https://github.com/Khady/dune-demo-describe-crash.git
  2. cd dune-demo-describe-crash
  3. install ocaml 4.14
  4. dune describe workspace

Specifications

  • Version of dune (output of dune --version): 3.15
  • Version of ocaml (output of ocamlc --version): 4.14
  • Operating system (distribution and version): debian 12
@Khady Khady changed the title dune describe workspace crash if an executable is not enabled dune describe workspace crashes if an executable is not enabled Sep 23, 2024
@moyodiallo
Copy link
Collaborator

moyodiallo commented Sep 23, 2024

It seems like this issue is similar to #10779, which is fixed here #10881.

@moyodiallo moyodiallo added the bug label Sep 23, 2024
@anmonteiro
Copy link
Collaborator

is this a similar issue or a duplicate of #10779? since #10881 hasn't been released yet.

@moyodiallo
Copy link
Collaborator

is this a similar issue or a duplicate of #10779? since #10881 hasn't been released yet.

That's right, the fix have not been released yet.

@moyodiallo
Copy link
Collaborator

We should close this issue, it is already fixed in #10881.

@Khady.

@Khady
Copy link
Contributor Author

Khady commented Sep 23, 2024

Ah that’s amazing. Sorry for the noise, I looked for issues/PRs with the keyword workspace and didn’t see those.

@Khady Khady closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants