Michał Górny <[email protected]> ha escrit:
> $ echo test > BZh5
> $ tar --format=v7 -cf test.tar BZh5
> $ tar -xf test.tar
> bzip2: stdin: compressed data error: bad block header magic
> tar: Child returned status 1
> tar: Error is not recoverable: exiting now
Before attempting compression format identification, tar tests if
the first block read is a valid tar header block. However, the
test itself is stricter than necessary. The following patch should
fix this:
diff --git a/src/buffer.c b/src/buffer.c
index ddb63cc..5632aee 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -406,10 +406,6 @@ check_compressed_archive (bool *pshort)
read_full_records = sfr;
if (record_start != record_end /* no files smaller than BLOCKSIZE */
- && (strcmp (record_start->header.magic, TMAGIC) == 0
- || strcmp (record_start->buffer + offsetof (struct posix_header,
- magic),
- OLDGNU_MAGIC) == 0)
&& tar_checksum (record_start, true) == HEADER_SUCCESS)
/* Probably a valid header */
return ct_tar;
Regards,
Sergey