mirage / ocaml-tar

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

Tar.Header.unmarshal ignores extended.path and extended.link_path. #126

Closed gravicappa closed 1 year ago

gravicappa commented 1 year ago

Tar.Header.unmarshal ignores extended.path and extended.link_path. I think those values (if exists) should replace header's file_name and link_name fields.

This issue breaks reading archives that has x headers containing path= entries since it returns Tar.Header.t with file_name values cut off. Such archives can be created with tar -H posix for instance.

reynir commented 1 year ago

Good catch! I confirmed this by checking the code and testing.

I am working on some major breaking changes, and there are already some breaking changes in the API. Would you like a backported fix, or are you okay with waiting?

(I will submit my changes soon as they have been sitting on my computer for a while)

gravicappa commented 1 year ago

Thanks for a quick response! A backported fix would be nice as I am unsure in soundness of my own workaround.

reynir commented 1 year ago

Ok! Note that it will not consider the pax global header -- though that is unlikely to affect file names, but can affect ownership and such.

I will likely not be able to do a release with a fix before Friday this week.

reynir commented 1 year ago

Hi @gravicappa, tar.2.5.0 has been released with a fix.