Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unzipping an SSZipArchive zip file loses executable permissions #689

Open
andalman opened this issue Oct 17, 2023 · 0 comments
Open

Unzipping an SSZipArchive zip file loses executable permissions #689

andalman opened this issue Oct 17, 2023 · 0 comments

Comments

@andalman
Copy link

Steps to reproduce

  1. Create a simple executable shell script
  2. Zip it up using SSZipArchive
  3. Unzip the archive by double-clicking it in the Finder

Expected behavior

You should be able to run the simple executable shell script

Actual behavior

You cannot run the shell script: it does not have executable permissions

Version of ZipArchive

2.5.5

Environmental information

I’m running this on macOS Ventura 13.6

Additional information

I’ve attached an Xcode project that illustrates the issue. If you run it, two zip archives will be created in ~/Desktop:
archive-zipUnix.zip
archive-ZipArchive.zip

The archive with the “zipUnix” suffix is created by running the builtin macOS command line zip to create the zip file. Double-clicking in the Finder will create a “hello.sh” script that has executable permissions and can be run.

The archive with the “ZipArchive” suffix is created using SSZipArchive. Double-clicking in the Finder will create a “hello.sh” file without executable permissions.

If you run zipinfo on each, you’ll see the following:

[host] Desktop $ zipinfo -l archive-zipUnix.zip 
Archive:  archive-zipUnix.zip
Zip file size: 254 bytes, number of entries: 1
-rwxr-xr-x  3.0 unx       97 tx       88 defN 23-Oct-16 16:37 hello.sh
1 file, 97 bytes uncompressed, 88 bytes compressed:  9.3%

[host] Desktop $ zipinfo -l archive-ZipArchive.zip 
Archive:  archive-ZipArchive.zip
Zip file size: 266 bytes, number of entries: 1
-rwxr-xr-x  0.0 osx       97 bX       88 defN 23-Oct-16 16:37 hello.sh
1 file, 97 bytes uncompressed, 88 bytes compressed:  9.3%

Two obvious differences standout: the version for “hello.sh” in the archive created by zip is 3.0 and maintains it was created on “unx” (unix), while the version in the archive created by SSZipArchive is 0.0 (!) and maintains it was created on “osx”.

If I hardcode the “version_madeby” to be UNIX in my personal build of SSZipArchive, everything works as I’d expect. I’m not sure that’s the best answer however.

zipper.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant