-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: stale directory target check (#8924)
The current directory check swallows permission and other errors and just says the directory doesn't exist. We improve the check to emit a correct error every time. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
- Loading branch information
Showing
2 changed files
with
49 additions
and
7 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
22 changes: 22 additions & 0 deletions
22
test/blackbox-tests/test-cases/sandboxing-stale-directory-target.t
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,22 @@ | ||
A faulty test escapes the sandbox by creating its target outside the sandbox | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.11) | ||
> (using directory-targets 0.1) | ||
> EOF | ||
|
||
$ cat >dune <<EOF | ||
> (rule | ||
> (target (dir foo)) | ||
> (action (system "mkdir $PWD/_build/default/foo && mkdir foo"))) | ||
> EOF | ||
|
||
$ dune build foo/ --sandbox=copy 2>&1 | sed -E 's/characters [0-9]+-[0-9]+/characters <REDACTED>/' | ||
File "dune", line 1, characters <REDACTED>: | ||
1 | (rule | ||
2 | (target (dir foo)) | ||
3 | (action (system "mkdir $TESTCASE_ROOT/_build/default/foo && mkdir foo"))) | ||
Error: Target _build/default/foo of kind directory already exists in the | ||
build directory | ||
Hint: delete this file manually or check the permissions of the parent | ||
directory of this file |