diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-17 14:44:04 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-17 14:44:04 -0500 |
| commit | 7cd739234e9c83be9c82200a918281780f38fc9a (patch) | |
| tree | fc6875371c213e7555781501d7349b33ca1f2bd4 | |
| parent | 663cec6520a72680609c0d803494fb0bde4ce765 (diff) | |
| download | archsetup-7cd739234e9c83be9c82200a918281780f38fc9a.tar.gz archsetup-7cd739234e9c83be9c82200a918281780f38fc9a.zip | |
fix(archsetup): handle stow-created ~/.emacs.d when cloning dotemacs
The 2026-05-16 VM run surfaced `setting up emacs configuration files
(error code: 128)` with `fatal: not a git repository`. Root cause:
`dotfiles/common/.emacs.d/calendar-sync.local.el` lives in the stow
tree, so by the time the dotemacs clone step runs, `~/.emacs.d/`
already exists with a stowed symlink inside. The previous two-branch
check `[ -d "$emacs_dir" ]` then took the `git pull` path and failed
because the dir isn't a git checkout.
I replaced the check with three branches:
- `.git` exists → `git pull --recurse-submodules` (the existing
upgrade path).
- Dir missing or empty → `git clone --recurse-submodules` (the fresh
install path).
- Dir exists with content but no `.git` (the stow case, today's bug)
→ `git init` + `remote add origin` + `fetch --recurse-submodules` +
`checkout -B main origin/main` + `submodule update --init
--recursive`. This pulls the tree in on top of the stowed file
without losing it.
The one-line `[ -d ]` → `[ -d .git ]` fix wouldn't have been enough on
its own: the clone branch would still fail because `git clone` refuses
a non-empty target.
`bash -n archsetup` is clean. The VM test run that surfaced the bug
exercised the old two-branch path. The new third branch wants a fresh
`make test` to verify before this lands on a real machine.
todo.org picks up two things this commit touches. The stale
gitrepos.sh reference under "Remove/template personal info from
scripts" comes out. A new sub-TODO under `[#B] Fix install errors`
expands the existing tidaler item: the same "AUR exit 0 logged as
error" pattern now hits six packages instead of one (tidaler,
mkinitcpio-firmware, speedtest-go-bin, rar, masterpdfeditor,
zsh-fast-syntax-highlighting-git). The recommendation points at
`aur_install` and the error-summary aggregator as trace targets.
| -rwxr-xr-x | archsetup | 14 | ||||
| -rw-r--r-- | todo.org | 10 |
2 files changed, 21 insertions, 3 deletions
@@ -1929,12 +1929,22 @@ developer_workstation() { action="setting up emacs configuration files" && display "task" "$action" emacs_dir="/home/$username/.emacs.d" - if [ -d "$emacs_dir" ]; then + if [ -d "$emacs_dir/.git" ]; then (cd "$emacs_dir" && sudo -u "$username" git pull --recurse-submodules >> "$logfile" 2>&1) || \ error_warn "$action" "$?" - else + elif [ ! -d "$emacs_dir" ] || [ -z "$(ls -A "$emacs_dir" 2>/dev/null)" ]; then (sudo -u "$username" git clone --recurse-submodules "$dotemacs_repo" "$emacs_dir" >> \ "$logfile" 2>&1) || error_warn "$action" "$?" + else + # Stow may have created $emacs_dir to land local-only files like + # calendar-sync.local.el before this step runs. git clone refuses a + # non-empty target, so initialize in place and pull the tree on top. + (sudo -u "$username" git -C "$emacs_dir" init -q && \ + sudo -u "$username" git -C "$emacs_dir" remote add origin "$dotemacs_repo" && \ + sudo -u "$username" git -C "$emacs_dir" fetch --recurse-submodules origin && \ + sudo -u "$username" git -C "$emacs_dir" checkout -B main origin/main && \ + sudo -u "$username" git -C "$emacs_dir" submodule update --init --recursive) \ + >> "$logfile" 2>&1 || error_warn "$action" "$?" fi action="Android Utilities" && display "subtitle" "$action" @@ -37,7 +37,7 @@ Remove personal info, credentials, and code quality issues before publishing. *** 2026-05-11 Mon @ 13:01:29 -0500 AI Response: Open-source-prep source audit Checked each subtask below against the source / git state. Bottom line: almost nothing is fully done. =LICENSE= and =README.md= were added this session (see those subtasks); the rest still stands. - *Remove credentials and secrets from dotfiles* — NOT DONE. All five named files still tracked: =dotfiles/common/.config/.tidal-dl.token.json=, =.config/calibre/smtp.py.json=, =.config/transmission/settings.json=, =.msmtprc=, =.mbsyncrc=. =.gitignore= lists none of them; no =.example= templates exist. -- *Remove/template personal info from scripts* — PARTIALLY DONE. Repo URLs ARE config-driven (=archsetup:141-146= use =${dwm_repo:-https://git.cjennings.net/...}=, documented in =archsetup.conf.example=). Still personal: =archsetup:2-3= (email/website header), =init:8,21= (=root:welcome=), =scripts/post-install.sh:17-56= (personal repos), =scripts/gitrepos.sh= (personal remotes). +- *Remove/template personal info from scripts* — PARTIALLY DONE. Repo URLs ARE config-driven (=archsetup:141-146= use =${dwm_repo:-https://git.cjennings.net/...}=, documented in =archsetup.conf.example=). Still personal: =archsetup:2-3= (email/website header), =init:8,21= (=root:welcome=), =scripts/post-install.sh:17-56= (personal repos). - *Remove/template personal info from dotfiles* — NOT DONE. =.gitconfig= has =c@cjennings.net=, =name = Craig Jennings=, =github user = cjennings=, =safe.directory= and employer creds; =.config/mpd/musicpd.conf= + =mpd.conf= still use =~cjennings/= / =/home/cjennings/= paths; =.ssh/config= has personal/employer hosts; =.config/yt-dlp/config:2= has =c@cjennings.net=; =hyprland.conf:3= has personal attribution. - *Scrub git history of secrets* — NOT DONE. 275 commits; history not fresh, no filter-repo evidence. - *Remove device-specific configuration* — NOT DONE. =archsetup:1486-1493= still creates the Logitech BRIO udev rule unconditionally; no config flag. @@ -230,6 +230,14 @@ Errors logged during the VM install. Status as of the 2026-05-11 18:36 run (=tes - tidaler (AUR) — logged in the error summary with exit code 0 (odd; logging quirk or transient AUR build noise?). Also seen in the 18:36 run's log-diff (post-install systemd noise, probably VM-environment): =pam_systemd … CreateSession failed= / =logind: Failed to start session scope … Permission denied=, and =Failed to start Proton VPN Daemon= (no VPN config in the test VM). +*** TODO [#B] AUR exit-0 logged as error — pattern expanded beyond tidaler +The =tidaler= bullet above noted "logged in the error summary with exit code 0". The 2026-05-16 07:40 VM run (=test-results/20260516-074025/=) shows the same pattern now affecting 6 AUR packages: =tidaler=, =mkinitcpio-firmware=, =speedtest-go-bin=, =rar=, =masterpdfeditor=, =zsh-fast-syntax-highlighting-git=. Every entry has =error code: 0= — the installs succeeded (the packages appear in =archsetup-installed-packages.txt=) but =aur_install= or its caller is mis-categorizing them as errors. The bug isn't AUR build noise (transient) — it's a deterministic logging-classification bug in the install path. + +Recommendation: trace =aur_install= and the error-summary aggregator in =archsetup=. Likely candidates: (a) the exit-code capture grabs a non-final command's status (e.g., a =makepkg=/=yay= sub-step that exits 0 still triggers the error branch via an =||= chain whose left side returned non-zero earlier); (b) the summary's =error_warn= sink is keyed on a flag the calling code sets even when the wrapping command succeeds. Add a small log line at each =error_warn= invocation site showing both the wrapped command's actual exit and the captured value to triangulate. Real packages are installing — this is purely a noise issue, but the noise is now drowning out genuine failures in the error summary. + +*** 2026-05-16 Sat @ 09:00:41 -0500 AI Response: Surfaced the expanded AUR-exit-0 pattern +2026-05-16 07:40 VM run passed (52/0/5) with the same warning profile as the 2026-05-11 18:36 run. Error count went 7 → 13: 5 fixed/unchanged, +5 new AUR-exit-0 entries (broadens the existing tidaler item into the dedicated =[#B]= subtask above), +1 genuinely new error in =setting up emacs configuration files= (=git pull= ran in =~/.emacs.d= which existed from stow but had no =.git=). Patched =archsetup:1932-1945= with a three-branch check: clone if missing/empty, pull if =.git= exists, =git init=/=fetch=/=checkout= in place if the dir came from stow. + ** TODO [#C] Investigate the 2026-05-11 VM-test warnings The 18:36 =make test= run passed (52/0/5) but raised 5 validation warnings. Each is investigated below with a recommendation. Most look like headless-VM / QEMU-slirp false positives the test harness should skip rather than archsetup bugs — but a couple have a real archsetup angle worth checking. Source: =test-results/20260511-183643/test.log= (WARN lines) and =scripts/testing/lib/validation.sh=. |
