qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] iotests/common.pattern: Quote echos
Date: Fri, 3 Apr 2020 08:39:19 -0500	[thread overview]
Message-ID: <4ebf9849-ad4a-3eb7-e265-1d8f933324ea@redhat.com> (raw)
In-Reply-To: <20200403101134.805871-1-mreitz@redhat.com>

On 4/3/20 5:11 AM, Max Reitz wrote:
>>From time to time, my shell decides to repace the bracketed numbers here
> by the numbers inside (i.e., "=== Clusters to be compressed [1]" is
> printed as "=== Clusters to be compressed 1").  That makes tests that

Namely, any time your environment has a file named '1' in the directory 
where you are running iotests.

> use common.pattern fail.  Prevent that from happening by quoting the
> arguments to all echos in common.pattern.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/common.pattern | 22 +++++++++++-----------
>   1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
> index 4f5e5bcea0..4caa5de187 100644
> --- a/tests/qemu-iotests/common.pattern
> +++ b/tests/qemu-iotests/common.pattern
> @@ -23,7 +23,7 @@ do_is_allocated() {
>       local count=$4
>   
>       for ((i=1;i<=$count;i++)); do
> -        echo alloc $(( start + (i - 1) * step )) $size
> +        echo "alloc $(( start + (i - 1) * step )) $size"

No real change on this line because $size is safe, but also no harm at 
being consistent, and makes it easier to not have to audit $size for 
being safe.

>       # Write the clusters to be compressed
> -    echo === Clusters to be compressed [1]
> +    echo '=== Clusters to be compressed [1]'

This one is definitely needed to avoid inadvertent globbing.

>       # Read them
> -    echo === Read used/compressed clusters
> +    echo '=== Read used/compressed clusters'

And this one does not buy any safety, but again consistency doesn't hurt.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  parent reply	other threads:[~2020-04-03 13:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 10:11 [PATCH] iotests/common.pattern: Quote echos Max Reitz
2020-04-03 10:20 ` Philippe Mathieu-Daudé
2020-04-03 13:39 ` Eric Blake [this message]
2020-04-07  8:59 ` Max Reitz

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=4ebf9849-ad4a-3eb7-e265-1d8f933324ea@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).