qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [RFC for 3.1? or 4 v2 1/1] qemu-iotests: Don't run the test when user is root
       [not found] ` <cb554c04ee50ac970fa10edaa090982bef18f673.1543593569.git.alifm@linux.ibm.com>
@ 2018-11-30 17:50   ` Eric Blake
  2018-11-30 19:45     ` Farhan Ali
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Blake @ 2018-11-30 17:50 UTC (permalink / raw)
  To: Farhan Ali, qemu-block; +Cc: kwolf, Qemu-devel@nongnu.org, Peter Maydell

Adding qemu-devel - all patches should go there, especially if you want 
to get Peter's attention that this might be a 3.1 candidate if we have 
other reasons to spin -rc4.

On 11/30/18 10:04 AM, 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 | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
> index 0708b8b..05d5f2f 100755
> --- a/tests/qemu-iotests/232
> +++ b/tests/qemu-iotests/232
> @@ -41,6 +41,14 @@ _supported_fmt generic
>   _supported_proto file
>   _supported_os Linux
>   
> +tmp='file'
> +touch $tmp
> +chmod a-w $tmp
> +if [ -w $tmp ]
> +then
> +    _notrun "Cannot run this test as root user"
> +fi
> +

I know you just copied from my suggestion, but now looking at it, this 
leaves 'tmp' around in the directory for both success and skip. Better 
might be to just check whether $TEST_IMG is writable, immediately after 
the existing 'chmod a-w $TEST_IMG' line (Hmm - that line is already 
broken for not quoting "$TEST_IMG" in case it contains whitespace).

I don't see this being a reason for -rc4 on its own (most people don't 
run iotests as root); and the fact that we're still working on the final 
contents of what the patch should contain, as well as the fact that the 
patch doesn't affect the main binaries, means that if it were up to me, 
I'd defer it to 4.0. Kevin may have a different opinion, though, since 
it is his test, and new to 3.1.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [RFC for 3.1? or 4 v2 1/1] qemu-iotests: Don't run the test when user is root
  2018-11-30 17:50   ` [Qemu-devel] [RFC for 3.1? or 4 v2 1/1] qemu-iotests: Don't run the test when user is root Eric Blake
@ 2018-11-30 19:45     ` Farhan Ali
  0 siblings, 0 replies; 2+ messages in thread
From: Farhan Ali @ 2018-11-30 19:45 UTC (permalink / raw)
  To: Eric Blake, qemu-block; +Cc: kwolf, Qemu-devel@nongnu.org, Peter Maydell



On 11/30/2018 12:50 PM, Eric Blake wrote:
> Adding qemu-devel - all patches should go there, especially if you want 
> to get Peter's attention that this might be a 3.1 candidate if we have 
> other reasons to spin -rc4.
> 
> On 11/30/18 10:04 AM, 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 | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
>> index 0708b8b..05d5f2f 100755
>> --- a/tests/qemu-iotests/232
>> +++ b/tests/qemu-iotests/232
>> @@ -41,6 +41,14 @@ _supported_fmt generic
>>   _supported_proto file
>>   _supported_os Linux
>> +tmp='file'
>> +touch $tmp
>> +chmod a-w $tmp
>> +if [ -w $tmp ]
>> +then
>> +    _notrun "Cannot run this test as root user"
>> +fi
>> +
> 
> I know you just copied from my suggestion, but now looking at it, this 
> leaves 'tmp' around in the directory for both success and skip. Better 
> might be to just check whether $TEST_IMG is writable, immediately after 
> the existing 'chmod a-w $TEST_IMG' line (Hmm - that line is already 
> broken for not quoting "$TEST_IMG" in case it contains whitespace).

Ah yes, I forgot about the fact the 'file' will linger around. I will 
spin up a v3.

> 
> I don't see this being a reason for -rc4 on its own (most people don't 
> run iotests as root); and the fact that we're still working on the final 
> contents of what the patch should contain, as well as the fact that the 
> patch doesn't affect the main binaries, means that if it were up to me, 
> I'd defer it to 4.0. Kevin may have a different opinion, though, since 
> it is his test, and new to 3.1.
> 

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

end of thread, other threads:[~2018-11-30 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1543593569.git.alifm@linux.ibm.com>
     [not found] ` <cb554c04ee50ac970fa10edaa090982bef18f673.1543593569.git.alifm@linux.ibm.com>
2018-11-30 17:50   ` [Qemu-devel] [RFC for 3.1? or 4 v2 1/1] qemu-iotests: Don't run the test when user is root Eric Blake
2018-11-30 19:45     ` Farhan Ali

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).