From 5159597db5475bb3a68ba9f650d8a5f03e54c850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Tue, 30 Jul 2019 21:08:40 +0200 Subject: [PATCH] Fix awk invocation in the "verify" system test Appending output of a command to the same file as the one that command is reading from is a dangerous practice. It seems to have accidentally worked with all the awk implementations we have tested against so far, but for BusyBox awk, doing this may result in the input/output file being written to in an infinite loop. Prevent this from happening by redirect awk output to a temporary file and appending its contents to the original file in a separate shell pipeline. (cherry picked from commit bb9c1654e296d7f27b58303bf7640a26aadbcc43) --- bin/tests/system/verify/zones/genzones.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/tests/system/verify/zones/genzones.sh b/bin/tests/system/verify/zones/genzones.sh index 34d9ecbe3a..8d4f9b6b6c 100644 --- a/bin/tests/system/verify/zones/genzones.sh +++ b/bin/tests/system/verify/zones/genzones.sh @@ -237,5 +237,7 @@ $4 == "NSEC3" && NF == 9 { $1 = "H9P7U7TR2U91D0V0LJS9L1GIDNP90U3H." ZONE; $9 = "H9P7U7TR2U91D0V0LJS9L1GIDNP90U3I"; print; -}' ${file} >> ${file} +}' ${file} > ${file}.tmp +cat ${file}.tmp >> ${file} +rm -f ${file}.tmp $SIGNER -3 - -Px -Z nonsecify -O full -o ${zone} -f ${file} ${file} $zsk > s.out$n 2>&1 || dumpit s.out$n