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

Fails to unpack long paths #223

Closed
davidMcneil opened this issue May 19, 2020 · 0 comments · Fixed by #224
Closed

Fails to unpack long paths #223

davidMcneil opened this issue May 19, 2020 · 0 comments · Fixed by #224

Comments

@davidMcneil
Copy link
Contributor

On Windows tar-rs fails to unpack an archive when the archive contains a folder containing a file where the name of the folder is long enough to require a @LongLink. See here for a repo replicating the issue.

Essentially, unpacking an archive with a directory structure as shown below fails.

  • this_is_a_file_with_a_name_that_just_keeps_going_on_and_on_and_on_it_is_a_very_very_long_file_name
    • test.txt

Code used to unpack:

use tar::Archive;
use std::fs::File;

fn main() {
    let file = File::open("test/test.tar").expect("failed to open tar file");
    let mut tar = Archive::new(file);
    tar.unpack("test/expanded/").expect("failed to unpack tar file");
}

The underlying error is "Access is denied." By adding logging to tar you can see the order of entries processed is as follows:

"test/expanded/this_is_a_file_with_a_name_that_just_keeps_going_on_and_on_and_on_it_is_a_very_very_long_file_name" Directory
"test/expanded/@LongLink" GNULongName
"test/expanded/this_is_a_file_with_a_name_that_just_keeps_going_on_and_on_and_on_it_is_a_very_very_long_file_name" Regular

The third entry is pointing to the directory when it should be pointing to the file. The "Access is denied." error is the result of trying to open a directory as a file.

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 a pull request may close this issue.

1 participant