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

Add case for ustar header with gnu longname #224

Merged
merged 2 commits into from
May 20, 2020

Conversation

davidMcneil
Copy link
Contributor

Resolves #223

When using 7zip to make an archive on Windows it creates an archive with a ustar header with entries of type GnuLongname. This PR adds support for this case.

I know very little about the tar spec. It would be great if someone could confirm that this is the correct fix. Should support also be added for ustar with GnuLonglink?

Signed-off-by: David McNeil mcneil.david2@gmail.com

@alexcrichton
Copy link
Owner

Thanks for the PR! Is this perhaps a new feature in 7zip? Would it be possible to file an issue with them indicating that it may be buggy?

@alexcrichton
Copy link
Owner

Or alternatively, if there's precedent of doing this in other libraries, then we could do that.

@davidMcneil
Copy link
Contributor Author

davidMcneil commented May 20, 2020

Is this perhaps a new feature in 7zip?

I do not believe so. I did some more investigation. This bug also exists for archives created on linux with 7zip version 16.02 from 2016-05-21. Here are the steps to create a failing archive:

> mkdir this_is_a_folder_with_a_name_that_just_keeps_going_on_and_on_and_on_it_is_a_very_very_long_folder_name
> touch this_is_a_folder_with_a_name_that_just_keeps_going_on_and_on_and_on_it_is_a_very_very_long_folder_name/test.txt
> 7z a -ttar 7z_long_path.tar this_is_a_folder_with_a_name_that_just_keeps_going_on_and_on_and_on_it_is_a_very_very_long_folder_name/

tar x -f 7z_long_path.tar works fine so I believe 7zip is creating a valid archive.

Or alternatively, if there's precedent of doing this in other libraries, then we could do that.

I can do some investigation. What projects would you recommend looking at? libarchive?

@davidMcneil
Copy link
Contributor Author

Is it possible the checks on the header type (1, 2, 3) should be removed (ie do not check for gnu vs ustar) and only use the entry_type in the if statements.

@davidMcneil
Copy link
Contributor Author

It looks like libsodium treats the two formats identically identically which maybe supports the removal of the gnu vs ustar header checks as commented above.

@alexcrichton
Copy link
Owner

Ah ok that's good enough for me! In that case want to remove the check for is_gnu above and that should be good to go?

@alexcrichton
Copy link
Owner

(or actually, update it to is_gnu || is_ustar

…der info

Signed-off-by: David McNeil <mcneil.david2@gmail.com>
Signed-off-by: David McNeil <mcneil.david2@gmail.com>
@davidMcneil
Copy link
Contributor Author

I updated the PR to check for both header formats.

@alexcrichton alexcrichton merged commit e92e1b6 into alexcrichton:master May 20, 2020
@alexcrichton
Copy link
Owner

Thanks!

moschroe pushed a commit to moschroe/tar-rs that referenced this pull request Jun 11, 2020
* Check for any recognized header format when adding entry extended header info

Signed-off-by: David McNeil <mcneil.david2@gmail.com>

* Fix formatting

Signed-off-by: David McNeil <mcneil.david2@gmail.com>
dignifiedquire added a commit to dignifiedquire/async-tar that referenced this pull request Jul 19, 2020
vorot93 pushed a commit to vorot93/tokio-tar that referenced this pull request May 18, 2021
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

Successfully merging this pull request may close these issues.

Fails to unpack long paths
2 participants