qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shells


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting (use $() instead of ``)
Date: Wed, 17 Oct 2018 22:28:41 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

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: address@hidden
Cc: address@hidden
Cc: address@hidden

Signed-off-by: Mao Zhongyi <address@hidden>
---

+++ b/tests/qemu-iotests/001
@@ -21,10 +21,10 @@
  # creator
  address@hidden
-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 via email to

[Prev in Thread] Current Thread [Next in Thread]