Skip to content

Commit

Permalink
test: Repro 'dune fmt' crash in presence of Nix result
Browse files Browse the repository at this point in the history
A 'ocamlformat' executable is added to the test to avoid depending on
OCamlformat.

Signed-off-by: Jules Aguillon <[email protected]>
  • Loading branch information
Julow committed Dec 16, 2024
1 parent 3fc17ee commit be4fc2b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(executable
(name ocamlformat))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 2.8)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(* Avoid adding dependencies to this cram test *)
let () = print_endline "(* formatted *)"
16 changes: 16 additions & 0 deletions test/blackbox-tests/test-cases/read-only-symlink-target.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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 a-w "$RESULT"
$ ln -s "$RESULT" result

This command should succeed:

$ dune fmt 2>/dev/null
[1]

Allow Dune to remove temporary files (calling Dune crashes without this):

$ chmod -R u+w "$RESULT"

0 comments on commit be4fc2b

Please sign in to comment.