API Proposal
Expose the enum ZipVersionMadeByPlatform, containing reference values for the system an entry was created on.
- internal enum ZipVersionMadeByPlatform : byte
+ public enum ZipVersionMadeByPlatform : byte
{
Windows = 0,
Unix = 3
}
Usage
using var archive = ZipFile.OpenRead("archive.zip");
foreach (var entry in archive.Entries)
{
Console.WriteLine($"{entry.FullName} Pltform Bit: {entry.VersionMadeByPlatform}");
}
- Internally, _versionMadeBy is already in use, but as a private property
- No breaking changes, since property is read-only.
(updated by @alinpahontu2912 )
Initial user-reported issue
Description
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:
public class Program
{
private static void Main(string[] args)
{
ZipFile.ExtractToDirectory(args[0], args[0].Replace(".zip", ""), Encoding.UTF8);
}
}
- Verify the files permissions using
ls -l:
$ ls -l /tmp/dotnet
total 28
------x--- 1 foobar foobar 24783 Nov 7 13:41 dotnet.jpg
Expected behavior
The permissions should be -rw-r--r--, like any file that did not have the "pinned" attribute set when it was packed.
Actual behavior
Read and write permissions are missing and an excutable permission is set (------x---).
Regression?
No response
Known Workarounds
Repacking the ZIP through the Windows packing tools or unsetting the "pinned" flag fixes the problem but cannot be done through code.
Configuration
- .NET 6.0
- Windows 10 / Ubuntu 20.04 in WSL
API Proposal
Expose the enum ZipVersionMadeByPlatform, containing reference values for the system an entry was created on.
Usage
(updated by @alinpahontu2912 )
Initial user-reported issue
Description
When unpacking certain ZIP files on Linux that were packed on Windows and had the "pinned" attribute set (example file),
ZipFile.ExtractToDirectorywill cause the file to only have execute permissions (------x---).Reproduction Steps
attrib +p filename/tmp) using the following code:ls -l:Expected behavior
The permissions should be
-rw-r--r--, like any file that did not have the "pinned" attribute set when it was packed.Actual behavior
Read and write permissions are missing and an excutable permission is set (
------x---).Regression?
No response
Known Workarounds
Repacking the ZIP through the Windows packing tools or unsetting the "pinned" flag fixes the problem but cannot be done through code.
Configuration