Exclude failing due to confusing expansion of * #132

Closed
opened 2019-01-03 17:01:41 +00:00 by copy · 3 comments

I have these exclude lines in my config file:

    exclude_patterns:
         - /*/node_modules
         - /*/_build

Somehow all _build directories were properly excluded, while all node_modules were still present in my backup. Having a look a the exclude file generated by borgmatic, it turns out that the node_modules exclude was expanded early while the other one was preserved:

/lib/node_modules
/lib64/node_modules
/*/_build

While this seems to be the intended behaviour, it's quite confusing and fragile that borgmatic expands the same characters as borg in a preprocessing step, but only if the matches files are present.

I'd suggest to not expand * in borgmatic and document that this preprocessing of the exclude list is going on in addition to borg's pattern matching.

I have these exclude lines in my config file: ``` exclude_patterns: - /*/node_modules - /*/_build ``` Somehow all `_build` directories were properly excluded, while all `node_modules` were still present in my backup. Having a look a the exclude file generated by borgmatic, it turns out that the `node_modules` exclude was expanded early while the other one was preserved: ```text /lib/node_modules /lib64/node_modules /*/_build ``` While this seems to be the intended behaviour, it's quite confusing and fragile that borgmatic expands the same characters as borg in a preprocessing step, but only if the matches files are present. I'd suggest to not expand `*` in borgmatic and document that this preprocessing of the exclude list is going on in addition to borg's pattern matching.
Owner

Thanks for reporting this. In borgmatic source, it looks like the function that expands * and ~ in paths is called when interpreting both source_directories and exclude_patterns. So I think the fix would be to continue expanding * for source_directories but not for exclude_patterns. And exclude_patterns still needs to expand ~ so as not to regress #58.

Thanks for reporting this. In borgmatic source, it looks like the function that expands `*` and `~` in paths is called when interpreting both `source_directories` and `exclude_patterns`. So I think the fix would be to continue expanding `*` for `source_directories` but not for `exclude_patterns`. And `exclude_patterns` still needs to expand `~` so as not to regress #58.
witten added the
design finalized
label 2019-01-27 21:01:37 +00:00
Owner

Okay, this fix is implemented now as described above. It'll be released shortly!

Thanks for reporting this.

Okay, this fix is implemented now as described above. It'll be released shortly! Thanks for reporting this.
Owner

Just released in borgmatic 1.2.15.

Just released in borgmatic 1.2.15.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#132
No description provided.