Skip to content

feat: add SquirrelMacEnableDirectContentsWrite install method behind flag#303

Closed
MarshallOfSound wants to merge 1 commit into
mainfrom
sam/patch-direct-contents-write
Closed

feat: add SquirrelMacEnableDirectContentsWrite install method behind flag#303
MarshallOfSound wants to merge 1 commit into
mainfrom
sam/patch-direct-contents-write

Conversation

@MarshallOfSound

@MarshallOfSound MarshallOfSound commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Upstreams feat_add_new_squirrel_mac_bundle_installation_method_behind_flag.patch. New end-to-end spec verifies the parent directory is untouched.

Note

Fixed a shadowing bug from the original patch in SQRLUpdater.m (BOOL launchPrivileged = !targetWritable declared a new local that was never used). Should be backported to Electron's patch.


Part of upstreaming electron/patches/squirrel.mac/ into this repo. First in a 6-PR chain (the rest share SQRLInstaller.m/SQRLUpdater.m/ShipIt-main.m).

@MarshallOfSound MarshallOfSound force-pushed the sam/patch-strict-codesign branch from c3f4d35 to dc06d59 Compare May 2, 2026 23:15
@MarshallOfSound MarshallOfSound force-pushed the sam/patch-direct-contents-write branch from beb8a21 to 4c38c41 Compare May 2, 2026 23:15
@MarshallOfSound MarshallOfSound force-pushed the sam/patch-strict-codesign branch from dc06d59 to 111fb1c Compare May 3, 2026 00:08
@MarshallOfSound MarshallOfSound force-pushed the sam/patch-direct-contents-write branch 2 times, most recently from 6469f67 to fa1d01a Compare May 3, 2026 00:09
@MarshallOfSound MarshallOfSound force-pushed the sam/patch-strict-codesign branch from 111fb1c to 85985e2 Compare May 3, 2026 00:09
…flag

[upstream] electron/patches/squirrel.mac/feat_add_new_squirrel_mac_bundle_installation_method_behind_flag.patch

When the user default is set, install by atomically renaming the
Contents/ folder rather than swapping the .app directory itself, so
the updating process only needs write access to its own bundle (not
the parent /Applications folder).

Fixes a variable-shadowing bug from the original patch where the
'ignore parent writability' branch in SQRLUpdater wrote to a new
local instead of the outer launchPrivileged.

Adds a spec that tags the .app dir with an xattr, runs an in-process
install with the flag enabled, and asserts the xattr survived.
@MarshallOfSound MarshallOfSound force-pushed the sam/patch-strict-codesign branch from 85985e2 to 8842e0b Compare May 3, 2026 09:00
@MarshallOfSound MarshallOfSound changed the base branch from sam/patch-strict-codesign to main May 3, 2026 09:00
@MarshallOfSound MarshallOfSound force-pushed the sam/patch-direct-contents-write branch from fa1d01a to b4ce0d2 Compare May 3, 2026 09:00
@MarshallOfSound MarshallOfSound enabled auto-merge (squash) May 3, 2026 09:02
@MarshallOfSound

Copy link
Copy Markdown
Collaborator Author

Folded into #312.

auto-merge was automatically disabled May 3, 2026 09:25

Pull request was closed

@MarshallOfSound MarshallOfSound deleted the sam/patch-direct-contents-write branch May 3, 2026 09:25
MarshallOfSound added a commit that referenced this pull request May 3, 2026
Upstreams the remaining `electron/patches/squirrel.mac/` patches into
this repo so Electron can eventually drop them. Six commits, **8 files,
+537/−51**, **63 → 74 tests**.

| Commit | Upstreams | Tests added |
|---|---|---|
| `feat: SquirrelMacEnableDirectContentsWrite` |
`feat_add_new_squirrel_mac_bundle_installation_method_behind_flag` |
parent-dir-untouched e2e |
| `fix: abort install if app running; resolve target path once` |
`fix_abort_installation_attempt_at_the_final_mile_if_the_app_is` +
`fix_resolve_target_bundle_path_once_at_start_of_install` |
symlink-target rejected, abort-if-running |
| `feat: ElectronSquirrelPreventDowngrades` |
`feat_add_ability_to_prevent_version_downgrades` |
`+isVersionAllowedForUpdate:from:` units |
| `refactor: harden ShipIt launch` |
`refactor_use_posix_spawn_instead_of_nstask…` +
`fix_trigger_shipit_mach_service_after_smjobsubmit…` +
`chore_turn_off_launchapplicationaturl_deprecation…` | (existing
remote-ShipIt spec exercises new path) |
| `refactor: non-deprecated NSKeyedArchiver` |
`refactor_use_non-deprecated_nskeyedarchiver_apis` |
`SQRLInstallerOwnedBundle` round-trip |
| `fix: prune orphaned staged updates` |
`fix_clean_up_orphaned_staged_updates_before_downloading_new_update` |
unit prune + e2e bounded-count; replaces `xit` |

Fixes #124. Fixes #196. Fixes #264.

> [!NOTE]
> Two adaptations should be backported to Electron's patches:
> - `SQRLUpdater.m`: `BOOL launchPrivileged = !targetWritable` in the
original `direct-contents-write` patch shadowed the outer var — it was a
dead store
> - `SQRLInstaller.m`: `runningApplicationsWithBundleIdentifier:` throws
on `nil`; guarded it

Replaces the stacked #303 / #304 / #305 / #306 / #307 / #309. #302
(strict codesign validation) stays separate — it touches only
`SQRLCodeSignature.m`.
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.

1 participant