fix: preserve Unix file modes when extracting JRE zip on macOS/Windows#466
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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