New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pattern docs are misleading/wrong on how relative patterns work in practice #7964
Comments
Did you read the next sentence from the docs after the one you quoted? It should make clear how that is meant. |
I agree that the docs are confusing. The first two paragraph are:
I don't know what the first sentence is trying to convey, as I don't know what it means for a path to "start from" a root. The first sentence of the second paragraph is also potentially misleading. Saying that the paths are "relative" suggests that they are relative to the roots just mentioned, but they are not. How about something like this:
I also recommend including an example of a relative root, e.g.
|
The last example should answer one of @Atemu's questions: if that command is executed in |
It should absolutely be documented that patterns are relative to the working directory rather than the recursion root. That is not at all intuitive; I would have expected them to be relative to the recursion root and perhaps the recursion root to then be the CWD by default if not otherwise specified. (Perhaps that might be a better and more flexible mode of operation to begin with.) |
This is not correct. If I do
then exclusion patterns must match There is a reason that patterns aren't relative to the recursion roots. For example, if we do
and want to exclude |
I see. So if I'm getting this right, when you give it an absolute path as its recursion root, the "pattern root" becomes
Indeed. That is a case I hadn't considered. I wasn't really aware Borg had such a feature. Is it intended to make include-lists possible without the user needing to build a pattern? I.e. does
|
I think you are understanding things correctly, but I wouldn't describe it in this way. Each pattern is used for paths generated by all recursion roots, so I wouldn't say that the patterns have a specific root. Instead, we describe how paths are generated from the recursion roots, and say that the patterns must match the paths in that form. Incidentally, the same rules apply when giving a path name to extract from a backup. I suspect the answer to your question about |
Maybe the possibility of multiple recursion roots should be emphasized, and used to justify the way pattern matching is designed. Here is an updated proposal:
@Atemu Does this seem clear to you? |
Have you checked borgbackup docs, FAQ, and open GitHub issues?
Yes
Is this a BUG / ISSUE report or a QUESTION?
ISSUE
System information. For client/server mode post info for both machines.
Your borg version (borg -V).
borg 1.2.6
Operating system (distribution) and version.
NixOS 24.05
Hardware / network configuration, and filesystems used.
x86_64, local, tmpfs
How much data is handled by borg?
0B
Full borg commandline that lead to the problem (leave away excludes and passwords)
(Explained below.)
Describe the problem you're observing.
The docs state that:
Thus if I wanted to back up
/tmp/foo
but not/tmp/foo/d1
, I'd expect the following pattern file to work:It does not however:
In order to exclude
d1
, I must specify its full path relative to/
, rather than the recursion root/tmp/foo
:This is not "relative to the currently active recursion root", it's relative to
/
; unconditionally.At this point I might aswell specify its full path, so I'm a bit confused why relative paths are even a thing when they're not actually relative to the recursion root?
I hope you can see how this is extremely confusing. The docs should be changed to reflect the actual behaviour and perhaps relative paths should be removed/disallowed until they actually do something that an absolute path wouldn't.
At the very least, the example pattern file should be marked with a note that relative paths only work the way they're portrayed when the root is
/
, not in any other case, as it also suggests the patterns work like described in the first sentence.Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
Include any warning/errors/backtraces from the system logs
The text was updated successfully, but these errors were encountered: