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 read


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] tar creates invalid archives when files shrink during reading
Date: Wed, 11 May 2005 11:45:40 +0300

Frank Heckenbach <address@hidden> wrote:

> It's a bit hard to reproduce. This code reproduces a
> problem rather reliably on my system:

Thanks.

> AFAICS, if you do it your way, you also need to move the

Sure, actually I meant the following:

Index: src/create.c
===================================================================
RCS file: /cvsroot/tar/tar/src/create.c,v
retrieving revision 1.94
diff -p -u -r1.94 create.c
--- src/create.c        7 Apr 2005 17:27:07 -0000       1.94
+++ src/create.c        11 May 2005 08:44:08 -0000
@@ -886,8 +886,6 @@ dump_regular_file (int fd, struct tar_st
        }
       size_left -= count;
 
-      set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
-
       if (count != bufsize)
        {
          char buf[UINTMAX_STRSIZE_BOUND];
@@ -900,9 +898,11 @@ dump_regular_file (int fd, struct tar_st
                 STRINGIFY_BIGINT (size_left, buf)));
          if (! ignore_failed_read_option)
            exit_status = TAREXIT_FAILURE;
-         pad_archive (size_left);
+         pad_archive (size_left + count);
          return dump_status_short;
        }
+
+      set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
     }
   return dump_status_ok;
 }


(decrementing size_left after the conditional will produce incorrect
warning messages).


Regards,
Sergey

 





reply via email to

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