-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
TarReader doesn't read paths with spaces from Pax extended attributes #78456
Comments
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsDescriptionFor tar archives with pax entries whose extended metadata contains a path with spaces that path is currently silently ignored and the standard name field used, which can lead to extraction errors when the names of headers aren't unique (e.g. I came across files that put "PaxHeader" as the name for every pax entry and their consecutive file entry.
Spaces in values of extended metadata entries are explicitly treated as malformed here (introduced in #74281), but I can't see why. Reproduction StepsGiven a tar file with multiple pax entries whose using System.Formats.Tar;
TarFile.ExtractToDirectory(@"/home/prettybits/tests/paxheaders.tar", @"/home/prettybits/tests/", false); => Expected behaviorPaths with spaces from pax extended attributes should be used as the name of the logical entry. Actual behaviorPaths with spaces are ignored and the original name used, which might not be unique. Regression?Reading the diff, this likely worked correctly before #74281 was merged. Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
@jozkee @carlossanlop PTAL
cc @stephentoub |
Yup. I misread the Split call I was replacing, which is why I added that IndexOf, and there wasn't a test for paths with spaces to flag my mistake. |
Description
For tar archives with pax entries whose extended metadata contains a path with spaces that path is currently silently ignored and the standard name field used, which can lead to extraction errors when the names of headers aren't unique (e.g. I came across files that put "PaxHeader" as the name for every pax entry and their consecutive file entry.
Spaces in values of extended metadata entries are explicitly treated as malformed here (introduced in #74281), but I can't see why. @stephentoub
Reproduction Steps
Given a tar file with multiple pax entries whose
name
field values for extended attribute and file entry each are "PaxHeader", and pax extended attributes which contain apath
with spaces (e.g.29 path=file with spaces.xml\n13 size=7720\n
) :=>
Cannot create '/home/prettybits/tests/PaxHeader' because a file or directory with the same name already exists.
Expected behavior
Paths with spaces from pax extended attributes should be used as the name of the logical entry.
Actual behavior
Paths with spaces are ignored and the original name used, which might not be unique.
Regression?
Reading the diff, this likely worked correctly before #74281 was merged.
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: