Hi,

While I was testing jca@'s diff to make the pax format the
default for tar(1), I ran into the following bug in the code
that reads extended headers. (To be clear: this has nothing to
do with the code that *writes* extended headers and/or jca@'s
diff.)

If the file name of the file in the archive is too long, pax and
tar will say:
pax: Extended header record length 513 is out of range

The problem appears if one extended header record exceeds 512 bytes.
Below is a test case. If the file name is 502 bytes long, the length
of the extended header record is 512 bytes and all is fine. If the
file name is 503 bytes, one byte longer, the extended header record
will be 513 bytes and the error message mentioned above appears.

If we want this to work, rd_xheader() probably needs to be fixed.

Caspar

--

#!/bin/sh

TESTDIR=length-test2
rm -rf $TESTDIR
mkdir -p $TESTDIR
cd $TESTDIR

# Using Perl to generate names of 200, 100 and 101 characters
DIR="$(perl -E 'say "x" x 200')"
SUBDIR="$(perl -E 'say "y" x 200')"
FILE1="$(perl -E 'say "a" x 100')"
FILE2="$(perl -E 'say "b" x 101')"

mkdir -p $DIR/$SUBDIR
touch $DIR/$SUBDIR/$FILE1
touch $DIR/$SUBDIR/$FILE2


pax -x pax -wf 512.tar $DIR/$SUBDIR/$FILE1
pax -f 512.tar
pax -x pax -wf 513.tar $DIR/$SUBDIR/$FILE2
pax -f 513.tar

Reply via email to