<div dir="ltr">wow, i was convinced i didn't write that and it must have been something you did, but `git blame` disagrees.<div><br></div><div>hmm... it looks like what happened was that i was trying to preserve the old use of hd(1)? see the minus lines at the top of this diff:</div><div><br></div><div>-export BLOCKS=3<br>-SUM='head -c $(($BLOCKS*512)) | sha1sum | sed "s/ .*//"'<br>-[ -n "$TARHD" ] && SUM="tee >(hd >&2) | $SUM"<br>+<br>+# Also amount of trailing NUL padding varies (1024 bytes is minimum,<br>+# gnu/dammit does more) so look at first N 512-byte frames when<br>+# analyzing header content.<br>+function SUM()<br>+{<br>+ if [ -n "$TARHD" ]; then<br>+ # (Android's shell doesn't support process substitution.)<br>+ mkfifo xxd-pipe<br>+ xxd <xxd-pipe & pid=$!<br>+ tee xxd-pipe | head -c $(($1*512)) | sha1sum | sed "s/ .*//"<br>+ rm xxd-pipe<br>+ wait $pid<br>+ else<br>+ head -c $(($1*512)) | sha1sum | sed "s/ .*//"<br>+ fi<br>+}<br></div><div><br></div><div>but, yeah, afaict this is just an overly-literal translation of the old test into something that still works on Android. i think a temporary file in a snapshot would be fine. (in fact preferable, because my checkin comment complains that i wish i'd known about TARHD while trying to debug the tar tests. with a temporary file and stop on error, i wouldn't have needed to learn anything.)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 16, 2021 at 11:37 PM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I hit a transient tar bug (<a href="https://landley.net/notes-2021.html#06-08-2021" rel="noreferrer" target="_blank">https://landley.net/notes-2021.html#06-08-2021</a>) I<br>
couldn't reproduce so I'm trying to redo the SUM plumbing in tar to save a<br>
snapshot of the raw data and it seems like the OBVIOUS thing to do would be:<br>
<br>
function SUM()<br>
{<br>
tee save.dat | head -c $(($1*512)) | sha1sum | sed "s/ .*//"<br>
}<br>
<br>
But right NOW it looks like:<br>
<br>
function SUM()<br>
{<br>
if [ -n "$TARHD" ]; then<br>
# (Android's shell doesn't support process substitution.)<br>
mkfifo xxd-pipe<br>
xxd <xxd-pipe & pid=$!<br>
tee xxd-pipe | head -c $(($1*512)) | sha1sum | sed "s/ .*//"<br>
rm xxd-pipe<br>
wait $pid<br>
else<br>
head -c $(($1*512)) | sha1sum | sed "s/ .*//"<br>
fi<br>
}<br>
<br>
And... is this actually used, or can it go if I save a snapshot of the data for<br>
later analysis in the "stop when you hit an error" mode which is now the default?<br>
<br>
Rob<br>
</blockquote></div>