AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
196 stars 30 forks source link

"pax_global_header: unknown entry type" from tar2sqfs of git archive tarball #45

Closed mattst88 closed 4 years ago

mattst88 commented 4 years ago

From any git repo:

$ git archive --format=tar master | tar2sqfs /tmp/f.sqfs -f -q 
pax_global_header: unknown entry type

I have no clue what pax_global_header is. The warning seems to be harmless, at least for my purposes. Not sure what to do here.

AgentD commented 4 years ago

Hi!

PAX headers can be used to describe file attributes that the regular tar format cannot (e.g. extended attributes or ACLs). They look like regular files but contain plain text key/value pairs.

Normally, tar would generate local PAX headers (type flag 'x') that describe the next file immediately afterwards, but global headers (type flag 'g') also exist, that describe defaults for all files.

To my knowledge, the global headers are a rather obscure feature (tar(5) describes it as rarely used) and the tar parser I wrote deliberately does not implement them, as it would require some kind of global state tracking and attribute merging, for an obscure, rarely used format feature no less.

It appears that git archive --format=tar does produce a global PAX header which stores the git commit hash in a comment field.

Commit c6b65ee8a9a57d51956ee462fa1d61fd90d61f40 implements a code path in the tar parser to recognize the type flag 'g' and skip the rest and resume scanning for the next header, instead of reporting it as an unknown record type. This should silence the warning.

Thanks!