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: kw...@redhat.com
Cc: mre...@redhat.com
Cc: qemu-bl...@nongnu.org
Signed-off-by: Mao Zhongyi <maozhon...@cmss.chinamobile.com>
---
+++ b/tests/qemu-iotests/001
@@ -21,10 +21,10 @@
# creator
owner=h...@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.
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