generic/375: test both regular file and directory

generic/375 previously only tested SGID being cleared on a regular
file. It should test SGID being cleared on a directory too. Though
this is not required by POSIX, it is the Linux behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eric Biggers
2016-10-12 15:03:07 -07:00
committed by Eryu Guan
parent 8425118bff
commit 92846328ba
2 changed files with 42 additions and 20 deletions
+15 -1
View File
@@ -52,10 +52,23 @@ _require_runas
_require_acls
cd $TEST_DIR
# try with both regular file and directory
for filetype in regular dir; do
case $filetype in
regular)
testfile=testfile.$seq
rm -f $testfile
touch $testfile
;;
*)
testfile=testdir.$seq
rm -rf $testfile
mkdir $testfile
;;
esac
chown 100:100 $testfile
echo '*** SGID should remain set (twice)'
@@ -76,6 +89,7 @@ stat -c %A $testfile
echo '*** Expected failure'
_runas -u 101 -g 101 -- chmod 2777 $testfile
done
status=0
exit
+8
View File
@@ -7,3 +7,11 @@ QA output created by 375
-rwxrwxrwx
*** Expected failure
chmod: changing permissions of 'testfile.375': Operation not permitted
*** SGID should remain set (twice)
drwxrwsrwx
drwxrwsrwx
*** SGID should be cleared (twice)
drwxrwxrwx
drwxrwxrwx
*** Expected failure
chmod: changing permissions of 'testdir.375': Operation not permitted