summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-09-22 03:59:58 +0100
committerPádraig Brady <P@draigBrady.com>2013-09-22 03:59:58 +0100
commit587cc684dc3f104bb9b6b05c7fc4873660909dac (patch)
tree52ca0da48d4d9d96e33a19cca475cfcd81656a4b
parent414666db153e3b725cf67c9aece67f3fd45f5e81 (diff)
downloadcoreutils-587cc684dc3f104bb9b6b05c7fc4873660909dac.tar.xz
tests: parameterize the "root" username
* tests/misc/chroot-credentials.sh: Don't assume uid 0 has the "root" name, nor any name for that matter.
-rwxr-xr-xtests/misc/chroot-credentials.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/misc/chroot-credentials.sh b/tests/misc/chroot-credentials.sh
index 8eb658d94..cb4dc233b 100755
--- a/tests/misc/chroot-credentials.sh
+++ b/tests/misc/chroot-credentials.sh
@@ -22,16 +22,17 @@ print_ver_ chroot
require_root_
+root=$(id -nu 0) || skip_ "Couldn't lookup root username"
# Verify that root credentials are kept.
-test $(chroot / whoami) = root || fail=1
+test $(chroot / whoami) = "$root" || fail=1
test "$(groups)" = "$(chroot / groups)" || fail=1
# Verify that credentials are changed correctly.
whoami_after_chroot=$(
chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami
)
-test "$whoami_after_chroot" != root || fail=1
+test "$whoami_after_chroot" != "$root" || fail=1
# Verify that there are no additional groups.
id_G_after_chroot=$(