Skip to content

Fix Tar cleanup one-liners - #131672

Draft
alinpahontu2912 wants to merge 1 commit into
dotnet:mainfrom
alinpahontu2912:alinpahontu2912/tar-cleanup-oneliners
Draft

Fix Tar cleanup one-liners#131672
alinpahontu2912 wants to merge 1 commit into
dotnet:mainfrom
alinpahontu2912:alinpahontu2912/tar-cleanup-oneliners

Conversation

@alinpahontu2912

@alinpahontu2912 alinpahontu2912 commented Jul 31, 2026

Copy link
Copy Markdown
Member
  • TarEntry.Windows.cs: fix Debug.Assert bug in ExtractAsBlockDevice/ExtractAsCharacterDevice (each asserted BlockDevice or CharacterDevice instead of its own specific type).
  • TarHeader.Write.cs: change GetTotalDataBytesToWrite() from public to internal, matching its containing internal sealed type and sibling helpers.

- TarEntry.Windows.cs: fix copy-paste Debug.Assert bug in ExtractAsBlockDevice/ExtractAsCharacterDevice (each asserted BlockDevice or CharacterDevice instead of its own specific type).
- TarHeader.Write.cs: change GetTotalDataBytesToWrite() from public to internal, matching its containing internal sealed type and sibling helpers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7572f80-427a-403d-aac4-e8c856f1ba08
@alinpahontu2912 alinpahontu2912 self-assigned this Jul 31, 2026
Copilot AI review requested due to automatic review settings July 31, 2026 20:27
@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 tightens up internal correctness/cleanup in System.Formats.Tar by fixing platform-specific debug assertions for device-file extraction on Windows and by reducing unnecessary method visibility within an internal implementation type.

Changes:

  • Fix Debug.Assert conditions in Windows-only extraction helpers so each method asserts its own expected TarEntryType.
  • Change TarHeader.GetTotalDataBytesToWrite() from public to internal to better match the containing internal sealed implementation type and avoid exposing an unnecessary “public” member in metadata.

Reviewed changes

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

File Description
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.Windows.cs Corrects per-entry-type Debug.Assert invariants for Windows device-file extraction stubs.
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Write.cs Narrows helper method visibility (publicinternal) within the internal TarHeader writer implementation.

@alinpahontu2912
alinpahontu2912 marked this pull request as draft July 31, 2026 20:36
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