[Toybox] What does the xxd-pipe stuff in tests.tar do?

Rob Landley rob at landley.net
Mon Aug 16 23:56:12 PDT 2021


I hit a transient tar bug (https://landley.net/notes-2021.html#06-08-2021) I
couldn't reproduce so I'm trying to redo the SUM plumbing in tar to save a
snapshot of the raw data and it seems like the OBVIOUS thing to do would be:

function SUM()
{
  tee save.dat | head -c $(($1*512)) | sha1sum | sed "s/ .*//"
}

But right NOW it looks like:

function SUM()
{
  if [ -n "$TARHD" ]; then
    # (Android's shell doesn't support process substitution.)
    mkfifo xxd-pipe
    xxd <xxd-pipe & pid=$!
    tee xxd-pipe | head -c $(($1*512)) | sha1sum | sed "s/ .*//"
    rm xxd-pipe
    wait $pid
  else
    head -c $(($1*512)) | sha1sum | sed "s/ .*//"
  fi
}

And... is this actually used, or can it go if I save a snapshot of the data for
later analysis in the "stop when you hit an error" mode which is now the default?

Rob


More information about the Toybox mailing list