diff options
author | Simon McVittie <smcv@collabora.com> | 2021-01-12 10:45:14 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2021-06-22 17:57:35 +0100 |
commit | 8f72ceb2c42a2d93c858b8775a88f13b891c8120 (patch) | |
tree | 81c8ae935c6f1abca98607f806280ffb8b1d0f35 /tests | |
parent | 90c8cd49f7540cff4b29deb3b78903b855faa07d (diff) | |
download | bubblewrap-8f72ceb2c42a2d93c858b8775a88f13b891c8120.tar.gz |
Add --clearenv option
This allows environment variables to be set when running bwrap itself
(perhaps a custom LD_LIBRARY_PATH), but cleared for the command that
runs in the container, without having to enumerate all the variables.
Because PWD is set later, as a side-effect of changing directory, this
actually clears everything except PWD.
A portable program would check for clearenv() (and if not found, fall
back to using environ = NULL), but bubblewrap is Linux-specific, and
Linux C libraries (at least glibc and musl) do have clearenv().
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test-run.sh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/test-run.sh b/tests/test-run.sh index 5ba65f7..426eeca 100755 --- a/tests/test-run.sh +++ b/tests/test-run.sh @@ -538,6 +538,9 @@ assert_file_has_content stdout barbaz FOO=wrong BAR=baz $RUN --unsetenv FOO sh -c 'printf "%s%s" "$FOO" "$BAR"' > stdout printf baz > reference assert_files_equal stdout reference +FOO=wrong BAR=wrong $RUN --clearenv /usr/bin/env > stdout +echo "PWD=$(pwd -P)" > reference +assert_files_equal stdout reference echo "ok - environment manipulation" echo "ok - End of test" |