[PR #904] Provide access to extended attributes for 7-zip #1330

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

Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/904

State: closed
Merged: Yes


Some 7-zip archives have extended attributes to store Unix permissions. This caused problems in the past so the extended attributes were stripped when reading. However, this information can be useful or even critical in some cases, such as when extracting Linux/macOS prebuilt binaries for developing with Qt. These archives have execute permissions set for some files, and some of the files are intended to be created as symbolic links.

This PR provides access to the original full attributes via a new property in SevenZipEntry. The other changes were just small cleanups. Specifically, as I looked at AttribDefined/SetAttrib and wondered if there should be extended versions of these, I saw that these are properties in an internal class an nothing is ever referencing them. I also noticed CrcDefined had only one reference, and around where it was used showed an IDE warning that went away by using HasValue instead, so I thought it would be better to remove it.

image

With this new ExtendedAttrib property, I was able to write an extraction routine that allows the Qt 7-zip archives to be extracted in a fully working state.

**Original Pull Request:** https://github.com/adamhathcock/sharpcompress/pull/904 **State:** closed **Merged:** Yes --- Some 7-zip archives have extended attributes to store Unix permissions. This caused problems in the past so the extended attributes [were stripped](https://github.com/adamhathcock/sharpcompress/pull/153) when reading. However, this information can be useful or even critical in some cases, such as when extracting Linux/macOS prebuilt binaries for developing with Qt. These archives have execute permissions set for some files, and some of the files are intended to be created as symbolic links. This PR provides access to the original full attributes via a new property in `SevenZipEntry`. The other changes were just small cleanups. Specifically, as I looked at `AttribDefined`/`SetAttrib` and wondered if there should be extended versions of these, I saw that these are properties in an internal class an nothing is ever referencing them. I also noticed `CrcDefined` had only one reference, and around where it was used showed an IDE warning that went away by using `HasValue` instead, so I thought it would be better to remove it. <img width="528" alt="image" src="https://github.com/user-attachments/assets/196d2c41-cf95-4012-8fe4-e0ef02d9e1f3" /> With this new `ExtendedAttrib` property, I was able to write an [extraction routine](https://github.com/jdpurcell/naqt/blob/f27123442c51a83bfdb57ab94afcbf79dd28f61a/Helpers/General.cs#L68) that allows the Qt 7-zip archives to be extracted in a fully working state.
claunia added the pull-request label 2026-01-29 22:20:01 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1330