Tar fix 8 - #131074
Closed
alinpahontu2912 wants to merge 5 commits into
Closed
Tar fix 8#131074alinpahontu2912 wants to merge 5 commits into
alinpahontu2912 wants to merge 5 commits into
Conversation
… symlink tests When an entry resolves to the destination directory itself, the relative path computation did an out-of-range Substring (logicalPrefix includes a trailing separator). Return an empty relative path in that case. This also fixes the ArgumentOutOfRangeException seen on macOS where the physical destination path is longer than the logical one. Remove the [ActiveIssue] dotnet#129227 tags now that the affected tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-formats-tar |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates System.Formats.Tar extraction path-safety logic to better handle symlink-resolution edge cases (notably on macOS where temp paths may traverse symlinked roots), and re-enables a set of Tar extraction tests that were previously disabled on macOS under an active issue.
Changes:
- Fixes
TarEntry.FilePathEscapesDirectoryto compute relative components using a logical destination prefix (avoiding out-of-rangeSubstringwhen the destination resolves to a longer physical path, e.g./tmp→/private/tmp). - Adjusts symlink resolution in the traversal walk to treat non-links and dangling links more robustly (and removes several
ActiveIssue(..., OSX)test suppressions). - Updates a Windows-only traversal test to accept either
IOExceptionorUnauthorizedAccessException, matching observed OS-build differences.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs | Re-enables previously suppressed macOS tests by removing ActiveIssue annotations. |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.File.Tests.cs | Re-enables previously suppressed macOS tests by removing ActiveIssue annotations. |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | Re-enables previously suppressed macOS tests by removing ActiveIssue annotations. |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs | Re-enables previously suppressed macOS/Windows tests by removing ActiveIssue annotations; expands Windows assertion for OS-dependent exception behavior. |
| src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs | Fixes directory-escape detection to handle logical vs physical path prefixes safely and refines symlink resolution during traversal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.