]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: port better to macOS group numbers
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 18 Feb 2023 21:27:45 +0000 (13:27 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 18 Feb 2023 21:30:09 +0000 (13:30 -0800)
* init.cfg (groups): Port better to macOS 12, where
group 4294967295 (nogroup) is special: you can be a member
without being able to chgrp files to the group.

init.cfg

index eaef53a57bcfc93513c57d26ab0d132d2cd1d37d..8b2d68b2289344d3e6a76cace7ec167ac05d4c1f 100644 (file)
--- a/init.cfg
+++ b/init.cfg
@@ -488,7 +488,19 @@ require_membership_in_two_groups_()
 {
   test $# = 0 || framework_failure_
 
-  groups=${COREUTILS_GROUPS-$( (id -G || /usr/xpg4/bin/id -G) 2>/dev/null)}
+  groups=
+  for group_ in 1 \
+    ${COREUTILS_GROUPS-$( (id -G || /usr/xpg4/bin/id -G) 2>/dev/null)}
+  do
+    # Skip group numbers equal to 2**N - 1 for common N,
+    # as they are possibly reserved groups like 'nogroup'.
+    case $group_ in
+      1 | 32767 | 65535 | 2147483647 | 4294967295) ;;
+      9223372036854775807 | 18446744073709551615) ;;
+      *) test -z "$groups" || groups="$groups "
+         groups="$groups$group_";;
+    esac
+  done
   case "$groups" in
     *' '*) ;;
     *) skip_ 'requires membership in two groups