diff options
author | Jim Meyering <jim@meyering.net> | 2001-01-12 23:27:43 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-01-12 23:27:43 +0000 |
commit | 6deb757ba46d36c5de483127fc6f500597df7276 (patch) | |
tree | 18fa1726354ab518e0b19be978951a8dd1dd6e98 /tests/chmod/setgid | |
parent | a0d25e62aa5c1fd3e17b9d178ed9cbc147287ba9 (diff) | |
download | coreutils-6deb757ba46d36c5de483127fc6f500597df7276.tar.xz |
* 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.
Diffstat (limited to 'tests/chmod/setgid')
-rwxr-xr-x | tests/chmod/setgid | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/chmod/setgid b/tests/chmod/setgid index db50341c4..915c5194a 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, |