On 01/24/2014 07:46 AM, Bernhard Voelker wrote:
On 01/24/2014 04:09 AM, Pádraig Brady wrote:
Oh right, grep ^$id_gn: it is so.
BTW: I'd change the skip_ message to reflect the above mentioned
corner case where getent is not available, something like:
- skip_ "multiple IDs for group '$id_gn': $(getent group "$id_gn")"
+ skip_ "group '$id_gn' not biunique: $(getent group | grep "^$id_gn:")"
Attached is an updated version, using grep and the suggested error message.
On addition is a "tr '\n' ','" - because "skip" only shows the first
line of the message, and so multiple groups and not displayed.
-gordon
>From 5fc10774383928b2fbfde33de3efb314166fe475 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgor...@gmail.com>
Date: Thu, 23 Jan 2014 20:34:52 -0500
Subject: [PATCH] tests: skip chown/separator with conflicting group IDs
* tests/chown/separator.sh: skip test if the user's group has
multiple entries.
Fixes http://bugs.gnu.org/16532
---
tests/chown/separator.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/chown/separator.sh b/tests/chown/separator.sh
index f64b738..f5ecb5b 100755
--- a/tests/chown/separator.sh
+++ b/tests/chown/separator.sh
@@ -31,6 +31,12 @@ test -n "$id_g" || framework_failure_
id_gn=$(id -gn) || framework_failure_
test -n "$id_gn" || framework_failure_
+# Systems with both local and external groups with conflicting IDs,
+# were seen to fail this test erroneously with EPERM errors.
+test $(getent group | grep "^$id_gn:" | wc -l) = 1 ||
+ skip_ "group '$id_gn' not biunique: " \
+ "$(getent group | grep "^$id_gn:" | tr '\n' ',')"
+
# FreeBSD 6.x's getgrnam fails to look up a group name containing
# a space. On such a system, skip this test if the group name contains
# a byte not in the portable filename character set.
--
1.8.4.3