Skip to content

fix: preserve Unix file modes when extracting JRE zip on macOS/Windows#466

Merged
shannah merged 2 commits into
masterfrom
claude/github-issue-465-stq2pe
Jul 4, 2026
Merged

fix: preserve Unix file modes when extracting JRE zip on macOS/Windows#466
shannah merged 2 commits into
masterfrom
claude/github-issue-465-stq2pe

Conversation

@shannah

@shannah shannah commented Jul 2, 2026

Copy link
Copy Markdown
Owner

extractZip wrote every entry with fs.createWriteStream and no mode,
dropping the execute bit on all JRE binaries except bin/java (which was
special-cased via chmodSync). This left lib/jspawnhelper non-executable,
so any launched app that spawned a child process failed with
'posix_spawn failed, error: 0'.

Read the Unix mode from the high 16 bits of externalFileAttributes and
apply it via createWriteStream's mode option plus an explicit chmodSync
(to bypass umask). Fixes #465

claude added 2 commits July 2, 2026 11:39
extractZip wrote every entry with fs.createWriteStream and no mode,
dropping the execute bit on all JRE binaries except bin/java (which was
special-cased via chmodSync). This left lib/jspawnhelper non-executable,
so any launched app that spawned a child process failed with
'posix_spawn failed, error: 0'.

Read the Unix mode from the high 16 bits of externalFileAttributes and
apply it via createWriteStream's mode option plus an explicit chmodSync
(to bypass umask). Fixes #465
Adds a Node integration test that lifts the real extractZip function out
of the generated jdeploy.js launcher and verifies it preserves Unix
execute bits when unpacking a JRE .zip (issue #465). Guards against a
regression where lib/jspawnhelper and other JRE binaries lose their
execute bit, breaking child-process spawning on macOS/Windows with
'posix_spawn failed, error: 0'.

The test builds a mode-preserving zip via the zip CLI, extracts it, and
asserts execute bits survive. Skipped on Windows (no Unix execute bit)
and when node/zip are unavailable. Wired into tests/test.sh.
@shannah
shannah merged commit a69872e into master Jul 4, 2026
19 checks passed
@shannah
shannah deleted the claude/github-issue-465-stq2pe branch July 4, 2026 13:22
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.

extractZip drops Unix execute bits on macOS/Windows JRE provisioning, breaking child-process spawning (posix_spawn failed, error: 0)

2 participants