qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting (use $() instead of ``)
Date: Wed, 17 Oct 2018 22:28:41 -0500	[thread overview]
Message-ID: <c46fe8e5-e31d-478b-d2fa-e51740f1aa32@redhat.com> (raw)
In-Reply-To: <20181018031723.23459-2-maozhongyi@cmss.chinamobile.com>

On 10/17/18 10:17 PM, Mao Zhongyi wrote:
> Various shell files contain a mix between obsolete ``
> and modern $(); It would be nice to convert to using $()
> everywhere.
> 
> `pwd` and `basename $0` are in 231 files under directory
> tests/qemu-iotests, so replaced it with the following:
> 
> sed -i 's/`pwd`/$(pwd)/g' $(git grep -l "\`pwd\`")

No. Instead, I'd rather a separate patch that does:

s/`pwd`/$PWD/
s/\$(pwd)/$PWD/

since POSIX requires $PWD to be sane, and thus save us a wasted forked 
process.

> sed -i 's/`basename $0`/$(basename $0)/g' $(git grep -l "basename \$0")
> 
> A small amount of the rest is manually modified.
> 
> Cc: kwolf@redhat.com
> Cc: mreitz@redhat.com
> Cc: qemu-block@nongnu.org
> 
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---

> +++ b/tests/qemu-iotests/001
> @@ -21,10 +21,10 @@
>   # creator
>   owner=hch@lst.de
>   
> -seq=`basename $0`
> +seq=$(basename $0)
>   echo "QA output created by $seq"
>   
> -here=`pwd`
> +here=$(pwd)
>   status=1	# failure is the default!

At one point, someone (Jeff?) proposed a cleanup patch that got rid of a 
lot of cruft in iotests, including the fact that scripts that don't use 
$seq don't need to assign seq=$(basename $0).  We should probably revive 
that rather than just making pointless churn on stuff that is garbage 
anyways.  But I don't have time to look up a URL to that older series at 
the moment.

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

  reply	other threads:[~2018-10-18  3:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18  3:17 [Qemu-devel] [PATCH v2 0/3] Modern shell scripting (use $() instead of ``) Mao Zhongyi
2018-10-18  3:17 ` [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting " Mao Zhongyi
2018-10-18  3:28   ` Eric Blake [this message]
2018-10-18  7:14     ` [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting(use " maozy
2018-10-18 12:46       ` Eric Blake
2018-10-18  3:17 ` [Qemu-devel] [PATCH v2 2/3] debian-bootstrap.pre: Modern shell scripting (use " Mao Zhongyi
2018-10-18  3:17 ` [Qemu-devel] [PATCH v2 3/3] po/Makefile: " Mao Zhongyi

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=c46fe8e5-e31d-478b-d2fa-e51740f1aa32@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=maozhongyi@cmss.chinamobile.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).