patterns and patterns_from do not work with relative dirs in pattern #212

Closed
opened 3 years ago by Alkac · 3 comments
Alkac commented 3 years ago

What I'm trying to do and why

I had own script with Borg backup using patterns file - that worked. Now migrated to borgmatic and all the patterns are ignored.

Steps to reproduce (if a bug)

Create config.yaml with:

location:
    patterns_from:
        - /etc/borgmatic/default.patterns

and

$ cat /etc/borgmatic/default.patterns
P sh
R /
- lv_data

Actual behavior (if a bug)

The path /lv_data is backed up.

Expected behavior (if a bug)

The path /lv_data is excluded from backup.

Other notes / implementation ideas

As per borg help patterns:

... When you give /absolute/ as root, they will look like /absolute/…/file.ext. This is meant when we talk about “full path” below.

Hence R / and - lv_data should result to - /lv_data.

Environment

borgmatic version: 1.3.13-1

borgmatic installation method: AUR Arch package

Borg version: 1.1.10-1

Python version: 3.7.4

operating system and version: Arch Linux x86_64, up-to-date

#### What I'm trying to do and why I had own script with Borg backup using patterns file - that worked. Now migrated to borgmatic and all the patterns are ignored. #### Steps to reproduce (if a bug) Create config.yaml with: ``` location: patterns_from: - /etc/borgmatic/default.patterns ``` and ``` $ cat /etc/borgmatic/default.patterns P sh R / - lv_data ``` #### Actual behavior (if a bug) The path /lv_data is backed up. #### Expected behavior (if a bug) The path /lv_data is excluded from backup. #### Other notes / implementation ideas As per `borg help patterns`: *... When you give /absolute/ as root, they will look like /absolute/…/file.ext. This is meant when we talk about “full path” below.* Hence `R /` and `- lv_data` should result to `- /lv_data`. #### Environment **borgmatic version:** 1.3.13-1 **borgmatic installation method:** AUR Arch package **Borg version:** 1.1.10-1 **Python version:** 3.7.4 **operating system and version:** Arch Linux x86_64, up-to-date
Owner

Would it be possible to run borgmatic with --verbosity 2 so we can see the exact flags that borgmatic passes to Borg? That would help me narrow down the problem. Thanks!

Note that borgmatic doesn't do any pre-processing of the patterns files.. It should just be passing the filenames through directly to Borg.

Would it be possible to run borgmatic with `--verbosity 2` so we can see the exact flags that borgmatic passes to Borg? That would help me narrow down the problem. Thanks! Note that borgmatic doesn't do any pre-processing of the patterns files.. It *should* just be passing the filenames through directly to Borg.
witten added the
question / support
label 3 years ago
Poster

Hm. My mistake. In my original scripts, I probably used relative path for backup, like

cd /
borg create --patterns-from /some/patters repo::archive .

Which then requires patterns like ! home/johny

However, when using:

borg create --patterns-from /some/patters repo::archive /

Then the patterns must be like ! /home/johny.

The Borg docs do say that, however in a not so well comprehensible way...

P.S. I noted some other bug with borgmatic and will report it separately.

Hm. My mistake. In my original scripts, I probably used _relative_ path for backup, like ``` cd / borg create --patterns-from /some/patters repo::archive . ``` Which then requires patterns like `! home/johny` However, when using: ``` borg create --patterns-from /some/patters repo::archive / ``` Then the patterns must be like `! /home/johny`. The Borg docs do say that, however in a not so well comprehensible way... P.S. I noted some other bug with borgmatic and will report it separately.
Alkac closed this issue 3 years ago
Owner

Glad to hear this one is cleared up!

Glad to hear this one is cleared up!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.