summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-06-19 09:03:41 +0200
committerJim Meyering <meyering@redhat.com>2008-06-19 09:20:31 +0200
commit2c88abe2a2a5579cb1673af5f6a28204305a45f5 (patch)
tree89f5cf6d9957cb0ee328f3bcb7377fbfe7b95a09 /tests
parent7d10e300885ec80957f257796bec21c4c1a8a71b (diff)
downloadcoreutils-2c88abe2a2a5579cb1673af5f6a28204305a45f5.tar.xz
tests: avoid test failure when root's primary group-ID is not 0
* tests/cp/preserve-gid: Expect a cp-without-`-p'-created file to have a group ID of $(id -g). Reported by Jarod Wilson. Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803/focus=13837
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/preserve-gid6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid
index a999322d2..d7f86e030 100755
--- a/tests/cp/preserve-gid
+++ b/tests/cp/preserve-gid
@@ -19,6 +19,10 @@
. $srcdir/test-lib.sh
require_root_
+# Record primary group number, usually 0.
+# This is the group ID used when cp (without -p) creates a new file.
+primary_group_num=$(id -g)
+
create() {
echo "$1" > "$1" || exit 1
chown "+$2:+$3" "$1" || exit 1
@@ -34,7 +38,7 @@ t0() {
if test "x$s" != "x$u $g"; then
# Allow the actual group to match that of the parent directory
# (it was set to 0 above).
- if test "x$s" = "x$u 0"; then
+ if test "x$s" = "x$u $primary_group_num"; then
:
else
echo "$0: $* $f b: $u $g != $s" 1>&2