mirage / ocaml-tar

Pure OCaml library to read and write tar files
ISC License
54 stars 34 forks source link

Tar.Header.make and PAX #142

Open reynir opened 9 months ago

reynir commented 9 months ago

The Tar.Header.make function checks the size required for the file size, uid and gid and creates an extended header if needed. This could as well check the file name size and other fields. https://github.com/mirage/ocaml-tar/blob/ef66a98a5630c23a70a1ec2a4cb07c9b50182fa6/lib/tar.ml#L466-L489

A problem, though, is that the compatibility level is not considered, and in our writer we don't check the compatibility level before writing the extended header. This means we can set compatibility level to V7 but still get PAX extended headers. There is as well a discrepancy how we handle this for GNU compatibility level -- there we synthesize the GNU LongLink in the writer instead.