qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, Jeff Cody <jcody@redhat.com>,
	jsnow@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 1/2] qemu-iotests: fix cleanup of background processes
Date: Mon, 2 Nov 2015 09:32:18 -0700	[thread overview]
Message-ID: <56379012.30806@redhat.com> (raw)
In-Reply-To: <5637893E.6030200@redhat.com>

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

On 11/02/2015 09:03 AM, Max Reitz wrote:

>>>> +++ b/tests/qemu-iotests/058
>>>> @@ -32,11 +32,17 @@ status=1	# failure is the default!
>>>>  
>>>>  nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
>>>>  nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
>>>> +rm -f "${TEST_DIR}/qemu-nbd.pid"
>>>>  
>>>>  _cleanup_nbd()
>>>>  {
>>>> -    if [ -n "$NBD_SNAPSHOT_PID" ]; then
>>>> -        kill "$NBD_SNAPSHOT_PID"
>>>> +    local NBD_SNAPSHOT_PID
>>>> +    if [ -f "${TEST_DIR}/qemu-nbd.pid" ]; then
>>>> +        read NBD_SNAPSHOT_PID < "${TEST_DIR}/qemu-nbd.pid"
>>>> +        rm -f "${TEST_DIR}/qemu-nbd.pid"
>>>> +        if [ -n "$NBD_SNAPSHOT_PID" ]; then
>>>
>>> No, I won't complain about using ! -z "" elsewhere and -n "" here. :-)
>>
>> The little pedant in me screams "but I will!", and the little prankster
>> next to him is clapping enthusiastically.
>>
>> Kidding aside: not worth a respin, but could be cleaned up on commit
>> (maintainer's discretion).
> 
> Oh, if that's the case, then I have another thing for you: The use of ==
> in patch 2! ;-)
> 
> (I'm a bit disappointed Eric doesn't have a mail filter for
> #!/bin/(ba)?sh ... if.*== for his mail client.)

I already know that most (if not all) of qemu-iotests is specifically
/bin/bash.  But if we want to, we can ditch -n and -z, and just use:

if [[ $NBD_SNAPSHOT_PID ]]; then

and similarly.  In fact, I actually prefer embracing bash-isms when we
know we are using bash, to make it obvious that we know we are not
catering to /bin/sh.

-- 
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: 604 bytes --]

  reply	other threads:[~2015-11-02 16:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 19:25 [Qemu-devel] [PATCH v3 0/2] qemu-iotests: fix cleanup of background processes Jeff Cody
2015-10-30 19:25 ` [Qemu-devel] [PATCH v3 1/2] " Jeff Cody
2015-10-30 21:13   ` Max Reitz
2015-11-02  7:37     ` Markus Armbruster
2015-11-02 16:03       ` Max Reitz
2015-11-02 16:32         ` Eric Blake [this message]
2015-10-30 19:25 ` [Qemu-devel] [PATCH v3 2/2] qemu-iotests: fix -valgrind option for check Jeff Cody
2015-10-30 21:14   ` Max Reitz
2015-11-02 20:31 ` [Qemu-devel] [PATCH v3 0/2] qemu-iotests: fix cleanup of background processes Max Reitz
2015-11-02 20:35   ` 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=56379012.30806@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@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).