tar: improve diagnostic for truncated archive
* src/buffer.c (seek_archive): If EOF has been read, don’t attempt to seek past it. This replaces a bogus "rmtlseek not stopped at a record boundary" message with a better "Unexpected EOF in archive" when I run ‘tar tvf gtar13c.tar’ using the gtar13.tar file here: https://lists.gnu.org/r/bug-tar/2024-03/msg00001.html
This commit is contained in:
@@ -1072,6 +1072,11 @@ seek_archive (off_t size)
|
||||
off_t start = current_block_ordinal ();
|
||||
off_t offset;
|
||||
off_t nrec, nblk;
|
||||
|
||||
/* If low level I/O is already at EOF, do not try to seek further. */
|
||||
if (record_end < record_start + blocking_factor)
|
||||
return 0;
|
||||
|
||||
off_t skipped = (blocking_factor - (current_block - record_start))
|
||||
* BLOCKSIZE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user