qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 2/3] iotests: _filter_qmp for pretty JSON out


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v4 2/3] iotests: _filter_qmp for pretty JSON output
Date: Mon, 17 Nov 2014 10:06:57 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/17/2014 09:14 AM, Max Reitz wrote:

>>> +        -e '/^    "QMP": {\s*$/, /^    }\s*$/ c\' \
>> \s is a GNU sed extension.  But we don't really need to care about
>> whitespace to the end of the line; I think that it is sufficient to just
>> match the following regex:
>>
>> -e '/^    "QMP": {/, /^    }/ c\' \
> 
> That doesn't match, however. QEMU's JSON formatter sometimes outputs
> whitespace at the end of line.

No, I explicitly omitted the $.  The lines match because they are
anchored to the beginning, regardless of trailing whitespace at the end.

> 
>>> +        -e '    QMP_VERSION'
>> Either way, it's not the first time we've used a GNU sed extension, and
>> since other series are now depending on this one, I can live with:
> 
> Ooooh, you mean version 3 was actually fine? (which used 'c\' without a
> line break) ;-)

I'm more comfortable with v4 than v3 (\s is well-known, and can be
easily converted into an alternative if someone proves their system
doesn't support it.  But c\ is not well-known; and reading 'info sed' to
learn about c\ only documents its use with a newline; so using c\
without a newline is relying on undocumented GNU behavior, which is very
risky).  Of course, a v5 that avoids \s would avoid any confusion, but
now we're bikeshedding, and I'm not sure it's worth the time.

-- 
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]