borgmatic hangs when location.patterns includes /root/.borgmatic and database hooks are active #582
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#582
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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
Trying to use database hooks while
location.patterns
containsR /root
.Steps to reproduce (if a bug)
Actual behavior (if a bug)
The last step in the reproduction section will hang forever as follows:
Expected behavior (if a bug)
The backup should complete as usual.
Other notes / implementation ideas
The patterns file generated by borgmatic looks like this:
Apparently this causes borg to attempt to backup the pipes in
/root/.borgmatic/*_databases
twice. One time as a subdirectory ofR /root
and a second time forR /root/.borgmatic
.strace
ing the borg process reveals that the process is indeed stuck on trying to open one of the named pipes:Watching the output of
--progress
on a sufficiently large database, it is visible that borg makes a backup of the pipe once and later tries to open the pipe again and gets stuck.Apparently this doesn't happen when using
locations.source_directories
instead. My guess is that borg deduplicates directories passed on the command line, but doesn't deduplicate roots passed in patterns.This might be related to #578, but isn't solvable by deleting the pipes manually, since the error state is reproducibly generated by borgmatic at startup.
Environment
borgmatic version: 1.7.1
borgmatic installation method: pip
Borg version: 1.2.2
Python version: 3.10.7
Database version (if applicable): 14.5 (but probably not relevant)
operating system and version: Docker container docker.io/library/python:3-bullseye
Ugh! Thank you for reporting this and providing all the details. Borg actually doesn't deduplicate
source_directories
at all—but borgmatic does! Unfortunately nothing is deduplicating the contents ofpatterns
. So I guess that's a new thing borgmatic will need to do as part of this ticket. Or at least make sure not to add~/.borgmatic
if a parent directory is already present inpatterns
.~/.borgmatic
getting injected intopatterns
(when used) was introduced by #574 to work around a Borg bug.I've just pushed a fix for this to master. The gist is that
pattern
root directories are now considered when injecting~/.borgmatic
intopatterns
—it won't get injected if a parent/grandparent/etc directory is already present as a root directory inpatterns
. The caveat is that non-root patterns are not considered; borgmatic isn't trying to parse through+ /this
and- /that
, so it is still possible to hang yourself. It's just less likely unless you explicitly try to do so.Thanks again for reporting this! Release forthcoming.
Just released in borgmatic 1.7.2!