diff --git a/doc/tar.texi b/doc/tar.texi index d43b39e4..ee631137 100644 --- a/doc/tar.texi +++ b/doc/tar.texi @@ -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: diff --git a/src/buffer.c b/src/buffer.c index 12a0579f..8a575f9a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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. */ diff --git a/tests/delete06.at b/tests/delete06.at index 9668a28c..c84ba20e 100644 --- a/tests/delete06.at +++ b/tests/delete06.at @@ -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