bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] tar creates invalid archives when files shrink during rea


From: Joerg Schilling
Subject: Re: [Bug-tar] tar creates invalid archives when files shrink during reading
Date: Thu, 12 May 2005 12:07:40 +0200
User-agent: nail 11.2 8/15/04

Frank Heckenbach <address@hidden> wrote:

> I see. It seems to work now as far as it doesn't create invalid
> archives. However, AFAICS it doesn't write the last (partial) block
> read, but writes zeros instead. This should demonstrate it:
>
> #!/bin/sh
> rm -f foo bar
> echo dummy > baz
> dd if=/dev/urandom of=foo bs=1k seek=499994 count=2
> (sleep 4; dd if=/dev/null of=foo bs=1k seek=499995 count=0) &
> src/tar cf bar foo baz
> src/tar tf bar
>
> foo should still contain 1k random bytes, but in the archive created
> it contains only zeros.

You seem to be right, trying to repeat your script with star gives:

sh -x ./t
+ rm -f foo bar 
+ echo dummy 
+ dd if=/dev/urandom of=foo bs=1k seek=499994 count=2 
2+0 Datensätze in
2+0 Datensätze aus
+ sleep 4 
+ star cf bar foo baz 
+ dd if=/dev/null of=foo bs=1k seek=499995 count=0 
0+0 Datensätze in
0+0 Datensätze aus
star: 'foo': file changed size (shrunk).
star: 50000 blocks + 0 bytes (total of 512000000 bytes = 500000.00k).
star: The following problems occurred during archive processing:
star: Cannot: stat 0, open 0, read/write 0. Size changed 1.
star: Missing links 0, Name too long 0, File too big 0, Not dumped 0.
star: Processed all possible files, despite earlier errors.
+ star tvf bar 
511995904 -rw-r--r--  jes/berlios May 12 12:05 2005 foo
      6 -rw-r--r--  jes/berlios May 12 12:05 2005 baz
star: 50000 blocks + 0 bytes (total of 512000000 bytes = 500000.00k).

#!/bin/sh
rm -f foo bar
echo dummy > baz
dd if=/dev/urandom of=foo bs=1k seek=499994 count=2
(sleep 4; dd if=/dev/null of=foo bs=1k seek=499995 count=0) & star cf bar foo 
baz
star tvf bar


and a check of the archives gives:

hdump -a bar
     0:  66 6F 6F 00 00 00 00 00   00 00 00 00 00 00 00 00   foo.............
    10:  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ................
     *
    60:  00 00 00 00 30 30 30 30   36 34 34 20 30 30 30 30   ....0000644 0000
    70:  37 34 36 20 30 30 30 34   37 31 36 20 30 33 36 34   746 0004716 0364
    80:  31 30 37 30 30 30 30 20   31 30 32 34 30 36 32 34   1070000 10240624
    90:  35 34 35 20 30 30 31 35   34 32 35 20 30 00 00 00   545 0015425 0...
    a0:  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ................
     *
   100:  00 75 73 74 61 72 00 30   30 6A 65 73 00 00 00 00   .ustar.00jes....
   110:  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ................
   120:  00 00 00 00 00 00 00 00   00 62 65 72 6C 69 6F 73   .........berlios
   130:  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ................
   140:  00 00 00 00 00 00 00 00   00 30 30 30 30 30 30 30   .........0000000
   150:  20 30 30 30 30 30 30 30   20 00 00 00 00 00 00 00    0000000 .......
   160:  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ................
     *
   1d0:  00 00 00 00 00 00 00 00   00 00 00 00 31 30 32 34   ............1024
   1e0:  30 36 32 34 35 34 35 20   31 30 32 34 30 36 32 34   0624545 10240624
   1f0:  35 34 35 20 00 00 00 00   00 00 00 00 74 61 72 00   545 ........tar.
   200:  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00   ................
     *
1e846a00:  FF 97 2B B2 E9 DE 4C B0   D5 30 D2 D3 6D AE 03 83   ..+...L..0..m...
1e846a10:  32 88 52 F9 42 3C 22 92   93 54 C3 74 EC F5 52 C6   2.R.B<"..T.t..R.
1e846a20:  9D 4E 5A 53 56 20 10 5B   5A 06 39 AA 87 94 CE 9E   .NZSV .[Z.9.....
1e846a30:  B7 7F 0C 09 A3 82 81 69   AF 06 E4 79 84 48 49 2B   .......i...y.HI+
1e846a40:  6A 94 83 85 8E D5 A0 37   0D C4 5F FB D7 38 63 05   j......7.._..8c.
.....

Jörg

-- 
 EMail:address@hidden (home) Jörg Schilling D-13353 Berlin
       address@hidden           (uni)  
       address@hidden   (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily




reply via email to

[Prev in Thread] Current Thread [Next in Thread]