[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu-iotests: filter QEMU monitor \r\n
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] qemu-iotests: filter QEMU monitor \r\n |
Date: |
Thu, 14 Nov 2013 07:58:00 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
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 <address@hidden>
> ---
> 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).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature