]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Revert "Fix savannah bug #63567"
authorSergey Poznyakoff <gray@gnu.org>
Fri, 11 Aug 2023 18:35:30 +0000 (21:35 +0300)
committerSergey Poznyakoff <gray@gnu.org>
Tue, 15 Aug 2023 08:34:21 +0000 (11:34 +0300)
Commit e89c7a45eb broke deletion from archives. The reported number
of bytes read is rounded to the nearest record anyway, revert the
commit and document the fact.

Reported by Ed Santiago. See
https://bugzilla.redhat.com/show_bug.cgi?id=2230127

* doc/tar.texi: Document the fact that --totals rounds up the
number of bytes reads to the nearest record.
* src/buffer.c: Revert changes.
* tests/delete06.at: Fix expected status code and stderr.

doc/tar.texi
src/buffer.c
tests/delete06.at

index d43b39e4285fe6707bae6eb585140c2114659e77..ee631137f7b656d5d2c2c98a22abb6fabec12f88 100644 (file)
@@ -4215,6 +4215,11 @@ Total bytes read: 7924664320 (7.4GiB, 95MiB/s)
 @end group
 @end smallexample
 
+Notice, that since @command{tar} operates on @dfn{records}, the number
+of bytes reported can be rounded up to the nearest full record.  This
+can happen, in particular, when the last record in the archive is
+partial.  @xref{Blocking}.
+
 Finally, when deleting from an archive, the @option{--totals} option
 displays both numbers plus number of bytes removed from the archive:
 
index 12a0579f86f1065db00566e652b5849ff0424977..8a575f9aa776009e0968c5d0753f2b34ba67cd3f 100644 (file)
@@ -987,8 +987,7 @@ short_read (size_t status)
     }
 
   record_end = record_start + (record_size - left) / BLOCKSIZE;
-  if (left == 0)
-    records_read++;
+  records_read++;
 }
 
 /*  Flush the current buffer to/from the archive.  */
index 9668a28c268ab84c04598fc81b9e69eb1e00d67f..c84ba20e185c317c52dd23e0a8f68af06bf9d65d 100644 (file)
@@ -36,7 +36,10 @@ esac
 dd if=archive.tar of=trunc.tar bs=$size count=1 2>/dev/null
 tar --delete 'b/' -f trunc.tar
 ],
-[0],
-[],[],[],[],[gnu, pax])
+[2],
+[],
+[tar: lseek: trunc.tar: Value too large for defined data type
+tar: Exiting with failure status due to previous errors
+],[],[],[gnu, pax])
 
 AT_CLEANUP