summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-03-26 10:50:45 +0100
committerJan Tojnar <jtojnar@gmail.com>2022-03-26 10:55:42 +0100
commit1898019face400b84b504c199a5a3de27969103d (patch)
treec275b44bb88d9b6d071995f637a982c92e5de0dc
parent574d35bbdf0f3e62c94bcb396ea4f005afc0418d (diff)
downloadostree-1898019face400b84b504c199a5a3de27969103d.tar.gz
tests/test-cli-extensions: Fix with single-binary coreutils
On systems where `coreutils` are built with `--enable-single-binary=symlinks` like Nix, `/usr/bin/env` is symlinked to `/usr/bin/coreutils` and uses `argv[0]` to determine which program to run. Since the `test-cli-extensions.sh` created a new symlink named `ostree-env`, coreutils would be confused about the utility to choose, so running it would fail: ostree-env: unknown program ‘ostree-env’ Try 'ostree-env --help' for more information. Fixes: https://github.com/ostreedev/ostree/issues/2553
-rwxr-xr-xtests/test-cli-extensions.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/test-cli-extensions.sh b/tests/test-cli-extensions.sh
index e1916036..edce0c9d 100755
--- a/tests/test-cli-extensions.sh
+++ b/tests/test-cli-extensions.sh
@@ -15,7 +15,9 @@ echo '1..2'
mkdir -p ./localbin
ORIG_PATH="${PATH}"
export PATH="./localbin/:${PATH}"
-ln -s /usr/bin/env ./localbin/ostree-env
+echo '#!/bin/sh' >> ./localbin/ostree-env
+echo 'env "$@"' >> ./localbin/ostree-env
+chmod +x ./localbin/ostree-env
export A_CUSTOM_TEST_FLAG="myvalue"
${CMD_PREFIX} ostree env >out.txt
assert_file_has_content out.txt "^A_CUSTOM_TEST_FLAG=myvalue"