Fix exclusion handling for source size estimation #2206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Firstly: if there's an exclude pattern that starts with a
#
, it should be ignored when doing source size estimation. Seeborg help patterns
:Secondly: rather than just using the profile's
exclude_patterns
(text entered in the "raw" exclusions tab), we should estimate source size based on the combined set of patterns from the profile, includingExclusionModel
etc. (the "presets" and "custom" tabs) – we do this by using the conveniently namedget_combined_exclusion_string()
method.Related Issue
Fixes part of #2115.
Motivation and Context
Previously, only the "raw" exclusions were used when estimating size of a backup source, not the "presets" or "custom" exclusions. (All exclusions were still passed to Borg for the actual backup.) This could lead to over-estimating the amount of material to be backed up, or even traversing parts of the filesystem that should be ignored, like
/proc
or/run
, and potentially crashing Vorta.How Has This Been Tested?
I have not, yet, tested this – I have an ongoing backup I'd rather not interrupt, and running two instances of Vorta at the same time seems like a bad idea. I can do so next weekend, probably.
Screenshots (if appropriate):
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.