location.patterns
breaks when /root/.borgmatic
exists
#574
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I'm trying to create a backup while specifying the locations using
location.patterns
and/root/.borgmatic
exists. Reasons to do this include usinglocation.patterns
andhooks.*_databases
at the same time, because the latter automatically creates/root/.borgmatic
.Steps to reproduce (if a bug)
Actual behavior (if a bug)
As soon as
/root/.borgmatic
exists, it overrides all locations specified inlocation.patterns
and only/root/.borgmatic
is included in the backup.Expected behavior (if a bug)
The roots specified by
location.patterns
should be included in the backup regardless of the existence of/root/.borgmatic
.Other notes / implementation ideas
This seems to happen, because borgmatic passes
/root/.borgmatic
as a backup directory toborg create
when it exists, which seems to conflict with--patterns-from
Environment
borgmatic version: 1.7.0, 1.6.3
borgmatic installation method: via pip in docker container
python:3-buster
(1.7.0), as well as via apt on Debian bookworm (1.6.3)Borg version: 1.1.9 (in docker container with borgmatic 1.7.0), 1.2.1 (on Debian bookworm with borgmatic 1.6.3)
Python version: 3.10.6 (in both cases)
Database version (if applicable): n/a, the bug was discovered while trying to use database hooks, but also appears when no actual database hook is configured.
operating system and version: docker container
python:3-buster
, Debian BookwormYikes, that's pretty bad! Thanks for the detailed bug report. I will attempt to repro this locally and work on a fix.
I've repro'd this with Borg only (1.2.1), without borgmatic:
This results in only
/root/.borgmatic
getting backed up. So this is either a bug in Borg or intended behavior. In either case, borgmatic probably needs to work around it.The Borg dev seems to think the Borg patterns behavior described above could be a bug, so I've filed it here: https://github.com/borgbackup/borg/issues/6994. Still gotta figure out what that means for borgmatic.
Okay, I just released a work-around for this Borg issue in borgmatic 1.7.1. Basically, when
patterns
is used, anysource_directories
(implicit or otherwise) get converted into patterns instead of being passed to Borg on the command-line. With that change, the overriding behavior you were seeing no longer occurs.You may also be interested to know that with #542 included in this release,
source_directories
is now completely optional; you don't need to set it to an empty list any longer.Thanks again for reporting this!
Thank you, for the thourough investigation and very timely fix!