All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 2/3] iotests: _filter_qmp for pretty JSON output
Date: Mon, 17 Nov 2014 10:06:57 -0700	[thread overview]
Message-ID: <546A2B31.4010208@redhat.com> (raw)
In-Reply-To: <546A1ED4.8080307@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

  reply	other threads:[~2014-11-17 17:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17 12:31 [Qemu-devel] [PATCH v4 0/3] chardev: Add -qmp-pretty Max Reitz
2014-11-17 12:31 ` [Qemu-devel] [PATCH v4 1/3] " Max Reitz
2014-11-17 12:31 ` [Qemu-devel] [PATCH v4 2/3] iotests: _filter_qmp for pretty JSON output Max Reitz
2014-11-17 16:04   ` Eric Blake
2014-11-17 16:14     ` Max Reitz
2014-11-17 17:06       ` Eric Blake [this message]
2014-11-17 12:31 ` [Qemu-devel] [PATCH v4 3/3] iotests: Use -qmp-pretty in 067 Max Reitz
2014-11-20 18:39   ` Kevin Wolf
2014-11-20 18:56     ` Max Reitz
2014-11-20 19:43       ` Eric Blake
2014-11-20 17:02 ` [Qemu-devel] [PATCH v4 0/3] chardev: Add -qmp-pretty Kevin Wolf
2014-11-28 15:55 ` Markus Armbruster
2014-11-28 17:21   ` Paolo Bonzini
2014-12-02  9:24   ` Max Reitz
2014-12-02 18:17     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546A2B31.4010208@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.