qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting(use


From: maozy
Subject: Re: [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting(use $() instead of ``)
Date: Thu, 18 Oct 2018 15:14:44 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

Hi, Eric

On 10/18/18 11:28 AM, Eric Blake wrote:
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.

I got you, thank you very much.

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.



I think I might have found this patchset, but it was a long time ago.

https://lists.gnu.org/archive/html/qemu-devel/2017-10/msg04056.html

I will remove this patch from this series and resend a separate patch
to replace `pwd` and "$(pwd)" with $PWD. Am I right?

Thanks,
Mao






reply via email to

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