qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 6/8] qemu-img: move common options parsing before


From: Eric Blake
Subject: Re: [Qemu-devel] [PULL 6/8] qemu-img: move common options parsing before commands processing
Date: Fri, 1 Jul 2016 10:39:49 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/29/2016 02:22 AM, Denis V. Lunev wrote:
> On 06/29/2016 12:27 AM, Stefan Hajnoczi wrote:
>> From: "Denis V. Lunev" <address@hidden>
>>
>> This is necessary to enable creation of common qemu-img options which
>> will
>> be specified before command.

>> +    cmdname = argv[optind];
>> +
>> +    /* reset getopt_long scanning */
>> +    argc -= optind;
>> +    if (argc < 1) {
>> +        return 0;
>> +    }
>> +    argv += optind;
>> +    optind = 1;
> this patch breaks check-block.sh
> we should have here
>   'optind = 0'

Uggh. You've landed in one of the portability traps of getopt().  On
glibc, you can reset option parsing by assigning optind to 1 (but it
also works by assigning it to 0); on BSD, you instead set the variable
'optreset'; on Solaris, there is no way to reset option parsing (but
then again, Solaris doesn't maintain any invisible state like glibc or
BSD where you need to go out of your way to do a full reset).

But regardless of how you look at it, the patch has now been committed
to master without your suggested fix, so you'll have to propose a formal
followup patch as a new thread.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]