[PR #1063] [MERGED] Add alternative option for writing TAR archives with USTAR header format #1489

Closed
opened 2026-01-29 22:20:49 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/1063
Author: @drone1400
Created: 12/6/2025
Status: Merged
Merged: 12/9/2025
Merged by: @adamhathcock

Base: masterHead: tar-ustar-header-format-support


📝 Commits (2)

  • 5161f4d Add alternative option for writing TAR archives with USTAR header format
  • 40b1aad Reformatted modified files with csharpier

📊 Changes

4 files changed (+154 additions, -5 deletions)

View changed files

📝 src/SharpCompress/Common/Tar/Headers/TarHeader.cs (+131 -2)
src/SharpCompress/Common/Tar/Headers/TarHeaderWriteFormat.cs (+7 -0)
📝 src/SharpCompress/Writers/Tar/TarWriter.cs (+3 -1)
📝 src/SharpCompress/Writers/Tar/TarWriterOptions.cs (+13 -2)

📄 Description

Changes Summary

  • Adds an option when creating a TarWriter to write the TAR headers using the USTAR format
  • Change is implemented by adding an enum property to TarWriterOptions
  • Does not change default behavior, unless manually specified when creating a TarWriter object via the TarWriterOptions, will use the existing modern GNU TAR header

Issues

  • Perhaps, that I did not add any unit test for validating the USTAR headers. They should be fine since I have been using these changes for almost a year with no issue...

Context
Some time last year when I was using SharpCompress for a game mod manager, I ran into an issue where tar.bz2 files compressed with SharpCompressed were incompatible with some source ports of that game that would only accept the old USTAR format.

I didn't think of making a pull request at the time as it seems like a very niche thing, but now I'm thinking someone else might find it useful too.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/1063 **Author:** [@drone1400](https://github.com/drone1400) **Created:** 12/6/2025 **Status:** ✅ Merged **Merged:** 12/9/2025 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `tar-ustar-header-format-support` --- ### 📝 Commits (2) - [`5161f4d`](https://github.com/adamhathcock/sharpcompress/commit/5161f4df339c4b08f95fb6af40f88ae9df9dcd99) Add alternative option for writing TAR archives with USTAR header format - [`40b1aad`](https://github.com/adamhathcock/sharpcompress/commit/40b1aadeb268c543f2bcca88612c4c5552c8a5fd) Reformatted modified files with csharpier ### 📊 Changes **4 files changed** (+154 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Common/Tar/Headers/TarHeader.cs` (+131 -2) ➕ `src/SharpCompress/Common/Tar/Headers/TarHeaderWriteFormat.cs` (+7 -0) 📝 `src/SharpCompress/Writers/Tar/TarWriter.cs` (+3 -1) 📝 `src/SharpCompress/Writers/Tar/TarWriterOptions.cs` (+13 -2) </details> ### 📄 Description **Changes Summary** - Adds an option when creating a TarWriter to write the TAR headers using the USTAR format - Change is implemented by adding an enum property to TarWriterOptions - Does not change default behavior, unless manually specified when creating a TarWriter object via the TarWriterOptions, will use the existing modern GNU TAR header **Issues** - Perhaps, that I did not add any unit test for validating the USTAR headers. They should be fine since I have been using these changes for almost a year with no issue... **Context** Some time last year when I was using SharpCompress for a game mod manager, I ran into an issue where tar.bz2 files compressed with SharpCompressed were incompatible with some source ports of that game that would only accept the old USTAR format. I didn't think of making a pull request at the time as it seems like a very niche thing, but now I'm thinking someone else might find it useful too. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:20:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1489