Skip to content

Commit dee4a3d

Browse files
committed
test: glob_files_rec with a relative path
We demonstrate that using relative paths in [glob_files_rec] has unintended consequences. In this test, we install some artifacts outside the package directory just by globbing from a parent dir. Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: 0f38b0df-b5b3-4797-a555-8687aed27290 -->
1 parent cb3489d commit dee4a3d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Install a glob pattern from a relative path
2+
3+
$ cat >dune-project <<EOF
4+
> (lang dune 3.6)
5+
> (package (name foo))
6+
> EOF
7+
8+
$ mkdir -p stanza stuff/xy
9+
$ touch stuff/foo.txt stuff/xy/bar.txt
10+
11+
$ cat >stanza/dune <<EOF
12+
> (install
13+
> (files (glob_files_rec ../stuff/*.txt))
14+
> (section share))
15+
> EOF
16+
17+
$ dune build foo.install
18+
$ cat _build/default/foo.install
19+
lib: [
20+
"_build/install/default/lib/foo/META"
21+
"_build/install/default/lib/foo/dune-package"
22+
]
23+
share: [
24+
"_build/install/default/share/stuff/foo.txt" {"../stuff/foo.txt"}
25+
"_build/install/default/share/stuff/xy/bar.txt" {"../stuff/xy/bar.txt"}
26+
]
27+
28+
$ dune install foo --prefix _foo
29+
$ find _foo | sort | grep stuff
30+
_foo/share/stuff
31+
_foo/share/stuff/foo.txt
32+
_foo/share/stuff/xy
33+
_foo/share/stuff/xy/bar.txt

0 commit comments

Comments
 (0)