Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). #1144

Merged
witten merged 4 commits from check-runtime-directory-excludes into main 2025-09-13 05:40:05 +00:00
Owner

Implementation of #1122. To prevent the user from inadvertently excluding the bootstrap action's manifest from a backup archive—thereby preventing the bootstrap action from working—this PR now always errors and exits when the borgmatic runtime directory overlaps with the configured excludes. Previously, this check was only performed when database streaming was in use. Now, the check is performed all the time.

In terms of implementation, this check runs a borg create --dry-run to get the list of individual file paths that Borg plans to backup and compares that list against the borgmatic runtime directory to see if it has been excluded.

Considerations

In practice, this is a performance hit, because the dry-run isn't free. However, this is apparently the cost of protecting the user from accidentally breaking bootstrapping or other (current or future) features that rely on the borgmatic runtime directory getting backed up.

Still to do

  • automated tests
  • account for the case where store_config_files: false and the runtime directory never gets added to patterns to begin with
Implementation of #1122. To prevent the user from inadvertently excluding the `bootstrap` action's manifest from a backup archive—thereby preventing the `bootstrap` action from working—this PR now always errors and exits when the borgmatic runtime directory overlaps with the configured excludes. Previously, this check was only performed when database streaming was in use. Now, the check is performed all the time. In terms of implementation, this check runs a `borg create --dry-run` to get the list of individual file paths that Borg plans to backup and compares that list against the borgmatic runtime directory to see if it has been excluded. ### Considerations In practice, this is a performance hit, because the dry-run isn't free. However, this is apparently the cost of protecting the user from accidentally breaking bootstrapping or other (current or future) features that rely on the borgmatic runtime directory getting backed up. ### Still to do * [x] automated tests * [x] account for the case where `store_config_files: false` and the runtime directory never gets added to `patterns` to begin with
Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122).
Some checks failed
build / test (pull_request) Failing after 7m31s
build / docs (pull_request) Has been skipped
947dc77a50
Update automated tests (#1122).
Some checks failed
build / test (pull_request) Failing after 6m27s
build / docs (pull_request) Has been skipped
f60007545b
witten changed title from WIP: Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). to Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). 2025-09-12 19:56:15 +00:00
witten changed title from Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). to WIP: Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). 2025-09-12 20:53:29 +00:00
Bring doc string up to date and rename function for clarity. (#1122).
Some checks failed
build / test (pull_request) Failing after 6m25s
build / docs (pull_request) Has been skipped
5028fe9ff4
Account for the case where "store_config_files: false" and the runtime directory never gets added to patterns to begin with (#1122).
All checks were successful
build / test (pull_request) Successful in 6m51s
build / docs (pull_request) Has been skipped
c4c40af812
witten changed title from WIP: Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). to Always error and exit when the borgmatic runtime directory overlaps with the configured excludes (#1122). 2025-09-13 05:39:47 +00:00
witten merged commit 2cae42a163 into main 2025-09-13 05:40:05 +00:00
Sign in to join this conversation.
No reviewers
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
borgmatic-collective/borgmatic!1144
No description provided.