Skip to content

Commit

Permalink
test(pkg): [exported_env] and [PATH] (#10095)
Browse files Browse the repository at this point in the history
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
rgrinberg committed Mar 15, 2024
1 parent 2e11cbd commit a040f34
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/blackbox-tests/test-cases/pkg/setenv-bin-dir.t
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

0 comments on commit a040f34

Please sign in to comment.