problem with busybox tar
Denis Vlasenko
vda.linux at googlemail.com
Sat Mar 3 19:40:06 UTC 2007
On Saturday 03 March 2007 13:36, Rogelio Serrano wrote:
> On 3/3/07, Denis Vlasenko <vda.linux at googlemail.com> wrote:
> > On Saturday 03 March 2007 07:35, Rogelio Serrano wrote:
> > > i get an "invalid header checksum error" on some archives that are
> > > fine on gnu tar. both on glibc and uclibc
> >
> > I assume you mean "i get an invalid header checksum error
> > _on untarring_ some archives".
> >
> > > one example is git-1.5.0.tar.bz2
> >
> > URL where it can be downloaded?
> >
>
> http://kernel.org/pub/software/scm/git/git-1.5.0.tar.bz2
tar tf git-1.5.0.tar works ok up to this chunk:
0033e000 67 69 74 2d 31 2e 35 2e 30 2f 67 69 74 77 65 62 |git-1.5.0/gitweb|
0033e010 2f 74 65 73 74 2f 00 00 00 00 00 00 00 00 00 00 |/test/..........|
0033e020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e060 00 00 00 00 30 30 30 30 37 37 35 00 30 30 30 30 |....0000775.0000|
0033e070 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 |000.0000000.0000|
0033e080 30 30 30 30 30 30 30 00 31 30 35 36 34 34 37 34 |0000000.10564474|
0033e090 30 32 36 00 30 30 31 34 35 35 30 00 35 00 00 00 |026.0014550.5...|
0033e0a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e0b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e0c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e0d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e0e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e0f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e100 00 75 73 74 61 72 00 30 30 72 6f 6f 74 00 00 00 |.ustar.00root...|
0033e110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e120 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 |.........root...|
0033e130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e140 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000|
0033e150 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........|
0033e160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e1a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e1b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e1c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e1d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e1e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e1f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
It's ok, and so reported:
git-1.5.0/gitweb/test/
Then it fails in next block (a bit of debug output is included):
nam = 'git-1.5.0/gitweb/test/Mц╓rchen'
sum = 7463
xstr= 6951
str = '0015447'
tar: invalid tar header checksum
The block inself:
0033e200 67 69 74 2d 31 2e 35 2e 30 2f 67 69 74 77 65 62 |git-1.5.0/gitweb|
0033e210 2f 74 65 73 74 2f 4d c3 a4 72 63 68 65 6e 00 00 |/test/M..rchen..|
0033e220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e260 00 00 00 00 30 30 30 30 36 36 34 00 30 30 30 30 |....0000664.0000|
0033e270 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 |000.0000000.0000|
0033e280 30 30 30 30 30 32 31 00 31 30 35 36 34 34 37 34 |0000021.10564474|
0033e290 30 32 36 00 30 30 31 35 34 34 37 00 30 00 00 00 |026.0015447.0...|
0033e2a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e2b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e2c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e2d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e2e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e2f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e300 00 75 73 74 61 72 00 30 30 72 6f 6f 74 00 00 00 |.ustar.00root...|
0033e310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e320 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 |.........root...|
0033e330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e340 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000|
0033e350 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........|
0033e360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e3a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e3b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e3c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e3d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e3e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0033e3f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
GNU tar doesn't fail here:
...
git-1.5.0/gitweb/test/
git-1.5.0/gitweb/test/Mц╓rchen
git-1.5.0/gitweb/test/file with spaces
git-1.5.0/gitweb/test/file+plus+sign
git-1.5.0/grep.c
...
Hmm wait a second... GNU tar seems to use SIGNED bytes for checksumming!
The fix: archival/libunarchive/get_header_tar.c:
sum = ' ' * sizeof(tar.chksum);
for (i = 0; i < 148 ; i++) {
sum += ((signed char*)&tar)[i]; // <- 'signed' added
}
for (i = 156; i < 512 ; i++) {
sum += ((signed char*)&tar)[i]; // <- 'signed' added
}
Works for me, will fix in svn now.
--
vda
More information about the busybox
mailing list