-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
files extracted from zips are missing execute permissions #21044
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
Comments
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. |
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? |
I opened a PR here: #21555 |
@fabioarnold I was excited about this change and tried it with Zig 0.14.0. However, it seems that I'm holding it wrong.
const duckdb_cli = b.lazyDependency("duckdb_cli_1_2_1", .{}) orelse return;
const cmd = Step.Run.create(b, "duckdb shell");
cmd.addFileArg(duckdb_cli.path("duckdb")); Gives me:
The binary is Mach-O:
But it wasn't made executable:
Expected outcome:
Any idea what the problem might be? |
Could this be an endianess problem?
This seems to match Update: This seems to be the root cause indeed. I wrote a small program that checks the result of https://github.com/ziglang/zig/blob/0.14.0/src/Package/Fetch.zig#L1849-L1853 on my M1 Pro. It won't be true unless I add another condition: (I find this strange given that |
This is because the point of the CIGAM constants is to detect when the endianness of the encoded file does not match the host endianness. See https://stackoverflow.com/a/44591490 So Fetch.zig should also check the CIGAM constants. |
@owenbrooks Yeah, thanks. Opened a new PR: #23193 |
Fetch: enhance Mach-O executable detection for modern Macs closes #21044
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
So it sounds like this just hasn't been implemented yet. zip support was added in #19729.
Expected Behavior
Execute permissions should be preserved.
The text was updated successfully, but these errors were encountered: