Skip to content

Fix Mac checkout system path wiring - #319

Open
CptPanko wants to merge 4 commits into
omacom:quattrofrom
CptPanko:fix/mac-system-path-wiring
Open

CptPanko wants to merge 4 commits into
omacom:quattrofrom
CptPanko:fix/mac-system-path-wiring

Conversation

@CptPanko

@CptPanko CptPanko commented Sep 1, 2026

Copy link
Copy Markdown

Summary

  • Add default/system-paths.tsv as the declared set of fixed runtime defaults that Apple Silicon checkout upgrades must mirror.
  • Validate the complete 19-row contract, its digest, and every resolved source before privileged writes; fail closed on malformed paths, symlink escapes, destination directories, and partial write failures.
  • Link systemd user units and drop-ins into the checkout, while copying regular configuration files. The zram-generator drop-in is always installed as a real mode-0644 file.
  • Make package-coverage tests consume the same manifest, including the app.slice drop-in and the fontconfig/notifier aliases.

Testing

  • New Mac system-path integration test: 37 assertions passed.
  • Existing Mac upgrade test: 12 assertions passed.
  • aarch64 package test: 9 assertions passed.
  • Command metadata: 454 commands passed; parser-aware syntax: 457 files, 0 failures.
  • ShellCheck, focused shfmt, diff hygiene, conflict-marker, secret, and attribution scans passed.
  • Full Ubuntu 24.04 ARM64 suite: the final branch and untouched base have the identical 12-file / 8-assertion failure census; the branch runs 234 test files versus 233 on base, with the new test passing.

Fixes #310
Fixes #311

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The design here is good. Declaring the wiring in default/system-paths.tsv is a real improvement over ad-hoc install lines, the -T flags on install/ln and the switch to printf %q are worthwhile hardening, and the zram special case is the best thing in the PR — forcing that one row to be a copy rather than a link, because zram-generator runs as root at early boot before $HOME exists, is exactly right and shows the policy was thought through rather than applied uniformly.

bug: the hardcoded manifest digest isn't covered by any test, and it will break in the field.

local expected_manifest_sha256="a8fd68dfc45eddb3160db475874265e573b6cf0333f1e75f9fec840504144f05"
local expected_rows=19

I verified both match the committed manifest today. But upgrade-to-quattro-mac-system-paths-test.sh only asserts the row count (line 109) — nothing tests the digest. So any manifest edit that preserves the row count (fixing a destination typo, repointing a source) ships with green CI and then fails on a user's machine mid-upgrade with The system path manifest does not match the canonical fixed-path contract. That's the worst possible place to find out.

And the threat model behind it doesn't hold. The comment justifies the digest as protecting a privileged write path because "the Mac checkout is user-owned by design" — but bin/omarchy-upgrade-to-quattro-mac, the file carrying the expected hash, is in that same user-owned checkout. Anyone who can edit the .tsv can edit the .sh. The digest buys no security and guarantees a future breakage.

I'd drop expected_manifest_sha256 and the expected_rows pin, and keep the per-row validation — canonical-path checks, symlink-escape checks, duplicate-destination detection, the policy whitelist. That part does real work and doesn't go stale.

suggestion: the scope expansion deserves a sentence in the summary. The base script wrote 5 system paths; the manifest declares 19. "The declared set of fixed runtime defaults that Apple Silicon checkout upgrades must mirror" reads like documenting existing behaviour, but it's a 4x expansion.

I checked ownership on an M2 Max: all 19 destinations belong to omarchy-settings 4.0.1-2, so the upgrade replaces package-owned files with copies and symlinks into $HOME, and the next pacman -Syu of omarchy-settings silently reverts them. To be fair the base already does this — /etc/profile.d/omarchy.sh, default/uwsm/env.d/10-omarchy and default/environment.d/10-omarchy-fcitx.conf are all omarchy-settings-owned today — so this widens a pattern the project already committed to rather than inventing one. Worth saying out loud though, because extending it to systemd units means a pacman revert now changes behaviour rather than just config.

nit: sudo install -d -m755 "$(dirname -- "$destination")" runs against existing system directories and resets their modes as a side effect.

nit: load_system_path_manifest is called twice — once from validate_quattro_tree, once from wire_system_paths. Validating before the first sudo is the right instinct; the second call is redundant since the arrays are still populated.

Drop the digest and this is close.

@malik-na

malik-na commented Sep 9, 2026

Copy link
Copy Markdown
Member

Please drop the hardcoded manifest digest and row count. They add no trust boundary because the script lives in the same user-owned checkout, and a legitimate manifest edit will otherwise break upgrades; keep the per-row validation.

@malik-na

Copy link
Copy Markdown
Member

Found three blockers:

  • The hardcoded manifest digest rejects legitimate manifest changes in a selected ref.
  • Three mode-0644 commands are linked into /usr/bin and remain unexecutable.
  • Interrupted direct writes can leave existing system config truncated.

Needs work: make manifest validation ref-aware, require or repair executable command modes, and publish system files through same-filesystem temporary files with atomic replacement.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defer Parked. Needs a decision, or may die with the fork. Do not close or port yet. lvl 0 Core userspace: display, audio, video, graphics, memory, storage, battery, keyboard, network, BT. US

Projects

None yet

4 participants