[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] extracting multivol archives: no chance to correct sequence of
From: |
Joerg Weilbier |
Subject: |
[Bug-tar] extracting multivol archives: no chance to correct sequence of volumes |
Date: |
Sun, 1 Oct 2006 19:52:28 +0200 |
User-agent: |
KMail/1.5.4 |
Hi,
while extracting multivol archives in a violation of right sequence of volumes
will cause first a warning (... is not continued on this volume). That's ok,
but if you now take the right volume, you can't reach the right way anymore.
I used tar 1.15.91
Older versions (e.g. 1.15.1) will not fail!
I used this commands (Gnu/Linux (Debian 3.1, SuSE9.0), bash):
#TAR="/home/joerg/tar/tar-1.13.94/src/tar"
#TAR="/home/joerg/tar/tar-1.14.91/src/tar"
#TAR="/home/joerg/tar/tar1.15.1/src/tar"
TAR="/home/joerg/Linux/tar/Fehleranalyse/tar-1.15.91.erw/src/tar"
rm z*.tar 2> /dev/null
rm $File1 $File2 2> /dev/null
#create files:
dd bs=1024 count=250 if=/dev/urandom of=File1
dd bs=1024 count=250 if=/dev/urandom of=File2
#create archive:
$TAR --create -v --multi-volume --tape-length=100 --file=z1.tar \
--file=z2.tar --file=z3.tar --file=z4.tar --file=z5.tar --file=z6.tar \
--file=z7.tar File1 File2
mkdir -p bak/
mv File1 File2 bak/
#extract with false sequence, but then corrected:
$TAR --extract -v --multi-volume --file=z1.tar --file=z2.tar \
--file=z4.tar --file=z3.tar --file=z4.tar --file=z5.tar --file=z6.tar
#compare extracted files and backup-copies
cmp File1 bak/File1
cmp File2 bak/File2
The problem is in buffer.c, try_new_volume():
In case of wrong volume (while extracting) in "switch
(header->header.typeflag) ... case GNUTPYPE_MULTIVOL" the global variable
current_block will increment with a blocksize (inside of read_header0
(&dummy)).
In immediate following next call of try_new_volume() therefore the
current_block points to data _behind_ the (multivol-) header of next volume.
I suggest this patch (inserting of initialization of current_block in every
run of try_new_volume()):
--- buffer.c.orig 2006-08-24 11:59:17.000000000 +0200
+++ buffer.c 2006-10-01 15:37:14.000000000 +0200
@@ -1143,6 +1143,11 @@
break;
}
+/*if try_new_volume() was ended with false, current_block is still
record_start + BLOCKSIZE (cause of read_header0()-call)
+ We first must put it back
+*/
+ current_block = record_start;
+
while ((status = rmtread (archive, record_start->buffer, record_size))
== SAFE_READ_ERROR)
archive_read_error ();
--
Joerg
- [Bug-tar] extracting multivol archives: no chance to correct sequence of volumes,
Joerg Weilbier <=