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
I'm using ZipFile.jl to unzip some files on a Linux system. Is it possible to preserve the permissions of the original files?
I can't find permissions in ZipFile.ReadableFile and therefore when writing the files I don't know which files need only read/write permissions and which additional execute permissions.
I guess one would need to add something to ZipFile.ReadableFile and get the mode from zlib. But I'm note sure if zlib offers a function to do that.
How to reproduce
Create a zip file
$ mkdir myZip
$ touch myZip/script.sh
$ chmod +rwx myZip/script.sh
$ ls -la myZip/script.sh
-rwxrwxr-x 1 username groupname 0 Aug 1 16:33 myZip/script.sh
$ zip myZip -r
$ zip -r myZip.zip myZip/
unzip preserves permissions
$ unzip myZip.zip -d unzipped/
$ ls -la unzipped/myZip/script.sh
-rwxrwxr-x 1 username groupname 0 Aug 1 16:33 unzipped/myZip/script.sh
Where could I find file permissions
julia>using ZipFile
julia> archive = ZipFile.Reader("myZip.zip")
ZipFile.Reader forIOStream(<file myZip.zip>) containing 2 files:
uncompressedsize method mtime name
----------------------------------------------0 Store 2022-08-0116-33 myZip/0 Store 2022-08-0116-33 myZip/script.sh
julia> archive.files[2]
ZipFile.ReadableFile(name=myZip/script.sh, method=Store, uncompresssedsize=0, compressedsize=0, mtime=1.659364424e9)
The text was updated successfully, but these errors were encountered:
Unfortunately, the official zip file spec doesn't directly mention a cross-platform way to specify a file is executable, so this might be tricky to do. Zip files contain a 32-bit external file attributes field for each file, but this field differs for each OS.
Hey,
I'm using ZipFile.jl to unzip some files on a Linux system. Is it possible to preserve the permissions of the original files?
I can't find permissions in
ZipFile.ReadableFile
and therefore when writing the files I don't know which files need only read/write permissions and which additional execute permissions.I guess one would need to add something to ZipFile.ReadableFile and get the mode from zlib. But I'm note sure if zlib offers a function to do that.
How to reproduce
Create a zip file
unzip
preserves permissionsWhere could I find file permissions
The text was updated successfully, but these errors were encountered: