Skip to content

fix(sysbak): write config after sudo, not before#52

Merged
thompsonson merged 1 commit into
mainfrom
fix/sysbak-setup-config-write-order
Apr 29, 2026
Merged

fix(sysbak): write config after sudo, not before#52
thompsonson merged 1 commit into
mainfrom
fix/sysbak-setup-config-write-order

Conversation

@thompsonson
Copy link
Copy Markdown
Owner

Summary

  • Moves ~/.config/sysbak/config write to after the sudo step (rsnapshot.conf), not before
  • Prevents a failed sudo prompt from clobbering the user's customised backup_dirs, exclude_patterns, and staleness thresholds with defaults

Root cause

Setup previously wrote the config file before calling sudo tee /etc/rsnapshot.conf. If sudo failed (wrong password, timeout, or no terminal), the config was already overwritten with defaults — silently resetting any customisations.

Discovered when a non-interactive run via Claude Code's Bash tool (no sudo terminal) clobbered a 7-entry backup_dirs down to 2 hardcoded defaults.

Test plan

  • Run sysbak setup and enter wrong sudo password — config file unchanged
  • Run sysbak setup with correct sudo password — config written correctly after rsnapshot.conf
  • backup_dirs customisations survive a re-run

Previously setup wrote ~/.config/sysbak/config before the sudo step.
A failed sudo prompt (wrong password, sudo timeout) would clobber the
user's backup_dirs and other customisations with defaults.

Move the config write to after rsnapshot.conf is written successfully.
@thompsonson thompsonson merged commit 249aa22 into main Apr 29, 2026
4 checks passed
@thompsonson thompsonson deleted the fix/sysbak-setup-config-write-order branch April 29, 2026 06:52
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