Hi, I've noticed that sparse file header can't be splitted across multiple archive volume. So if you try to make a multi-volume archive of a big sparse file (with a lot of holes), it can happen that a file header (list of the holes) will not fit on the same archive volume. Tar then continues such a header on the next volume, but *without any tar archive header*. If even second volume isn't enough, it looks like the header got truncated there and tar starts the file data (with a proper header this time) on the next volume. When you try to extract such a file from an archive, tar complains that the second volume doesn't look like tar archive. When you concatenate all the volumes and extract this archive, it will look better (apart from "tar: Skipping to next header" message), but the file will be broken.
The worst thing here - tar pretends that the archive was successfully created, the user do not get any error message during creation of such archive. Tested on tar 1.26 (Fedora 20), confirmed on 1.28 compiled from sources. Steps to reproduce: 1. Create sparse file: for i in `seq 10000`; do yes | dd bs=512 count=1 dd if=/dev/zero bs=1024 count=20 done |cp --sparse=always /dev/stdin sparse.bin 1a. Check the file: ls -lhs sparse.bin 81M -rw------- 1 user user 201M Sep 15 04:10 sparse.bin md5sum sparse.bin 11a7794e3b5650d6c6779cbb9cd24c68 sparse.bin 2. Create multi-volume archive: tar cf sparse.tar.000 --tape-length 128 --sparse sparse.bin (enter new names like sparse.tar.001 etc when prompted for next volume) 3. Try to extract: $ tar xMf sparse.tar.000 Prepare volume #2 for `sparse.tar.000' and hit return: n sparse.tar.001 tar: `sparse.bin' is not continued on this volume Prepare volume #2 for `sparse.tar.001' and hit return: 4. Try to concatenate volumes and extract: $ cat sparse.tar.* |tar xM tar: Skipping to next header tar: Exiting with failure status due to previous errors 5. Verify extracted file: ls -lhs sparse.bin 40M -rw------- 1 user user 201M Sep 15 04:10 sparse.bin md5sum sparse.bin 081154090bd6862985960a433a7a06a9 sparse.bin It's different than original file! -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
signature.asc
Description: OpenPGP digital signature