tar or cpio?
Syd Weinstein
syd at dsinc.UUCP
Thu Feb 18 10:42:01 AEST 1988
In article <699 at mcdsun.UUCP> fnf at mcdsun.UUCP (Fred Fish) writes:
:In article <2071 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
:>An even more correct thing to do is for cpio to always write archive headers
:>in a canonical format that is not dependent on the byte-ordering of the
:>hardware. E.g., all header data written least significant byte first.
:>
[ stuff deleted for brevity ]
:
:Unfortunately this will not work for one not-so-obvious reason, and that
:is because there are systems that when reading the exact same media,
:will return bytes ordered differently.
[again deleted]
:Several years ago after I got my first Unix system, I was so disgusted
:with tar and cpio that I wrote my own backup/archiver type program (bru)
:which has always handled this problem completely transparently to the
:user by writing ASCII formatted archives and doing whatever byte swapping
:was necessary. The basic algorithm is:
:
: 1. Examine block's magic number, if correct, no swapping.
: 2. Swap all bytes and try again. If correct, note byte swap
: needed for all blocks.
: 3. Swap all shorts and try again. If correct, note short swap
: also needed for all blocks.
: 4. Swap all bytes and try again. If correct, reset byte swapping
: flag (swap shorts only).
:
:I have never encountered a machine where one of these four combinations of
:byte/short swapping didn't result in a readable archive, but I've seen
:each combination needed at least once for at least one machine.
I had to write a backup system also a while back, and I can add another
step to your algorithm that will force it to 8 steps. There are some
machines out there that invert the bits on tapes. IE, you need to
NOT(~) it to make it work. Adding this makes one repeat all four steps
again for bit inverted tapes. Boy was that a pain to figure out.
--
=====================================================================
Sydney S. Weinstein, CDP, CCP
Datacomp Systems, Inc. Voice: (215) 947-9900
{allegra,bellcore,bpa,vu-vlsi}!dsinc!syd FAX: (215) 938-0235
More information about the Comp.unix.questions
mailing list