[File] Does not correctly detect 2-pass tar.gz files

Christos Zoulas christos at zoulas.com
Sun Feb 1 16:14:24 UTC 2026


What are the contents of the original tar file? Is it empty?

christos

> On Jan 21, 2026, at 12:36 PM, Haoqing Chen <chenhq2005 at gmail.com> wrote:
> 
> Hi,
> 
> It seems like that the file program cannot correctly determine types of tar.gz files when they are compressed separately, i.e. by first producing a tar file with `tar cf` then passed into gzip to produce the final tar.gz file. For such files, using `file -S -iz two-pass.tar.gz` will yield application/x-empty instead of the expected application/x-tar.
> 
> I done a bit of research and it seems like that it is related to the FNAME metadata in the gzipped archive. If the 2nd pass is created with `gzip -n` which does not set the FNAME metadata, then file is able to correctly output application/x-tar. tar.gz archives created by `tar -czf` also seems to lack the FNAME metadata.
> 
> Haoqing
> 
> -- 
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20260201/ffdfbf51/attachment.asc>


More information about the File mailing list