-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(pkg): [exported_env] and [PATH] (#10095)
Demonstrate that appending to [PATH] using [exported_env] doesn't allow us to access additional binaries. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
We set the PATH with (exported_env ..) and this should be reflected when | ||
looking up binaries in the workspace. | ||
|
||
$ . ./helpers.sh | ||
|
||
$ make_lockdir | ||
|
||
$ bin=foobarbin | ||
|
||
$ mkdir _bin | ||
$ cat >_bin/$bin <<EOF | ||
> #!/usr/bin/env sh | ||
> echo foo | ||
> EOF | ||
$ chmod +x _bin/$bin | ||
$ make_lockpkg <<EOF | ||
> (version 1.0.0) | ||
> (exported_env | ||
> (:= PATH $PWD/_bin)) | ||
> EOF | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.13) | ||
> EOF | ||
$ cat >dune <<EOF | ||
> (rule | ||
> (alias foo) | ||
> (action (run %{bin:$bin}))) | ||
> EOF | ||
$ dune build @foo | ||
File "dune", line 3, characters 14-30: | ||
3 | (action (run %{bin:foobarbin}))) | ||
^^^^^^^^^^^^^^^^ | ||
Error: Program foobarbin not found in the tree or in PATH | ||
(context: default) | ||
[1] | ||
$ PATH=$PWD/_bin:$PATH $bin | ||
foo |