ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
33.68k stars 2.47k forks source link

files extracted from zips are missing execute permissions #21044

Open travisstaloch opened 1 month ago

travisstaloch commented 1 month ago

Zig Version

0.14.0-dev.875+ebd0c6ffd

Steps to Reproduce and Observed Behavior

This issue was reported here. That project uses the package manager to download zips from https://github.com/protocolbuffers/protobuf/releases/. When I unzip one of the zip files manually, the permissions look fine.

-r-xr-xr-x 1 17M May 22 11:45 protoc

But with the package manager I guess they turn into the following as reported in the issue above.

-rw-r--r-- protoc

I asked @marler8997 about this and he said

I don't think I implemented the extension for unix file permissions.

So it sounds like this just hasn't been implemented yet. zip support was added in #19729.

Expected Behavior

Execute permissions should be preserved.

andrewrk commented 1 month ago

To be clear, the expected behavior from the package manager is to ignore permissions from the zip file and set the execute bit based on ELF header and shebang line alone (see #17463). I set the milestone to 0.14.0 in case that is not implemented correctly.

As for implementing extensions in the standard library, that's a separate issue.

owenbrooks commented 1 week ago

For MacOS, that zig-protobuf project downloads the protoc binary in Mach-O file format, so it doesn't get set to executable. Is it worth adding Mach-O header detection to the isExecutable check in addition to ELF and shebang?