-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent crash on absolute path in install stanza and glob_files_rec
These cases now result in a user error being raised instead of crashing dune. Signed-off-by: Stephen Sherratt <[email protected]>
- Loading branch information
Showing
7 changed files
with
87 additions
and
1 deletion.
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
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
test/blackbox-tests/test-cases/install-absolute-path-error.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,41 @@ | ||
Report an error when absolute paths appear in the install stanza | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.6) | ||
> (package (name foo)) | ||
> EOF | ||
|
||
Put $PWD in a file that can be read with the %{read:...} pform, so that the underline | ||
in the error message is of consisntent length on different systems. | ||
$ printf $PWD > pwd | ||
|
||
$ touch foo.txt | ||
|
||
$ cat >dune <<EOF | ||
> (install | ||
> (files %{read:pwd}/foo.txt) | ||
> (section share)) | ||
> EOF | ||
|
||
$ dune build @install | ||
File "dune", line 2, characters 8-27: | ||
2 | (files %{read:pwd}/foo.txt) | ||
^^^^^^^^^^^^^^^^^^^ | ||
Error: absolute paths are not allowed in the install stanza | ||
[1] | ||
|
||
$ mkdir -p bar | ||
$ touch bar/bar.txt | ||
|
||
$ cat >dune <<EOF | ||
> (install | ||
> (dirs %{read:pwd}/bar) | ||
> (section share)) | ||
> EOF | ||
|
||
$ dune build @install | ||
File "dune", line 2, characters 7-22: | ||
2 | (dirs %{read:pwd}/bar) | ||
^^^^^^^^^^^^^^^ | ||
Error: absolute paths are not allowed in the install stanza | ||
[1] |