Skip to content

Fix tar tests#131077

Closed
alinpahontu2912 wants to merge 2 commits into
dotnet:release/8.0-stagingfrom
alinpahontu2912:fix_tar_test_8
Closed

Fix tar tests#131077
alinpahontu2912 wants to merge 2 commits into
dotnet:release/8.0-stagingfrom
alinpahontu2912:fix_tar_test_8

Conversation

@alinpahontu2912

Copy link
Copy Markdown
Member

Windows always creates file symlinks, not directories. Based on the build, the exception can be thrown either when creating the symlink or when parsing it. We are now dealing with both cases.

@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates System.Formats.Tar extraction tests related to symlink/link traversal and other extraction behaviors, aiming to unskip previously-disabled coverage and to tolerate Windows-specific exception differences when rejecting malicious archives.

Changes:

  • Removes [ActiveIssue(..., TestPlatforms.OSX)] from multiple TarFile.ExtractToDirectory* tests, re-enabling them on macOS.
  • Updates the Windows assertion in the chained symlink traversal test to accept either IOException or UnauthorizedAccessException depending on OS/build behavior.
  • Keeps the security postconditions (no files created outside destination) after the extraction failure checks.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs Re-enables several async stream extraction tests on macOS by removing ActiveIssue.
src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.File.Tests.cs Re-enables several async file-path extraction tests on macOS by removing ActiveIssue.
src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs Re-enables several sync stream extraction tests on macOS by removing ActiveIssue.
src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs Re-enables some sync file-path extraction tests on macOS; broadens Windows exception acceptance in chained-symlink traversal rejection test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 76 to 79
[Theory]
[InlineData(TarEntryType.SymbolicLink)]
[InlineData(TarEntryType.HardLink)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)]
public void Extract_LinkEntry_TargetOutsideDirectory(TarEntryType entryType)
Comment on lines 59 to 60
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)]
public async Task SetsLastModifiedTimeOnExtractedFiles()
Comment on lines 136 to 139
[Theory]
[InlineData(TarEntryType.SymbolicLink)]
[InlineData(TarEntryType.HardLink)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)]
public async Task Extract_LinkEntry_TargetOutsideDirectory_Async(TarEntryType entryType)
Comment on lines 211 to 212
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)]
public void ExtractArchiveWithEntriesThatStartWithSlashDotPrefix()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants