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

fix for archiving long paths that have path components starting with ".." crossing the 100-character mark #54

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

mitrandir77
Copy link
Contributor

This is backport of my patch to tar-rs: alexcrichton/tar-rs#390

The gnu tar supports arbirary path length by putting path truncated to standard 100 chars into the header and the rest is appended to contents. tar-rs validates that no path components should be exactly ".." but in this case when a component starting with ".." (for example file named "..some_file") gets truncated after 2 characters we hit this validation and can't tar such file.

I have verified that gnu tar command can handle such paths and actually puts truncated .. in the header. This pull request makes tar-rs behave the same.

See tests for repro of the issue.

…ith .. at 100-character mark

his test checks very particular scenario where path component starting with
".." of a long path gets split at 100-byte mark so that ".." goes into header
and gets interpreted as parent dir (and rejected) .
This is a fix for very specific scenario where a path component starting with
".." of a long path gets split at 100-byte mark so that ".." goes into header
and gets interpreted as parent dir (and rejected).
@mitrandir77
Copy link
Contributor Author

the problems highlighted by clippy lint check seem unrelated to my changes

@dignifiedquire
Copy link
Owner

thanks for working on this, and sending the patch here as well

@dignifiedquire dignifiedquire merged commit f732623 into dignifiedquire:master Dec 20, 2024
8 of 9 checks passed
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.

2 participants