-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tar: Improve unseekable stream handling (#84279)
* Add tests that verify we handle unseekable streams correctly. Adjust existing unseekable stream tests to verify correct for all formats and with multiple tar entries. * Add expected data field locations for all supported formats. * Add exception message for when attempting to write an unseekable data stream into an unseekable archive stream. * Add seekability validation in public TarWriter entry writing methods. * Add TarFile stream roundtrip tests for unseekable streams. * Add missing async TarFile roundtrip tests. * Support unseekable streams in TarHeader.Write. * Reuse and simplify the code. * More reuse, remove unused and not needed. * Remove TarFile.CreateFromDirectoryAsync.File.Roundtrip.cs. Submit it in a separate PR. * Remove unnecessary resx comments. * Dedicated method for writing fields to buffer depending on the format. * Specify `Data` in name of method that expects unseekable data stream. Add extra debug asserts. * Delete unnecessary method. * Rename WritePadding to WriteEmptyPadding * Rename test variables * Merge identical test arrays into one * Invert if else to be more clear about conditions * remove size assign comment * Remove redundant debug assert * Async padding byte array creation simplification * Apply suggestions from code review --------- Co-authored-by: Adam Sitnik <[email protected]>
- Loading branch information
1 parent
1575ed9
commit 84a7be7
Showing
12 changed files
with
584 additions
and
258 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
316 changes: 188 additions & 128 deletions
316
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Write.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.