Skip to content

[release/7.0] Fix relative symlink support in TarFile #78470

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

Merged
merged 2 commits into from
Nov 29, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Nov 16, 2022

Backport of #77338 to release/7.0

/cc @jozkee @am11

Customer Impact

  • Symlinks having as target a relative path were always created with an absolute path on extraction.
  • Symlinks having as target a relative path pointing to a different directory could throw an exception if Path.Combine(destinationDirectory, path) resulted in a path outside of the destination directory. Said Path combination was incorrect since links targets are relative to where the link is located.

With this fix, symlinks with relative targets don’t run into unexpected exceptions and their relative target is correctly preserved on extraction.
It is an important scenario as relative symlinks are perhaps the most common kind of symlink for their portability and both issues stated above would mess with that.

Testing

Added tests for relative targets pointing inside (OK) and outside (Throw) the destination directory, combined with the link being in multiple levels of the destination directory.

Risk

Low, System.Formats.Tar is a new feature in 7.0

am11 and others added 2 commits November 16, 2022 15:21
…romDirectory.File.Roundtrip.cs

Co-authored-by: David Cantú <dacantu@microsoft.com>
@ghost ghost added the area-System.IO label Nov 16, 2022
@ghost
Copy link

ghost commented Nov 16, 2022

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #77338 to release/7.0

/cc @jozkee @am11

Customer Impact

Testing

Risk

IMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.IO

Milestone: -

@jozkee jozkee added this to the 7.0.x milestone Nov 16, 2022
@jozkee jozkee self-assigned this Nov 16, 2022
@carlossanlop carlossanlop added Servicing-consider Issue for next servicing release review Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Nov 16, 2022
@carlossanlop
Copy link
Contributor

Approved by Tactics via email. CI is green. Approved by area owner. No OOB package authoring changes needed.
Will merge when the branch reopens to take servicing changes on Nov. 29th. :shipit:

@carlossanlop
Copy link
Contributor

Branding has been done. Milestone is 7.0.2. CI is green. Signed-off by area owners. Approved by Tactics. No OOB package authoring changes needed. Ready to merge. :shipit:

@carlossanlop carlossanlop merged commit e4b6123 into release/7.0 Nov 29, 2022
@carlossanlop carlossanlop deleted the backport/pr-77338-to-release/7.0 branch November 29, 2022 23:12
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Formats.Tar Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants