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 #390

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mitrandir77
Copy link

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.

(I think the code for handling this special case is quite ugly - I'd appreciate suggestions for making it better)

…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).

See tests for repro of the issue.
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.

1 participant