Skip to content

Conversation

@ianic
Copy link
Contributor

@ianic ianic commented Apr 5, 2024

Based on file content. Detects elf magic header or shebang line.

Executable bit is ignored in hash calculation, as it was before this. So packages hashes are not changed.

Reference: #17463 (comment)

Fixes: #17463

Test is here.

Based on file content. Detects elf magic header or shebang line.

Executable bit is ignored in hash calculation, as it was before this. So
packages hashes are not changed.

Reference:
ziglang#17463 (comment)

Fixes: 17463

Test is here:
https://github.com/ianic/zig-fetch-test/blob/7c4600d7bb263f9b72fe3d0b70071f42be89e25c/src/main.zig#L307
(if ziglang#19500 got accepted I'll move this test to the Fetch.zig)
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

}

// Detects executable header: ELF magic header or shebang line.
const FileHeader = struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a delightful little abstraction. I love it!

@andrewrk andrewrk merged commit 34bb670 into ziglang:master Apr 6, 2024
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

Successfully merging this pull request may close these issues.

make packages fetched by zig set the executable bit based on ELF header and shebang line

2 participants