You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ZipFile.ExtractToDirectory causes faulty permissions with pinned files #94465
When unpacking certain ZIP files on Linux that were packed on Windows and had the "pinned" attribute set (example file), ZipFile.ExtractToDirectory will cause the file to only have execute permissions (------x---).
Reproduction Steps
Pick any file
Set the "pinned" attribute through cmd: attrib +p filename
Pack as a ZIP file using 7zip (packing through Windows does not preserve the "pinned" attribute)
Unpack the file on Linux (or in a WSL owned folder like /tmp) using the following code:
Activity
gwell commentedon Nov 9, 2023
Also seeing this problem on Android when using
ZipFileExtensions.ExtractToFile(ZipArchiveEntry, String).BaerMitUmlaut commentedon Nov 14, 2023
The fix looks fairly easy:
_versionMadeByPlatformfield needs a public getter property:https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs#L22
https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs#L86
I tried making a fix but was so far unable to get the tools completely running including a new test file, might try again later.
carlossanlop commentedon Dec 6, 2023
@BaerMitUmlaut thanks for trying to get a fix.
Where were you blocked? Can we help unblock you?
I wonder if this issue is related to reparse points not being fully supported: https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-points
At least one of the reparse points indicates that a file is from OneDrive.
@dotnet/area-system-io have you folks worked with these files lately?
jozkee commentedon Dec 16, 2023
No, not really. But seems like P also means Sparse in older Windows versions https://superuser.com/questions/44812/windows-explorers-file-attribute-column-values/982721#982721.
Are all other Windows attributes ignored when unzipping in Linux?
BaerMitUmlaut commentedon Dec 16, 2023
I don't know, but there might be more that influence it. This one was just the one I found in the wild on a production system.
alinpahontu2912 commentedon Oct 21, 2025
Hey @BaerMitUmlaut, do you have any thoughts about the proposed api?
BaerMitUmlaut commentedon Oct 21, 2025
Looks good to me! I also checked your PR and I think that should fix the problem.
Fix zip unix permissions (#130304)