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 }}
This repository has been archived by the owner on May 15, 2024. It is now read-only.
I noticed that when extracting certain zip files (as I later saw zip files with entries with potentially invalid "external file attributes") I was getting an exception:
System.ArgumentException: Invalid File or Directory attributes value. (Parameter 'Attributes')
at System.IO.FileStatus.SetAttributes(string path, FileAttributes attributes)
at System.IO.FileSystem.SetAttributes(string fullPath, FileAttributes attributes)
at Ionic.Zip.ZipEntry.MoveFileInPlace(bool fileExistsBeforeExtraction, string targetFileName, string tmpPath, bool checkLaterForResetDirTimes)
..
The issue roots in the following call which will happen at the end of zip extraction process:
I looked into it and saw that i tried to extract ZipEntry with Attribute property value: 0x81000000 which obviously wouldn't work here as the System.IO.FileAttributes doesn't even have such a bit flag defined.
For me, the strange thing about it is that the same extraction with the same data previously ran on a Win system without any problems, whereas now I use Linux on amd64 arch. Hence, I think the BCL for System.IO.FileStatus behaves differently in the corresponding runtime version between these operating systems, in the sense that the flag enum is validated on Unix-based systems, while invalid values being probably ignored on Win.
However, I think it doesn't matter if the FileAttributes are invalid or even if the BCL there has an inconsistency, in my opinion it should actually never throw in this place while setting file attributes. If they were invalid, I would assume that the library is simply using default values for the attributes or even not setting them at all. Eventually, I think this approach will be better, especially considering that other zip libraries ignore setting the file attributes anyway.
Add.: Temporary workaround or even to-go solution for this issue will be to only set ZipEntry Attributes property to valid FileAttributes with valid bit flags specified in the enum otherwise setting the prop to FileAttributes.None.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version: DotNetZip 1.16.0
I noticed that when extracting certain zip files (as I later saw zip files with entries with potentially invalid "external file attributes") I was getting an exception:
The issue roots in the following call which will happen at the end of zip extraction process:
DotNetZip.Semverd/src/Zip.Shared/ZipEntry.Extract.cs
Line 903 in 42a096d
I looked into it and saw that i tried to extract ZipEntry with
Attribute
property value:0x81000000
which obviously wouldn't work here as theSystem.IO.FileAttributes
doesn't even have such a bit flag defined.For me, the strange thing about it is that the same extraction with the same data previously ran on a Win system without any problems, whereas now I use Linux on amd64 arch. Hence, I think the BCL for System.IO.FileStatus behaves differently in the corresponding runtime version between these operating systems, in the sense that the flag enum is validated on Unix-based systems, while invalid values being probably ignored on Win.
However, I think it doesn't matter if the FileAttributes are invalid or even if the BCL there has an inconsistency, in my opinion it should actually never throw in this place while setting file attributes. If they were invalid, I would assume that the library is simply using default values for the attributes or even not setting them at all. Eventually, I think this approach will be better, especially considering that other zip libraries ignore setting the file attributes anyway.
Add.: Temporary workaround or even to-go solution for this issue will be to only set ZipEntry
Attributes
property to valid FileAttributes with valid bit flags specified in the enum otherwise setting the prop toFileAttributes.None
.The text was updated successfully, but these errors were encountered: