summaryrefslogtreecommitdiff
path: root/tests/misc/truncate-owned-by-other.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-06-26 12:41:01 +0100
committerPádraig Brady <P@draigBrady.com>2014-06-26 15:30:41 +0100
commitacb422bdd1b325285bb46883f02d8fc6402efd14 (patch)
tree1f77b51c48cff7532a9227fa3517c5c26eee30be /tests/misc/truncate-owned-by-other.sh
parente7c7802964cbf0f77a5883808e28eab56e36907b (diff)
downloadcoreutils-acb422bdd1b325285bb46883f02d8fc6402efd14.tar.xz
tests: use predetermined NON_ROOT_GID
* HACKING: GID is more useful in tests than group name, so rename input param from NON_ROOT_GROUP to NON_ROOT_GID to make it obvious that only a group ID is now acceptable, thus allowing GID lookups to be avoided throughout the tests. * init.cfg (require_root_): Likewise. * tests/misc/truncate-owned-by-other.sh: Avoid looking up the GID. * tests/touch/now-owned-by-other.sh: Likewise. * tests/misc/chroot-credentials.sh: Likewise. Also fix an instance of comparison against NON_ROOT_GROUP which would have given a false failure if a non numeric value was passed in. * tests/id/setgid.sh: Use previously looked up gid as a more accurate base for the subsequent adjustment, and move the uid lookup within chroot, rather than having the overhead of a separate `id` invocation.
Diffstat (limited to 'tests/misc/truncate-owned-by-other.sh')
-rwxr-xr-xtests/misc/truncate-owned-by-other.sh4
1 files changed, 1 insertions, 3 deletions
diff --git a/tests/misc/truncate-owned-by-other.sh b/tests/misc/truncate-owned-by-other.sh
index e93b7f136..e70badb6b 100755
--- a/tests/misc/truncate-owned-by-other.sh
+++ b/tests/misc/truncate-owned-by-other.sh
@@ -21,11 +21,9 @@ print_ver_ truncate
require_root_
-group_num=$(id -g $NON_ROOT_USERNAME)
-
# Create a file owned by root, and writable by $NON_ROOT_USERNAME.
echo > root-owned || framework_failure_
-chgrp +$group_num . root-owned || framework_failure_
+chgrp +$NON_ROOT_GID . root-owned || framework_failure_
chmod g+w root-owned
# Ensure that the current directory is searchable by $NON_ROOT_USERNAME.