]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
tests: diff.sh: preserve file name
authorFlorian Westphal <fw@strlen.de>
Thu, 9 Jul 2026 20:03:54 +0000 (22:03 +0200)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Mon, 13 Jul 2026 13:23:24 +0000 (15:23 +0200)
As-is, in case of error, its not easy to see which diff file has
failed, because diff gets fed via <(sed...), so diff shows
something like

Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
tests/diff.sh

index a364a28b1ddaf2b41f37007427c5df2f4c20a120..76b1938149ebe99a6d889784dfa947fe77bd67fd 100755 (executable)
@@ -1,7 +1,14 @@
 #!/bin/bash
 
-diff -u -I 'Revision: .*' -I 'Size in memory.*' \
-    <(sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' $1) \
-    <(sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' $2)
+NEW_DUMP="$IPSET_TMP/kernel-dump.sed"
+STORED_DUMP="$IPSET_TMP/$2.sed"
 
+sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' "$1" > "$NEW_DUMP"
+sed -e 's/timeout [0-9]*/timeout x/' -e 's/initval 0x[0-9a-fA-F]\{8\}/initval 0x00000000/' "$2" > "$STORED_DUMP"
 
+diff -u -I 'Revision: .*' -I 'Size in memory.*' "$STORED_DUMP" "$NEW_DUMP"
+ret=$?
+
+rm -f "$STORED_DUMP" "$NEW_DUMP"
+
+exit $ret