public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/004: Check resulting file permissions
@ 2016-10-19 10:51 Andreas Gruenbacher
  2016-10-20 16:56 ` Eryu Guan
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Gruenbacher @ 2016-10-19 10:51 UTC (permalink / raw)
  To: fstests; +Cc: Andreas Gruenbacher

Check the file permissions resulting from linking an O_TMPFILE file into
the namespace: they should be the same as creating a normal file.

(Note that this patch depends on patch "xfs_io: Fix initial -m option"
for xfsprogs.)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 tests/generic/004     | 14 +++++++++++++-
 tests/generic/004.out |  8 ++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/generic/004 b/tests/generic/004
index d0926f1..f9a7520 100755
--- a/tests/generic/004
+++ b/tests/generic/004
@@ -52,12 +52,24 @@ rm -f $seqres.full
 testfile="${TEST_DIR}/tst-tmpfile-flink"
 
 # test creating a r/w tmpfile, do I/O and link it into the namespace
-$XFS_IO_PROG -T \
+echo umask 022
+umask 022
+$XFS_IO_PROG -T -m 0666 \
 	-c "pwrite 0 4096" \
 	-c "pread 0 4096" \
 	-c "flink ${testfile}" \
 	${TEST_DIR} | _filter_xfs_io
+stat -c '%a' ${testfile}
+rm ${testfile}
 
+echo umask 027
+umask 027
+$XFS_IO_PROG -T -m 0666 \
+	-c "pwrite 0 4096" \
+	-c "pread 0 4096" \
+	-c "flink ${testfile}" \
+	${TEST_DIR} | _filter_xfs_io
+stat -c '%a' ${testfile}
 rm ${testfile}
 
 # test creating a r/o tmpfile.  Should fail
diff --git a/tests/generic/004.out b/tests/generic/004.out
index 527b2c2..11f44e7 100644
--- a/tests/generic/004.out
+++ b/tests/generic/004.out
@@ -1,6 +1,14 @@
 QA output created by 004
+umask 022
 wrote 4096/4096 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 4096/4096 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+644
+umask 027
+wrote 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+640
 TEST_DIR: Invalid argument
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] generic/004: Check resulting file permissions
  2016-10-19 10:51 [PATCH] generic/004: Check resulting file permissions Andreas Gruenbacher
@ 2016-10-20 16:56 ` Eryu Guan
  0 siblings, 0 replies; 2+ messages in thread
From: Eryu Guan @ 2016-10-20 16:56 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: fstests

On Wed, Oct 19, 2016 at 12:51:07PM +0200, Andreas Gruenbacher wrote:
> Check the file permissions resulting from linking an O_TMPFILE file into
> the namespace: they should be the same as creating a normal file.
> 
> (Note that this patch depends on patch "xfs_io: Fix initial -m option"
> for xfsprogs.)
> 
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

I think it's better to add a new case to do the test, the test intention
of generic/004 is to test linking O_TMPFILE opens back to namespace, not
about the permissions. And we usually don't extend existing tests to do
more tests, in case it triggers false alarm of regressions.

Thanks,
Eryu

> ---
>  tests/generic/004     | 14 +++++++++++++-
>  tests/generic/004.out |  8 ++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/004 b/tests/generic/004
> index d0926f1..f9a7520 100755
> --- a/tests/generic/004
> +++ b/tests/generic/004
> @@ -52,12 +52,24 @@ rm -f $seqres.full
>  testfile="${TEST_DIR}/tst-tmpfile-flink"
>  
>  # test creating a r/w tmpfile, do I/O and link it into the namespace
> -$XFS_IO_PROG -T \
> +echo umask 022
> +umask 022
> +$XFS_IO_PROG -T -m 0666 \
>  	-c "pwrite 0 4096" \
>  	-c "pread 0 4096" \
>  	-c "flink ${testfile}" \
>  	${TEST_DIR} | _filter_xfs_io
> +stat -c '%a' ${testfile}
> +rm ${testfile}
>  
> +echo umask 027
> +umask 027
> +$XFS_IO_PROG -T -m 0666 \
> +	-c "pwrite 0 4096" \
> +	-c "pread 0 4096" \
> +	-c "flink ${testfile}" \
> +	${TEST_DIR} | _filter_xfs_io
> +stat -c '%a' ${testfile}
>  rm ${testfile}
>  
>  # test creating a r/o tmpfile.  Should fail
> diff --git a/tests/generic/004.out b/tests/generic/004.out
> index 527b2c2..11f44e7 100644
> --- a/tests/generic/004.out
> +++ b/tests/generic/004.out
> @@ -1,6 +1,14 @@
>  QA output created by 004
> +umask 022
>  wrote 4096/4096 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  read 4096/4096 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +644
> +umask 027
> +wrote 4096/4096 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +read 4096/4096 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +640
>  TEST_DIR: Invalid argument
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-20 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-19 10:51 [PATCH] generic/004: Check resulting file permissions Andreas Gruenbacher
2016-10-20 16:56 ` Eryu Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox