You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cooldown and lock robustness in 50-git-backup.sh: a corrupt marker bypasses the throttle, and the marker is only written on success #258
Three robustness defects in hooks.d/after_save/50-git-backup.sh, all around the cooldown and lock. None is as serious as #253 or the silent stops filed alongside this; they are grouped because they share a file and a shape.
1. A corrupt cooldown marker silently bypasses the cooldown (:88-90)
LAST_MOD is unvalidated file content fed straight into $(( )). A truncated or garbage marker — a crash mid-write, a partially synced file — makes the arithmetic error out, leaves ELAPSED empty, and then [ "" -lt 900 ] errors too. The cooldown is skipped, and the full add/rm/commit runs on every save from then on, with nothing saying why.
The fix is the same two-line numeric guard #253's PR already had to add for its rejection counter:
case"$LAST_MOD"in''|*[!0-9]*) LAST_MOD=0 ;; esac
2. The cooldown marker is written only when the commit succeeds
So on a store where commits fail — see the sibling issue about :201 — the throttle never engages at all. The two defects compound: the store stops backing up and starts doing the full work on every single save, which is the opposite of what a cooldown is for. Neither is visible.
3. A narrow re-entrancy window on the flock path
The subshell's trap 'rm -f "$LOCK_FILE"' EXIT unlinks the lock file. If a second instance opens the file just before that rm, it locks an unlinked inode while a third instance creates a fresh one — two concurrent backups on the same store.
Lower confidence than the other two, and worth re-deriving before acting. The agent that found it checked the part that is fine — the lock lives on fd 9 and is correctly inherited by the background subshell — and argues the rm is simply unnecessary on the flock path. That is a small change, but concurrency changes deserve their own reproduction rather than a reading.
Provenance
All three found by the agent implementing #253's part 1 and reported rather than folded in. Items 1 and 2 verified independently against main (:88-90); item 3 is recorded as unverified, deliberately.
Activity
fix(git-backup): four ways the backup stopped and reported success
release: 0.12.3 — One bad byte
fix(dispatch): report a failing hook's exit status and its own diagno…
release: 0.12.3 — One bad byte
release: 0.12.3 — One bad byte (#278)
fix(git-backup): four ways the backup stopped and reported success (D…
fix(#322): guard the two cooldown markers save-session.sh feeds to $(…
fix(#324,#327): 10# in both git hooks, and #258's test writes where t…
Fix absent-vs-unreadable collapse at two more markers (#625), add NDC…