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

Make TarfileItem.name be of type PurePosixPath #422

Merged
merged 1 commit into from
Jun 19, 2023
Merged

Conversation

mih
Copy link
Member

@mih mih commented Jun 16, 2023

Rational from #409:

>>> PureWindowsPath(*PurePosixPath('d/a\\b\\c.txt').parts)
PureWindowsPath('d/a/b/c.txt')

This means that we must relay the POSIX nature of the archive member path to the users, because there is no way to express this as a platform (windows) path -- and also no way to extract this file under an equivalent name on an FS that uses windows-semantics. So a type mismatch can be used to trigger mitigation strategies.

If feel like a clean(er) solution would be to change TarFileItem to declare to have a name of type PurePosixPath.

Rational from datalad#409:

```py
>>> PureWindowsPath(*PurePosixPath('d/a\\b\\c.txt').parts)
PureWindowsPath('d/a/b/c.txt')
```

This means that we must relay the POSIX nature of the archive member
path to the users, because there is no way to express this as a platform
(windows) path -- and also no way to extract this file under an
equivalent name on an FS that uses windows-semantics. So a type
mismatch can be used to trigger mitigation strategies.

If feel like a clean(er) solution would be to change `TarFileItem` to
declare to have a `name` of type `PurePosixPath`.

For the same reason and rational, a symlink target must also be
communicated in POSIX form.
Copy link
Contributor

@christian-monch christian-monch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.

@mih
Copy link
Member Author

mih commented Jun 19, 2023

Thanks for the review! Test failure was HTTPBIN outage. Going in.

@mih mih merged commit a51e6f0 into datalad:main Jun 19, 2023
@mih mih deleted the archivepaths branch June 19, 2023 08:42
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