Subject: Re: afio 2.4.7 cannot read its own archives
To: Charles Shannon Hendrix <shannon@widomaker.com>
From: Koen Holtman <koen@hep.caltech.edu>
List: netbsd-users
Date: 01/26/2004 12:37:08
On Fri, 23 Jan 2004, Charles Shannon Hendrix wrote:


Hi Charles,

See below for comments.

> 
> 
> I have a problem with afio on NetBSD 1.6 (sparc).
> 
> It cannot read its own archives:
> 
> 
> escape:/home/shannon                                                            [62] % find test | afio -ov test.afio
> test -- okay
> test/a -- okay
> test/a.orig -- okay
> test/b -- okay
> test/b.orig -- okay
> test/c -- okay
> test/c.orig -- okay
> test/d -- okay
> test/d.orig -- okay
> test/d~ -- okay
>                                                                                 escape:/home/shannon                                                            [63] % afio -t test.afio
> test
> test/a
> afio: "test.afio" [offset 164]: Bad magic number
> afio: "test/a": May be corrupt
> afio: "test.afio" [offset 253]: Apparently resynchronized
> afio: "test/a.orig": Continuing
> test/a.orig
> test/b
> afio: "test.afio" [offset 342]: Bad magic number
> afio: "test/b": May be corrupt
> afio: "test.afio" [offset 431]: Apparently resynchronized
> 
> When I look at these archives, they seem to be fine, except for the
> string of numbers before each filename.  They differ from the same
> archive created with afio on a Linux machine.
> 
> For example:
> 
> test-netbsd.afio:
> 
> 0707070040110002400407550017500001440000010000001000427021000000500000000000test
> ^@0707070040110004601006440017500001440000010000001000427017500000700000000007te
> st/a^@file a
> 0707070040110005541006440017500001440000010000011000427017500001400000000000test
> /a.orig^@07070700401100061110064400175000014400000100000010004270177000007000000
> 00007test/b^@file b
> 
> 
> test-linux.afio:
> 
> 0707070034060145730407550017500000240000010000001000427021000000500000000000test
> ^@0707070034060147321006440017500000240000010000001000427017500000700000000000te
> st/a^@file a
> 0707070034060147331006440017500000240000010000011000427017500001400000000000test
> /a.orig^@07070700340601501210064400175000002400000100000010004270177000007000000
> 00000test/b^@file b
> 
> 
> I've read complaints about this problem, but no solutions.
> 
> afio for NetBSD can read other afio/cpio archives just fine, it just
> fails writing them.

Thanks for the detailed info on the problem.  It looks like this is a 
problem with the size of the size_t type on your OS, maybe coupled with an
endianness issue.  It is really a bug in the afio-2.4.7 source code that 
only manifests itself on some platforms.

The good news is: this is problem very probably solved in afio-2.5.  So my 
suggestion is to compile afio-2.5 and see if it works by running the 
regression tests which are supplied with the sources.

I'm not sure about netbsd, but I expect that the normal (linux) afio
sources will compile without any changes.

Please do let me know if you see the same problem with afio-2.5.

Hope this helps,

Cheers,

Koen.