From: Jim Meyering Date: Fri, 12 Jan 2001 23:27:43 +0000 (+0000) Subject: * tests/chmod/setgid: If `chmod g+s d' fails, then try to chgrp X-Git-Tag: FILEUTILS-4_0_36~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6deb757ba46d36c5de483127fc6f500597df7276;p=thirdparty%2Fcoreutils.git * 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. --- diff --git a/tests/chmod/setgid b/tests/chmod/setgid index db50341c46..915c5194ad 100755 --- a/tests/chmod/setgid +++ b/tests/chmod/setgid @@ -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,