[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] GNU tar can produce broken multi volume archives
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] GNU tar can produce broken multi volume archives |
Date: |
Thu, 26 Jun 2008 01:02:03 +0300 |
Petr Sumbera <address@hidden> ha escrit:
> When using -M option for creating multi volume archives, tar can
> produces bad archives (archives which tar cannot extracted again).
Thanks for reporting. Please find attached a patch.
Regards,
Sergey
Index: src/buffer.c
===================================================================
RCS file: /cvsroot/tar/tar/src/buffer.c,v
retrieving revision 1.117
diff -p -u -r1.117 buffer.c
--- src/buffer.c 31 Jan 2008 00:50:12 -0000 1.117
+++ src/buffer.c 25 Jun 2008 21:59:04 -0000
@@ -1586,6 +1594,7 @@ _gnu_flush_write (size_t buffer_level)
if (status < 0 && errno != ENOSPC && errno != EIO && errno != ENXIO)
archive_write_error (status);
+ real_s_sizeleft -= status;
if (!new_volume (ACCESS_WRITE))
return;
@@ -1597,6 +1606,10 @@ _gnu_flush_write (size_t buffer_level)
copy_ptr = record_start->buffer + status;
copy_size = buffer_level - status;
+ if (copy_size % BLOCKSIZE)
+ FATAL_ERROR ((0, 0,
+ _("write did not end on a block boundary")));
+
/* Switch to the next buffer */
record_index = !record_index;
init_buffer ();