Skip to content

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

Merged
carlossanlop merged 2 commits into
release/7.0from
backport/pr-77338-to-release/7.0
Nov 29, 2022
Merged

[release/7.0] Fix relative symlink support in TarFile#78470
carlossanlop merged 2 commits into
release/7.0from
backport/pr-77338-to-release/7.0

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Nov 16, 2022

Copy link
Copy Markdown
Contributor

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

am11and others added 2 commits November 16, 2022 15:21
…romDirectory.File.Roundtrip.cs
Co-authored-by: David Cantú <dacantu@microsoft.com>
@ghostghost added the area-System.IO label Nov 16, 2022
@ghost

Copy link
Copy Markdown

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:-

@jozkeejozkee added this to the 7.0.x milestone Nov 16, 2022
@jozkeejozkee self-assigned this Nov 16, 2022
@carlossanlopcarlossanlop 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
Copy Markdown
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
Copy Markdown
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.0Nov 29, 2022
@carlossanlop
carlossanlop deleted the backport/pr-77338-to-release/7.0 branch November 29, 2022 23:12
@ghostghost locked as resolved and limited conversation to collaborators Dec 30, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Formats.TarServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@carlossanlop@jeffhandley@jozkee@am11