Skip to content

Conversation

@keysmashes
Copy link
Contributor

@keysmashes keysmashes commented Feb 16, 2025

Description

Firstly: if there's an exclude pattern that starts with a #, it should be ignored when doing source size estimation. See borg help patterns:

Lines empty or starting with the number sign (‘#’) after removing whitespace on both ends are ignored.

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, including ExclusionModel etc. (the "presets" and "custom" tabs) – we do this by using the conveniently named get_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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@m3nu
Copy link
Contributor

m3nu commented Feb 17, 2025

This will pass more exclusions to the function sizing directories. So it's an improvement. It does NOT fix #2115 because it won't catch long filename errors from the OS. It also won't cover all exclusions, since the path is only compared as Regex, while Borg supports many more exclusion patterns.

I'm still OK to merge this, since it improves something.

@m3nu
Copy link
Contributor

m3nu commented Feb 17, 2025

Let us know when you tested this and we'll merge it.

@keysmashes
Copy link
Contributor Author

I've now tested this; it appears to work fine, the estimated size goes way down if I add a large directory to the "custom" tab (and the estimated size with no custom/preset options selected agrees with the stable Vorta I have installed).

Copy link
Contributor

@m3nu m3nu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Code Review

PR: #2206 - Fix exclusion handling for source size estimation
Branch: push-vmkyyknpmvtymaster
Changes: +2 / -2 lines across 2 files

📋 Summary

This PR fixes source size estimation to use the complete set of exclusion patterns (presets, custom, and raw) rather than just raw exclusions. It also correctly handles comment lines in exclusion patterns as per Borg's documented behavior.

📏 Rules Applied

  • Project config: .claude-review.yml
  • CLAUDE.md conventions: ✓
  • Default rules: ✓

✅ What's Good

  • Correct Borg compatibility: Lines starting with # are now properly treated as comments, matching Borg's pattern syntax
  • Consistent exclusions: Uses get_combined_exclusion_string() which is the same method used by BorgCreateJob (see create.py:183), ensuring size estimation matches actual backup behavior
  • Synergistic changes: The two modifications work together - get_combined_exclusion_string() includes comment headers like # custom added rules, and the parser now correctly skips them
  • Minimal impact: Small, focused changes that solve the reported issue without unnecessary modifications

🔍 Review Details

0 inline comment(s) added.

Severity Count
🔴 Error 0
🟡 Warning 0
🔵 Info 0

📊 Verdict: APPROVE ✅

The changes correctly address issue #2115 by ensuring source size estimation uses all configured exclusions, preventing over-estimation and potential crashes when traversing directories like /proc or /run.


🤖 Reviewed by Claude Code

@m3nu m3nu merged commit 0b5ad99 into borgbase:master Jan 2, 2026
4 of 5 checks passed
@keysmashes keysmashes deleted the push-vmkyyknpmvty branch January 2, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants