Prevent exception while running BorgVersionJob with unexpected lines on stderr#1934
Prevent exception while running BorgVersionJob with unexpected lines on stderr#1934m3nu merged 2 commits intoborgbase:masterfrom
Conversation
real-yfprojects
left a comment
There was a problem hiding this comment.
Thank you for taking the time to create this PR. You can find my commentary below.
|
Was also looking at this. Currently wondering about the test timeouts on Linux. A Github glitch? |
Not sure what it is, but the line |
…on stderr The borg job logic expects the `profile_name` key to be unconditionally present in the params if any data is received on stderr. This causes the BorgVersionJob (which didn’t set this param) to fail if any unexpected output – such as LD_PRELOAD warnings – in generated while running `borg --version`. This in turn causes Vorta to silently (other than an unrelated looking exception in the console output) fall back to assuming borg 1.1.0 as the borg version.
m3nu
left a comment
There was a problem hiding this comment.
🔍 Code Review
PR: #1934 - Prevent exception while running BorgVersionJob with unexpected lines on stderr
Branch: patch-1 → master
Changes: +1 / -0 lines across 1 file
📋 Summary
This PR fixes a KeyError that occurs when BorgVersionJob encounters unexpected stderr output (such as LD_PRELOAD warnings). The fix adds the missing profile_name key that the base class's stderr handling expects.
✅ What's Good
- Correctly identifies the root cause:
borg_job.py:318accessesself.params["profile_name"]when logging non-JSON stderr output - Minimal, targeted fix - only adds what's necessary
- The
BorgVersionJobis unique in not taking a profile (unlike other Borg jobs), so this edge case is easy to miss - Value
'default'is consistent with how site_id defaults work in the codebase
📊 Verdict: APPROVE ✅
The fix is straightforward and correctly addresses the issue. The change ensures Borg version detection doesn't silently fail in environments with LD_PRELOAD warnings.
🤖 Reviewed by Claude Code
Description
The borg job logic expects the
profile_namekey to be unconditionally present in the params if any data is received on stderr. This causes the BorgVersionJob (which didn’t set this param) to fail if any unexpected output – such as LD_PRELOAD warnings – in generated while runningborg --version. This in turn causes Vorta to silently (other than an unrelated looking exception in the console output) fall back to assuming borg 1.1.0 as the borg version.Related Issue
Please don’t make me create an issue for this…
Motivation and Context
Borg version detection currently silently fails in environments that have LD_PRELOAD set in a way to causes warnings to be emitted.
How Has This Been Tested?
The change is pretty trivial, so I just tested with and without.
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.