dune icon indicating copy to clipboard operation
dune copied to clipboard

stacktrace when trying to promote into a binary in use (linux)

Open c-cube opened this issue 5 years ago • 1 comments

Expected Behavior

I have a binary with (promote (until-clean) (into ..)) (which copies the binary into the project main directory). I'm running the binary (a server) and using dune build @all -w on the side while I code. Upon an edit, compilation crashes with a stacktrace.

dune build @all -w would either be able to replace the binary while it's running (maybe with a move? not sure), or wait until it's not in use and then replace it

Actual Behavior

compilation goes well, but

Error: exception Sys_error("foo.exe: Text file busy")
Backtrace:
Raised by primitive operation at file "stdlib.ml", line 324, characters 29-55
Called from file "src/stdune/io.ml", line 184, characters 8-126
Re-raised at file "src/stdune/io.ml", line 189, characters 8-23
Called from file "src/dune/artifact_substitution.ml", line 383, characters 15-48
Called from file "src/fiber/fiber.ml", line 229, characters 16-19
Called from file "src/dune/build_system.ml", line 1527, characters 8-1023
Called from file "src/fiber/fiber.ml", line 102, characters 8-15
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters 33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters 33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters 33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters 33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17

Reproduction

  1. write a basic long running program (e.g. a while loop with sleep) in src/
  2. (promote (until-clean) (into ..)) in the executable stanza
  3. dune build @all -w
  4. modify the program, should get a stacktrace in dune

Specifications

  • Version of dune (output of dune --version): 2.2.0
  • Version of ocaml (output of ocamlc --version): 4.06.1
  • Operating system (distribution and version): archlinux, linux 5.6.3

c-cube avatar May 13 '20 13:05 c-cube

At the very least, we should print a nice error

ghost avatar May 13 '20 13:05 ghost