-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Repro 'dune fmt' crash in presence of Nix result
Signed-off-by: Jules Aguillon <jules@j3s.fr>
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Nix can leave a symlink to a store path in the tree, often called 'result'. | ||
'dune fmt' crashes because of that. | ||
|
||
$ RESULT=`mktemp -d` | ||
$ echo "let x = 2" > "$RESULT/foo.ml" | ||
$ chmod -R 555 "$RESULT" | ||
|
||
$ ln -s "$RESULT" result | ||
$ echo "(lang dune 2.8)" > dune-project | ||
$ touch .ocamlformat | ||
|
||
$ dune fmt --auto-promote | ||
File "result/foo.ml", line 1, characters 0-0: | ||
Error: Files _build/default/result/foo.ml and | ||
_build/default/result/.formatted/foo.ml differ. | ||
Promoting _build/default/result/.formatted/foo.ml to result/foo.ml. | ||
Internal error, please report upstream including the contents of _build/log. | ||
Description: | ||
("hooks failed", | ||
{ exns = | ||
[ { exn = "Unix.Unix_error(Unix.EACCES, \"open\", \"result/foo.ml\")" | ||
; backtrace = | ||
"Raised by primitive operation at Stdune__Io.Copyfile.sendfile_with_fallback.setup_copy in file \"otherlibs/stdune/src/io.ml\", line 142, characters 18-86\n\ | ||
Re-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/src/exn.ml\", line 38, characters 27-56\n\ | ||
Called from Promote__Diff_promotion.do_promote.promote_one in file \"src/promote/diff_promotion.ml\", line 150, characters 6-40\n\ | ||
Called from Stdlib__Map.Make.iter in file \"map.ml\", line 305, characters 20-25\n\ | ||
Called from Promote__Diff_promotion.do_promote in file \"src/promote/diff_promotion.ml\", line 159, characters 4-51\n\ | ||
Called from Promote__Diff_promotion.finalize in file \"src/promote/diff_promotion.ml\", line 181, characters 28-51\n\ | ||
Called from Stdune__Exn_with_backtrace.try_with in file \"otherlibs/stdune/src/exn_with_backtrace.ml\", line 9, characters 8-12\n\ | ||
" | ||
} | ||
] | ||
}) | ||
Raised at Stdune__Code_error.raise in file | ||
"otherlibs/stdune/src/code_error.ml", line 10, characters 30-62 | ||
Called from Dune__exe__Build_cmd.run_build_system.(fun) in file | ||
"bin/build_cmd.ml", line 81, characters 6-31 | ||
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml", | ||
line 76, characters 8-11 | ||
Re-raised at Stdune__Exn.raise_with_backtrace in file | ||
"otherlibs/stdune/src/exn.ml", line 38, characters 27-56 | ||
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml", | ||
line 76, characters 8-11 | ||
Re-raised at Stdune__Exn.raise_with_backtrace in file | ||
"otherlibs/stdune/src/exn.ml", line 38, characters 27-56 | ||
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. | ||
[1] | ||
|
||
Allow Dune to remove temporary files (Dune crashes without this): | ||
|
||
$ chmod -R u+w "$RESULT" |