fix: record a rewritten root mode in the js implementation's Bom - #442
Merged
Conversation
openPermissionsForSquirrelMac's transform rewrites the payload root to 0775, and the cpio payload picks that up, but the Bom writer zeroes the root's mode unconditionally to match pkgbuild, so the option never reached the Bom. The native path ends up with 40775 there because it rebuilds the Bom from a rewritten lsbom listing. Track whether a transform rewrote an entry's mode and only apply the pkgbuild zero to a root nothing touched. Untransformed output is unchanged.
MarshallOfSound
force-pushed
the
sam/js-pkg-root-permissions
branch
from
August 10, 2026 21:22
917ffcb to
3a8de0c
Compare
erickzhao
approved these changes
Aug 17, 2026
|
🎉 This PR is included in version 2.6.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
openPermissionsForSquirrelMacon the js implementation rewrites the payload root to0775and that lands in the cpio payload, but the Bom writer zeroes the root's mode unconditionally (which is right for parity withpkgbuild, that is what it records), so the option never made it into the Bom. The native path gets40775there becausesetPermissionOnBomrewrites the lsbom listing andmkbomwrites whatever it was given.Found this diffing the two implementations on a real app in the desktop repo: the Bom was identical for every payload path except
., which was0on js and40775on native.Fix is to track whether
transformEntryrewrote an entry's mode and only apply the pkgbuild zero to a root nothing touched. Untransformed output is byte for byte what it was, the existing parity suite still covers that.Building the same fixture both ways with the option on, before and after:
40775040775808080lsbomoutput.lineThe one remaining difference in the raw records is the "architecture" field,
mkbomstamps3on every entry wherepkgbuildwrites1for the root and15for everything else. That is an mkbom artifact rather than anything to do with the rewrite so the js side keeps the pkgbuild values (lsbom doesn't surface it either way).Tests: a unit test on the writer for the rewritten root (plus one proving an ownership-only transform still leaves the root mode at 0), the existing flat spec now asserts the Bom root, and on macOS a new case builds native and js with the option on and requires identical
lsbomoutput. All three new assertions are red on main.