-
-
Notifications
You must be signed in to change notification settings - Fork 750
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 matching when names contain space #8578
Comments
Did you try this as a line within your patterns file?:
|
Oh dear, inside a pattern-file this works! 👍 :-) So when searching a solution, I was just using my existing --patterns-from file. So the following
|
Giving command line arguments with spaces inside is a problem because the shell usually splits arguments at spaces, so one needs to work around that. This is not borg specific, but just a shell thing. The patterns file works on a line-by-line basis and if the line starts with +/-, the processing just removes that and uses the path "as is", thus no workarounds needed. |
Hello, thanks @goebbe for opening the issue. I confirm as well that @ThomasWaldmann I also report that escaping with
I agree, but it appears that there is no known way to escape, at least from Vorta and macOS. All these formats fail: -'home/user/test folder' |
The plus/minus belongs to the option value and values with spaces need quoting (for example), so can you try?:
Values starting with a minus char could lead to parsing problems, because short options also start with a minus char. So, in general, you can save yourself a lot of pain by using |
All of these seem to work correctly:
producing
So maybe you're seeing a bug in Vorta? |
@jdchristensen Thank you! Here are the relevant bits from the Vorta logs, that let me to the (wrong) conclusion that this is a borg issue:
Note that when copying the exact borg command from the logs to the command line, without any modification, the borg create works as expected, without warning or complaint and the --pattern is applied as expected.
@ThomasWaldmann I am not a programmer, but to me this looked like a borg Warning - do you have any idea/ hint what the problem might be? I will open an issue on Vorta. |
From the borg side of view, I would like to suggest adding the following to the pattern docs. Pattern matching special characters,e.g. white space, on the command line requires some adjustments - such as escaping special characters using |
It appears so, as Vorta does not let me escape the whole option either (like in the option by @ThomasWaldmann, |
The underlying issue has been fixed in Vorta. @ThomasWaldmann I plan to add a comment/ phrase to the "borg help patterns" docs about matching special characters on the command line, if this is o.k. with you. |
Maybe rather use single quotes than backslash-escaping, that's cleaner imho. Also, explain that the quoting is shell specific and it is due to the shell doing argument splitting at spaces that one needs to do that. For a file read directly by borg, there is no shell involved and thus the quoting is not needed. |
A Vorta user had a hard time matching a folder-name with a space on MacOS:
borgbase/vorta#2156 (reply in thread)
Since matching names that contain a single space is a common use case, I decided to report, here.
I tried to reproduce the issues using Vorta 0.10.1 with borg 1.4 on LinuxMint 22.
My folder was named
test folder
, with a single space in the middle of the folder-name.I used
--patterns-from
with the standardsh:
and thefm:
matcher and tried to exclude the folder from my backup.The following did not work:
\
.\s
.As code:
In short, I did not find a simple way to match the folder name, using
--pattern
matching with the standardsh:
orfm:
matcher.The following worked for me. However, I had to use the
re:
matcher (regular expressions), in order to match the single space by\s
.-re:home/user/test\sfolder
Currently, matching names with (a single) space seems not to be documented.
If this is the expected behaviour (i.e. not a bug) - maybe we could add a working example (with
re:
) to the docs?The text was updated successfully, but these errors were encountered: