]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use file descriptor 3 to save file.prev
authorMark Andrews <marka@isc.org>
Wed, 5 Oct 2022 06:12:16 +0000 (17:12 +1100)
committerMark Andrews <marka@isc.org>
Tue, 8 Nov 2022 16:44:05 +0000 (16:44 +0000)
If 'set -x' is in effect file.prev gets populated with debugging output.
To prevent this open descriptor 3 and redirect stderr from the awk
command to descriptor 3. Debugging output will stay directed to stderr.

(cherry picked from commit 10f67938dbbafc87be3df86e5a1db35573d12a8b)

bin/tests/system/conf.sh.common

index 8860ab2fee1ed2adcdd9ddb6bf244f0560ee6f5a..d82df54d3e3be54eb15424d922efa7e3f21dcc89 100644 (file)
@@ -479,25 +479,25 @@ nextpartreset() {
 
 # nextpartread: read everything that's been appended to a file since the
 # last time nextpart() was called and print it to stdout, print the
-# total number of lines read from that file so far to stderr
+# total number of lines read from that file so far to file descriptor 3
 nextpartread() {
     [ -f $1.prev ] || nextpartreset $1
     prev=`cat $1.prev`
     awk "NR > $prev "'{ print }
-        END          { print NR > "/dev/stderr" }' $1
+        END          { print NR > "/dev/stderr" }' $1 2>&3
 }
 
 # nextpart: read everything that's been appended to a file since the
 # last time nextpart() was called
 nextpart() {
-       nextpartread $1 2> $1.prev.tmp
+       nextpartread $1 3> $1.prev.tmp
        mv $1.prev.tmp $1.prev
 }
 
 # nextpartpeek: read everything that's been appended to a file since the
 # last time nextpart() was called
 nextpartpeek() {
-       nextpartread $1 2> /dev/null
+       nextpartread $1 3> /dev/null
 }
 
 # _search_log: look for message $1 in file $2 with nextpart().