install.sh: la_put makes ~/Library/LaunchAgents and ~/Library/Logs before each Mac plist write (v12 red, D d436) #69

Closed
caoer115 wants to merge 0 commits from agent/8751a366-darwin-launchagents into main
Owner

v12 product red (D d436, both Macs): install.sh stopped at the ucc.cccd-start.plist write on a home with no ~/Library/LaunchAgents. Card: 13-16-ucc-rearchitecture/tasks/v12-darwin-launchagents.

Cause

a524e3f (legacy crossing) moved the follow tick into follow_timer(), which runs after the daemon section and returns early where ucc-follow is the host's own (G1). Its mkdir -p "$LA" "$HOME/Library/Logs" was the only one, so the daemon's start plist (:2459 at 3c5b53f) was written before any folder existed. In v11 (39737ee) the mkdir ran first.

Fix

la_put (install.sh:2354) makes ~/Library/LaunchAgents and ~/Library/Logs (where launchd opens the agent's log), then writes the plist. Both write sites use it: ucc.follow (:2384, any floor, where ucc wrote ucc-follow) and ucc.cccd-start (:2464, floors 3 and 4). The mkdir now comes with each write, so it holds on a first install, a reinstall and a crossing, whatever order the sections run in.

Rows (proved by D on this head; the release worker's proof D d437)

  • launchd-dirs-darwin on mac1: ucc stage --scripts then install.sh --floor 3 --release from the published set. It runs stage.new/install.sh :2354 (la_put) through :2464 (cccd-start), then :2384 (follow tick, called at :2476), then la_load on both plists.
  • launchd-dirs-darwin on mac2: install.sh --floor 3 --from <stage> --round, which runs the same lines from the clone's install.sh.
  • Before the install, either folder that exists is moved aside into ~/round-<rNN>/, so each launch runs on a home with neither. The row is scored right after the install, so it also scores when the install fails. pass = rc 0, both folders exist, and both plists are in LaunchAgents. fail gives the rc, what is missing, and the install's No such file or directory line. n = only when a folder could not be moved aside. (rounds/darwin.sh:171-196, manifest +2.)

Gates at 7162fc1

  • bash -n rc 0 on install.sh, ucc and rounds/darwin.sh, under bash 5.3.15 and 3.2.57.
  • lint-lcall.awk install.sh and lint-lockfd.awk ucc install.sh: clean, no lines.
  • Local check under bash 3.2.57 on a scratch home with no ~/Library. la_put taken from install.sh wrote both plists and made both folders. The row block taken from darwin.sh scored pass on a stub install that makes them, and fail (rc 1 plus the :2459 line) on the d436 output. A Linux host cannot run the darwin path itself; D proves it.

Step 2: darwin writes and launchctl calls read in 39737ee..3c5b53f

  • follow_timer (moved by a524e3f, G1-gated): the break described above. Fixed.
  • The ucc.cccd-start write: same position as in v11, but now the first write into $LA: the break. Fixed.
  • la_load / la_unload / la_still (launchctl bootstrap|bootout|print): bootstrap reads $LA/<label>.plist and runs only after la_put at both sites. Bootout and print need no file.
  • Floor < 3 on a Mac (:2471): bootout, then rm -f behind [ -e ]. No write.
  • XSET (:934): L0 copies the two plists where they exist (- where they don't). The put-back (xput) renames a copy back only into the folder it was taken from, and removes the run's plist for a - row. No write ahead of its folder.
  • Put-back step 3 (:1349-1350): bootout of the jobs this run loaded. No file needed.
  • Darwin reads added in the range: xown's lsof -d txt, the port census's lsof path, and exec -a in the put-back's old-daemon restart (works under bash 3.2.57). All reads; none needs a folder.
  • A different issue, not changed here: after a put-back, the old plists are back as files, but neither is loaded again (la_load is only at the two install sites). On a Mac where the crossing booted out an old ucc.cccd-start or ucc.follow, that job stays unloaded until the next login.

Do not merge from this seat; the leader merges after the Fable correctness and security reviews of install.sh.

v12 product red (D d436, both Macs): `install.sh` stopped at the `ucc.cccd-start.plist` write on a home with no `~/Library/LaunchAgents`. Card: `13-16-ucc-rearchitecture/tasks/v12-darwin-launchagents`. ## Cause `a524e3f` (legacy crossing) moved the follow tick into `follow_timer()`, which runs after the daemon section and returns early where `ucc-follow` is the host's own (G1). Its `mkdir -p "$LA" "$HOME/Library/Logs"` was the only one, so the daemon's start plist (`:2459` at `3c5b53f`) was written before any folder existed. In v11 (`39737ee`) the mkdir ran first. ## Fix `la_put` (`install.sh:2354`) makes `~/Library/LaunchAgents` and `~/Library/Logs` (where launchd opens the agent's log), then writes the plist. Both write sites use it: `ucc.follow` (`:2384`, any floor, where ucc wrote `ucc-follow`) and `ucc.cccd-start` (`:2464`, floors 3 and 4). The mkdir now comes with each write, so it holds on a first install, a reinstall and a crossing, whatever order the sections run in. ## Rows (proved by D on this head; the release worker's proof D d437) - `launchd-dirs-darwin` on **mac1**: `ucc stage --scripts` then `install.sh --floor 3 --release` from the published set. It runs `stage.new/install.sh` `:2354` (`la_put`) through `:2464` (cccd-start), then `:2384` (follow tick, called at `:2476`), then `la_load` on both plists. - `launchd-dirs-darwin` on **mac2**: `install.sh --floor 3 --from <stage> --round`, which runs the same lines from the clone's `install.sh`. - Before the install, either folder that exists is moved aside into `~/round-<rNN>/`, so each launch runs on a home with neither. The row is scored right after the install, so it also scores when the install fails. **pass** = rc 0, both folders exist, and both plists are in LaunchAgents. **fail** gives the rc, what is missing, and the install's `No such file or directory` line. **n** = only when a folder could not be moved aside. (`rounds/darwin.sh:171-196`, manifest +2.) ## Gates at 7162fc1 - `bash -n` rc 0 on `install.sh`, `ucc` and `rounds/darwin.sh`, under bash 5.3.15 and 3.2.57. - `lint-lcall.awk install.sh` and `lint-lockfd.awk ucc install.sh`: clean, no lines. - Local check under bash 3.2.57 on a scratch home with no `~/Library`. `la_put` taken from `install.sh` wrote both plists and made both folders. The row block taken from `darwin.sh` scored pass on a stub install that makes them, and fail (rc 1 plus the `:2459` line) on the d436 output. A Linux host cannot run the darwin path itself; D proves it. ## Step 2: darwin writes and launchctl calls read in `39737ee..3c5b53f` - `follow_timer` (moved by `a524e3f`, G1-gated): the break described above. Fixed. - The `ucc.cccd-start` write: same position as in v11, but now the first write into `$LA`: the break. Fixed. - `la_load` / `la_unload` / `la_still` (`launchctl bootstrap|bootout|print`): bootstrap reads `$LA/<label>.plist` and runs only after `la_put` at both sites. Bootout and print need no file. - Floor < 3 on a Mac (`:2471`): bootout, then `rm -f` behind `[ -e ]`. No write. - XSET (`:934`): L0 copies the two plists where they exist (`-` where they don't). The put-back (`xput`) renames a copy back only into the folder it was taken from, and removes the run's plist for a `-` row. No write ahead of its folder. - Put-back step 3 (`:1349-1350`): bootout of the jobs this run loaded. No file needed. - Darwin reads added in the range: `xown`'s `lsof -d txt`, the port census's `lsof` path, and `exec -a` in the put-back's old-daemon restart (works under bash 3.2.57). All reads; none needs a folder. - A different issue, not changed here: after a put-back, the old plists are back as files, but neither is loaded again (`la_load` is only at the two install sites). On a Mac where the crossing booted out an old `ucc.cccd-start` or `ucc.follow`, that job stays unloaded until the next login. Do not merge from this seat; the leader merges after the Fable correctness and security reviews of `install.sh`.
a524e3f moved the only mkdir of both folders into follow_timer, called after the daemon's start plist and skipped where ucc-follow is the host's own (G1), so on a home with no ~/Library/LaunchAgents (both D users) install.sh stopped at the ucc.cccd-start.plist write. la_put ties the mkdir to each plist write: ucc.cccd-start (floor 3 and 4) and ucc.follow (every floor), on a first install, a reinstall and a crossing.

Rows: launchd-dirs-darwin on mac1 (--release from the published set) and mac2 (from the stage), each on a home with neither folder (one standing is moved aside into the round folder), scored right after the install. CHANGELOG § v12: the row; install.sh 2517 → 2522 lines, the manifest 320 → 322.
Author
Owner

Merged to main as ee28a52 (pushed --no-ff merge, tree = reviewed head 7162fc1; Fable correctness and security: no findings; proof D d437 0 fails on both Macs; bash -n and both lints clean; zero round scopes on nyc-2 at push). Closing as merged.

Merged to main as ee28a52 (pushed --no-ff merge, tree = reviewed head 7162fc1; Fable correctness and security: no findings; proof D d437 0 fails on both Macs; bash -n and both lints clean; zero round scopes on nyc-2 at push). Closing as merged.
caoer115 closed this pull request 2026-10-24 18:44:04 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
caoer115/ucc!69
No description provided.