Glob-Expansion (of source directories) does not work on "working directory" #609
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?
Hi, it's me again :)
What I'm trying to do and why
I try to use relative paths during backup via
working_directory
field.Issue: using relative-path globs in
source_directories
field are not resolved relative toworking_directory
Steps to reproduce
Actual behavior
running
$ sudo borgmatic create --verbosity 2 --dry-run
lists the create command with*
expanded to a list of all files/folders in current directory (where this command is executed)Partial output:
Additionally I am curious why
/root/.borgmatic
is always included in the backup ?Expected behavior
Other notes / implementation ideas
Notes about the
location.source_directories
field:I expected
- *
to work, but this throws an YAML-parser error:did not find expected alphabetic or numeric character
Additionally I tried
- ./*
which gives the same result as- "*"
- resolving relative to current directory instead of working directory.Environment
borgmatic version: 1.4.4
borgmatic installation method: openSUSE package manger
Borg version: 1.2.2
Python version: 3.10.7
operating system and version:
Operating System: openSUSE Tumbleweed 20221026
Kernel Version: 6.0.3-1-default (64-bit)
Additional Note:
The Level-2 output of
borgmatic create
has no info that the relativeworking_directory
path is used.I gues borgmatic simply does a
cd
bevore. Maybe include this in Level-2 output.I now have a work-around:
includes all directories and files of
/path/to/work-dir
in a relative manner.My initial goal was to only include directories (and files) that do not start with a dot. For this I found the following glob pattern to work:
[!.]*
This is how I came up with the simplified example in the original post.
I just noticed: for not having
.*
directories/files in the repo I could also simply use the exclude patterns.I apologize for the delay in getting to this. Supporting globs relative to the configured working directory seems like a totally reasonable feature!
Yeah, this is a YAML limitation. You need to quote the asterisk, as you discovered.
Agreed.. This would be a good thing to log!
The short answer is that
~/.borgmatic
is included to support backing up database dumps. More info is here: https://torsion.org/borgmatic/docs/how-to/backup-your-databases/I ran into the same issue with.
I would workaround this limitation with specifying the directory without globs as i only use them to workaround another limitation.
My top-level directory to backup is a symbolic link (unraid share using single disk). So defining top-level directory in
source_directories
results in only backup the symbolic link.Situation:
Content to backup:
/mnt/user/myshare
.In unraid this may be a symbolic link to the actual disk mount.
results in having an archive containing only the symbolic link
myshare
.I don't want to open a discussion to how symbolic links should be backed up... In my eyes in general they should as they are. Current behavior. But in this special case of a top-level directory it would make sense to make a exception. In most shells you can append a trailing
/
to symbolic links which most of the time works perfect for this exception.Unfortunately this workaround doesn't work with borg/borgmatic.
So a workaround would be:
But this does not work in combination with
working_directory
if you want to "hide" the common location from the backup.results in all directories and files in the working directory of borg/borgmatic instead the defined
working_directory
.So in working on this ticket, I, uh, kind of expanded scope. Now
working_directory
applies to all borgmatic actions, not justcreate
. And as part of that work, the original ask in this ticket was also implemented.This will be part of the next release. Thanks to @simon-77 for filing this (and to @spali for weighing in)!
Released in borgmatic 1.9.0!