[File] Does not correctly detect 2-pass tar.gz files
Haoqing Chen
chenhq2005 at gmail.com
Wed Jan 21 17:36:57 UTC 2026
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
More information about the File
mailing list