Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pax and trailing '/' as directory #131

Closed
reynir opened this issue Jun 21, 2023 · 1 comment
Closed

pax and trailing '/' as directory #131

reynir opened this issue Jun 21, 2023 · 1 comment

Comments

@reynir
Copy link
Member

reynir commented Jun 21, 2023

In tar.2.5.1 I added backward compatible logic in Tar.Header.unmarshal to synthesize a Tar.Header.Link.Directory link indicator if the link indicator is either '0' or '\000' and the file name ends in a /.

In a95d00a a test was added with a specially crafted tar archive with an empty regular file placeholder with a preceding pax header setting path=clearly/a/directory/. I found that in GNU tar and bsdtar they list a directory clearly/a/directory as does tar.2.5.1.

@liebach was helpful in testing the behavior on OpenBSD:

# file pax-shenanigans.tar
pax-shenanigans.tar: data
# cat pax-shenanigans.tar
paxheader00004000000000000000000000000043000000000000006505x00000035 path=clearly/a/directory/
placeholder00004000000000000000000000000000000000000000006627
# tar tvf pax-shenanigans.tar
-r--------  1 root     wheel           35 Jan  1  1970 paxheader
-r--------  1 root     wheel            0 Jan  1  1970 placeholder
# tar xvf pax-shenanigans.tar  
paxheader
placeholder
# cat paxheader
00000035 path=clearly/a/directory/
# cat placeholder
# pax  -rv < pax-shenanigans.tar 
paxheader
placeholder
pax: tar vol 1, 2 files, 2560 bytes read, 0 bytes written.
#

It seems OpenBSD's tar and pax are not as easily convinced that the archive clearly contains a directory. It may be worth investigating why OpenBSD's tools treat the archive differently. In any case it's an archive unlikely to be found in the wild I suspect.

@hannesm
Copy link
Member

hannesm commented Jan 10, 2024

Done in #127

@hannesm hannesm closed this as completed Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants