Re:
BTW, the only
way you can be *SURE* you got all the data on
the tape is if *EVERY* read-request returned fewer characters
than you asked for. E.g., if you did:
bytesread = read(fromfd, buffer, BUFSIZE);
and you get BUFSIZE bytes in, then there's a chance that that
tape record had BUFSIZE + 100 bytes ... and you've just lost
those last 100 bytes.
I *just* recently discovered this, and will incorporate that
into a utility I'll be hosting on the Prime.
It actually was an element of a trial in Canada that I was
testifying (as an expert witness) at, about 8+ years ago.
Someone had copied a tape whose records were 16 KB long using software
that expected the records to be 8192 bytes longs ... and only asked
for 8192 bytes in each read() request.
Thus, since they didn't ask for 8194 (or more) and notice the extra data,
and they blithely (and incorrectly) assumed that they had copied the
entire tape. Later, they incorrectly/inappropriately used a utility
to try to restore files from the copy, resulting in random pre-existing
disk garbage being left in the second 8K bytes of every 16 KB chunk
of disk file they fetched off the tape copy.
(Why not ask for only 1 byte more? Some systems can't handle an odd
number of bytes in a tape record, and might round up/down in a manner that
you don't expect.)
(P.s.: my guy won)Stan Sieler
sieler(a)allegro.com
www.allegro.com/sieler/wanted/index.html www.allegro.com/sieler