borgbackup / borgbackup/borg

Patternfile doesn't seem to work with relative paths

Open
#6,231 8 comments 0 reactions 0 assignees View on GitHub
enhancement patterns
Dominant language
Python
Stars
13.7k
Forks
875
Avg merge
11h 15m
Merged PRs (30d)
192

Description

## Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

## Is this a BUG / ISSUE report or a QUESTION?

Question

## System information. For client/server mode post info for both machines.

Arch linux
#### Your borg version (borg -V).
1.1.17
#### Operating system (distribution) and version.

#### Hardware / network configuration, and filesystems used.
Zfs
#### How much data is handled by borg?
None
#### Full borg commandline that lead to the problem (leave away excludes and passwords)

`borg create --list --dry-run --patterns-from patternfile ~/borgrepo::test`

Patternfile:
```
R /home/user/borgtest
- dir1
+ dir2/includeme
- dir2
```
Directory structure:
```
|-- dir1
| |-- dir1-a
| `-- dir1-b
|-- dir2
| |-- excludeme
| `-- includeme
```
## Describe the problem you're observing.

In the patternfile, after specifying a root with `R`, exclusion rules still require an absolute path.
With the setup described above, I would expect dir1 not to be backed up, and only includeme to be backed up, and not excludeme.

What actually happens is that everything is backed up:
```
- /home/user/borgtest/dir1/dir1-b
- /home/user/borgtest/dir1/dir1-a
- /home/user/borgtest/dir1
- /home/user/borgtest/dir2/includeme
- /home/user/borgtest/dir2/excludeme
```

#### Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
The patternfile only works if all the paths are absolute. This becomes a problem, since some of my paths are very long.

The docs seem to suggest that using `R` sets a root from which rules apply from, which doesn't seem to be happening.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.