Skip to content

Commit

Permalink
test: repro for ocaml#8210 (EACCESS if sendfile fails)
Browse files Browse the repository at this point in the history
What's happening here is:

- input and output files are open
- sendfile is attempted and fails
- both files are closed
- input file is opened again
- output file is opened again (but already exists)

This throws an error if the output file is not writable.

Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Jul 25, 2023
1 parent 93ad460 commit 098c83a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/blackbox-tests/test-cases/github8041.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
$ cat > dune-project << EOF
> (lang dune 1.0)
> (lang dune 2.4)
> (package
> (name p))
> EOF

$ cat > dune << EOF
> (rule (copy data.txt data2.txt))
>
> (install
> (files data.txt)
> (files data.txt data2.txt)
> (section share))
> EOF

Expand All @@ -15,3 +17,12 @@
If sendfile fails, we should fallback to the portable implementation.

$ strace -e inject=sendfile:error=EINVAL -o /dev/null dune build @install
Error: _build/default/data2.txt: Permission denied
-> required by _build/default/data2.txt
-> required by _build/install/default/share/p/data2.txt
-> required by _build/default/p.install
-> required by alias install
[1]

#8210: data2.txt is copied from readonly-file data.txt (#3092), so it needs to
be adequately unlinked before starting the fallback.

0 comments on commit 098c83a

Please sign in to comment.