1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00

* tests/chmod/setgid: If `chmod g+s d' fails, then try to chgrp

to a group of which we're a member, then try the chmod again.
This commit is contained in:
Jim Meyering
2001-01-12 23:27:43 +00:00
parent a0d25e62aa
commit 6deb757ba4

View File

@@ -27,6 +27,24 @@ cd $tmp || framework_failure=1
. $abs_srcdir/../setgid-check
umask 0
mkdir d || framework_failure=1
chmod g+s d 2> /dev/null ||
{
# This is required because on some systems (at least NetBSD 1.4.2A),
# it may happen that when you create a directory, its group isn't one
# to which you belong. When that happens, the above chmod fails. So
# here, upon failure, we try to set the group, then rerun the chmod command.
group=${FETISH_GROUP-`(id -nG || /usr/xpg4/bin/id -nG) 2>/dev/null`}
if test "$group"; then
chgrp "$group" d || framework_failure=1
chmod g+s d || framework_failure=1
else
framework_failure=1
fi
}
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
@@ -34,9 +52,6 @@ fi
fail=0
umask 0
mkdir d
chmod g+s d
chmod 755 d
# To be compatible with chmod from other vendors,