qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: filter QEMU monitor \r\n
Date: Fri, 15 Nov 2013 09:35:24 +0100	[thread overview]
Message-ID: <20131115083524.GD12545@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <5284E4F8.9040301@redhat.com>

On Thu, Nov 14, 2013 at 07:58:00AM -0700, Eric Blake wrote:
> On 11/14/2013 07:34 AM, Stefan Hajnoczi wrote:
> > SMTP does not preserve newlines.  This is normally not a problem if the
> > email body uses DOS or UNIX newlines consistently.  In 051.out we mix
> > UNIX newlines with DOS newlines (since QEMU monitor output uses \r\n).
> > 
> > This patch filters the QEMU monitor output so the golden master file
> > uses UNIX newlines exclusively.
> > 
> > The result is that patches touching 051.out will apply cleanly without
> > mangling newlines after this commit.
> 
> The idea makes sense.  However...
> 
> > 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> > If you have trouble applying this patch, you can use by git repo:
> >   git://github.com/stefanha/qemu.git fix-qemu-io-cr
> > 
> 
> > +++ b/tests/qemu-iotests/common.filter
> > @@ -156,7 +156,8 @@ _filter_qemu_io()
> >  _filter_qemu()
> >  {
> >      sed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
> > -        -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#'
> > +        -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
> > +        -e 's#\r##' # QEMU monitor uses \r\n line endings
> 
> \r is not portable sed (some implementations match a literal \ followed
> by a literal r; some treat it as a syntax error; while you want it to be
> treated as an escape sequence for CR).  Then again, \+ is not portable
> sed either, so we already fail to run on non-GNU sed.
> 
> Both problems could be avoided: write '[0-9][0-9]*' instead of
> '[0-9]\+'; and exploit the fact that common.filter already requires bash
> by writing "-e $'s#\r##'" (using $'' to do the \r interpolation prior to
> handing the argument to sed).

Thanks Eric.  I'd rather not fix up existing code in the same commit but
we can switch to the portable bash version.  In general, qemu-iotests
only supports Linux today.

Kevin (or note to self): use "-e $'s#\r##'" when merging.

Stefan

  reply	other threads:[~2013-11-15  8:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 14:34 [Qemu-devel] [PATCH] qemu-iotests: filter QEMU monitor \r\n Stefan Hajnoczi
2013-11-14 14:58 ` Eric Blake
2013-11-15  8:35   ` Stefan Hajnoczi [this message]
2013-11-15  2:29 ` Luiz Capitulino
2013-12-05 16:01 ` Stefan Hajnoczi

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=20131115083524.GD12545@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 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).