diff mbox series

[RFC,for,3.1?,or,4,v3,1/1] qemu-iotests: Don't run the test when user is root

Message ID 3130ecca88d5f7d97860c05cf1346164938cb15d.1543610035.git.alifm@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series [RFC,for,3.1?,or,4,v3,1/1] qemu-iotests: Don't run the test when user is root | expand

Commit Message

Farhan Ali Nov. 30, 2018, 8:37 p.m. UTC
Test 232 creates image files with read-only permission and
expects an error message when trying to access the image
files with read-only and auto-read-only turned off.

Don't run as root user, since root can open files with read/write
access for read-only files.

Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
---
 tests/qemu-iotests/232 | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Eric Blake Nov. 30, 2018, 8:52 p.m. UTC | #1
On 11/30/18 2:37 PM, Farhan Ali wrote:
> Test 232 creates image files with read-only permission and
> expects an error message when trying to access the image
> files with read-only and auto-read-only turned off.
> 
> Don't run as root user, since root can open files with read/write
> access for read-only files.
> 
> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
> ---
>   tests/qemu-iotests/232 | 5 +++++
>   1 file changed, 5 insertions(+)

Did you mean to keep RFC in the subject line?  Will patchew even spot it 
without PATCH in the subject line?

Reviewed-by: Eric Blake <eblake@redhat.com>
Farhan Ali Nov. 30, 2018, 9:51 p.m. UTC | #2
On 11/30/2018 03:52 PM, Eric Blake wrote:
> On 11/30/18 2:37 PM, Farhan Ali wrote:
>> Test 232 creates image files with read-only permission and
>> expects an error message when trying to access the image
>> files with read-only and auto-read-only turned off.
>>
>> Don't run as root user, since root can open files with read/write
>> access for read-only files.
>>
>> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
>> ---
>>   tests/qemu-iotests/232 | 5 +++++
>>   1 file changed, 5 insertions(+)
> 
> Did you mean to keep RFC in the subject line?  Will patchew even spot it 
> without PATCH in the subject line?
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
Thanks for reviewing the patch. I am not sure if patchew will pick it 
up; I have no problem in spinning another patch but I will wait till 
Monday to see if anyone else has any feedback.

Thanks
Farhan
diff mbox series

Patch

diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
index 0708b8b..1d34242 100755
--- a/tests/qemu-iotests/232
+++ b/tests/qemu-iotests/232
@@ -92,6 +92,11 @@  echo
 
 chmod a-w $TEST_IMG
 
+if [ -w $TEST_IMG ]
+then
+    _notrun "Cannot run this test as root user"
+fi
+
 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off
 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on
 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on