Skip to content

Dependency cycle with copy_files from above public lib #4345

@craigfe

Description

@craigfe

The following project layout (reproduced in a repository here), Dune fails with a dependency cycle:

$ echo "(lang dune 2.8)" > dune-project
$ mkdir lib
$ touch lib.opam file lib/lib.ml
$ cat >lib/dune <<EOF
> (library (name lib) (public_name lib))
> (copy_files (files ../file))
> EOF

$ dune build
Internal error, please report upstream including the contents of _build/log.
Description:
  ("dependency cycle that does not involve any files",
  { frames =
      [ ("eval-pred",
        { dir = In_build_dir "default"; predicate = { id = Glob "file" } })
      ; ("dir-contents-get0", ("default", "default/lib"))
      ; ("stanzas-to-entries", "default")
      ; ("<unnamed>", ())
      ; ("<unnamed>", ())
      ; ("<unnamed>", ())
      ; ("<unnamed>", ())
      ; ("load-dir", In_build_dir "default")
      ; ("eval-pred",
        { dir = In_build_dir "default"; predicate = { id = Glob "file" } })
      ]
  })
Raised at Stdune__code_error.raise in file "src/stdune/code_error.ml", line
  9, characters 30-62
Called from Dune_engine__dep_path.map in file "src/dune_engine/dep_path.ml",
  line 90, characters 10-15
Called from Stdune__exn_with_backtrace.map in file
  "src/stdune/exn_with_backtrace.ml", line 20, characters 40-45
Called from Stdune__exn_with_backtrace.map_and_reraise in file
  "src/stdune/exn_with_backtrace.ml" (inlined), line 22, characters 35-45
Called from Dune_engine__build_system.process_exn_and_reraise in file
  "src/dune_engine/build_system.ml", line 1915, characters 2-162
Called from Fiber.Execution_context.forward_exn_with_bt in file
  "src/fiber/fiber.ml", line 136, characters 10-17

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.

It seems to be important that the file being copied into the lib is taken from a parent directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions