changeset 1339:a3844a8132bc

Isaac Dunham also reported that some diff implementations can't handle nonseekable input, so write to a temporary file instead of <(command). Use trap EXIT to make sure the temporary files get deleted.
author Rob Landley <rob@landley.net>
date Sun, 08 Jun 2014 14:01:37 -0500
parents e084440e6995
children 7d94ba177fe6
files scripts/bloatcheck
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/bloatcheck	Sun Jun 08 13:49:57 2014 -0500
+++ b/scripts/bloatcheck	Sun Jun 08 14:01:37 2014 -0500
@@ -58,6 +58,10 @@
   printf "% 71d total\n" "$TOTAL"
 }
 
-diff -U 0 <(nm --size-sort "$1" | sort -k3,3) \
-     <(nm --size-sort "$2" | sort -k3,3) \
-     | tail -n +3 | sed -n 's/^\([-+]\)/\1 /p' | sort -k4,4 | do_bloatcheck
+DIFF1=`mktemp base.XXXXXXX`
+DIFF2=`mktemp bloat.XXXXXXX`
+trap "rm $DIFF1 $DIFF2" EXIT
+nm --size-sort "$1" | sort -k3,3 > $DIFF1
+nm --size-sort "$2" | sort -k3,3 > $DIFF2
+diff -U 0 $DIFF1 $DIFF2 | tail -n +3 | sed -n 's/^\([-+]\)/\1 /p' \
+  | sort -k4,4 | do_bloatcheck