* [PATCH] generic/375: test both regular file and directory
@ 2016-10-12 22:03 Eric Biggers
2016-10-12 22:03 ` [PATCH] generic/314: don't test SGID behavior after setfacl Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2016-10-12 22:03 UTC (permalink / raw)
To: fstests; +Cc: jack, agruenba, Eric Biggers
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>
---
tests/generic/375 | 54 ++++++++++++++++++++++++++++++++-------------------
tests/generic/375.out | 8 ++++++++
2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/tests/generic/375 b/tests/generic/375
index f8c3260..1d523e5 100755
--- a/tests/generic/375
+++ b/tests/generic/375
@@ -52,30 +52,44 @@ _require_runas
_require_acls
cd $TEST_DIR
-testfile=testfile.$seq
-rm -f $testfile
-touch $testfile
-chown 100:100 $testfile
+# try with both regular file and directory
+for filetype in regular dir; do
-echo '*** SGID should remain set (twice)'
-chmod 2755 $testfile
-_runas -u 100 -g 100 -- chmod 2777 $testfile
-stat -c %A $testfile
-chmod 2755 $testfile
-_runas -u 100 -g 100 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
-stat -c %A $testfile
+ case $filetype in
+ regular)
+ testfile=testfile.$seq
+ rm -f $testfile
+ touch $testfile
+ ;;
+ *)
+ testfile=testdir.$seq
+ rm -rf $testfile
+ mkdir $testfile
+ ;;
+ esac
-echo '*** SGID should be cleared (twice)'
-chmod 2755 $testfile
-_runas -u 100 -g 101 -- chmod 2777 $testfile
-stat -c %A $testfile
-chmod 2755 $testfile
-_runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
-stat -c %A $testfile
+ chown 100:100 $testfile
-echo '*** Expected failure'
-_runas -u 101 -g 101 -- chmod 2777 $testfile
+ echo '*** SGID should remain set (twice)'
+ chmod 2755 $testfile
+ _runas -u 100 -g 100 -- chmod 2777 $testfile
+ stat -c %A $testfile
+ chmod 2755 $testfile
+ _runas -u 100 -g 100 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
+ stat -c %A $testfile
+
+ echo '*** SGID should be cleared (twice)'
+ chmod 2755 $testfile
+ _runas -u 100 -g 101 -- chmod 2777 $testfile
+ stat -c %A $testfile
+ chmod 2755 $testfile
+ _runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile
+ stat -c %A $testfile
+
+ echo '*** Expected failure'
+ _runas -u 101 -g 101 -- chmod 2777 $testfile
+done
status=0
exit
diff --git a/tests/generic/375.out b/tests/generic/375.out
index 478d078..bb9bc72 100644
--- a/tests/generic/375.out
+++ b/tests/generic/375.out
@@ -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
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] generic/314: don't test SGID behavior after setfacl
2016-10-12 22:03 [PATCH] generic/375: test both regular file and directory Eric Biggers
@ 2016-10-12 22:03 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2016-10-12 22:03 UTC (permalink / raw)
To: fstests; +Cc: jack, agruenba, Eric Biggers
Linux 4.9 (since commit 073931017b49: "posix_acl: Clear SGID bit when
setting file permissions") now may clear the SGID bit when setting a
POSIX ACL, to match chmod() behavior. This was making generic/314 fail.
Since SGID bit clearing is already tested by generic/375, just remove
the problematic portion of generic/314.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
tests/generic/314 | 8 ++------
tests/generic/314.out | 1 -
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/tests/generic/314 b/tests/generic/314
index 65d3513..49b03e4 100755
--- a/tests/generic/314
+++ b/tests/generic/314
@@ -39,12 +39,10 @@ _cleanup()
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
-. ./common/attr
# real QA test starts here
_supported_fs generic
_require_test
-_require_acls
_require_user
rm -rf $TEST_DIR/$seq-dir
@@ -56,12 +54,10 @@ chown $qa_user:12345 $TEST_DIR/$seq-dir
# Make parent dir sgid
chmod 2775 $TEST_DIR/$seq-dir
-# Make subdirs before & after acl set
+# Make subdir
su $qa_user -c "umask 022; mkdir $TEST_DIR/$seq-dir/subdir"
-su $qa_user -c "setfacl -m u:$qa_user:rwx,d:u:$qa_user:rwx $TEST_DIR/$seq-dir"
-su $qa_user -c "mkdir $TEST_DIR/$seq-dir/subdir2"
-# Both subdirs should have inherited sgid
+# Subdir should have inherited sgid
_ls_l $TEST_DIR/$seq-dir/ | grep -v total | _filter_test_dir | awk '{print $1,$NF}'
status=0
diff --git a/tests/generic/314.out b/tests/generic/314.out
index b2db82b..bcd14f5 100644
--- a/tests/generic/314.out
+++ b/tests/generic/314.out
@@ -1,3 +1,2 @@
QA output created by 314
drwxr-sr-x subdir
-drwxrwsr-x+ subdir2
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-12 22:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 22:03 [PATCH] generic/375: test both regular file and directory Eric Biggers
2016-10-12 22:03 ` [PATCH] generic/314: don't test SGID behavior after setfacl Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox