Skip to contentSkip to conversation

ia64: fix word quoting in shell scripts

PATCH New zsugabubus 1 participant 1 message Apr 22, 2020

lore
Share & tools
lore

zsugabubus

author
#0 lore raw

PATCH 1/1 ia64: fix word quoting in shell scripts

Previous implementation did not quote some variables that could be potentially empty, for example due to a failed compilation. It made test(1) failing but desired error action was not taken.

Cleaning of temporary files is also been made a bit more robust.

---
 arch/ia64/scripts/check-gas       | 25 ++++++++--------
 arch/ia64/scripts/toolchain-flags | 50 ++++++++++++++-----------------
 2 files changed, 36 insertions(+), 39 deletions(-)
arch/ia64/scripts/check-gas +13 -12
index 787cf9b6b..7210522e6 100755
@@ -1,16 +1,17 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
-dir=$(dirname $0)
 CC=$1
 OBJDUMP=$2
-tmp=${TMPDIR:-/tmp}
-out=$tmp/out$$.o
-$CC -c $dir/check-gas-asm.S -o $out
-res=$($OBJDUMP -r --section .data $out | fgrep 00004 | tr -s ' ' |cut -f3 -d' ')
-rm -f $out
-if [ $res != ".text" ]; then
-	echo buggy
-else
-	echo good
-fi
-exit 0
+
+cd "$(dirname $0)"
+
+tmp=${TMPDIR:-/tmp}/check-gas-$$.o
+trap 'rm -f "$tmp"' INT TERM EXIT
+
+$CC -c check-gas-asm.S -o "$tmp" &&
+$OBJDUMP -r --section .data "$tmp" \
+| fgrep 00004 | tr -s ' ' | cut -f3 -d' ' \
+| {
+  read -r section
+  [ "$section" = .text ] && echo good
+} || echo buggy
arch/ia64/scripts/toolchain-flags +23 -27

71 lines not on this page · raw message

Signature · 1 line
2.26.1