fix: distinguish LockFailed causes instead of always blaming permissions - #2545
Open
kreativmonkey wants to merge 1 commit into
Open
fix: distinguish LockFailed causes instead of always blaming permissions#2545kreativmonkey wants to merge 1 commit into
kreativmonkey wants to merge 1 commit into
Conversation
Borg raises LockFailed for any failure to create the lock file, but Vorta reported every one of them as "No Repository Permissions". A repository whose backing storage is full ([Errno 122] on Linux, [Errno 28] anywhere) therefore sent users looking at SSH keys and permissions. Pass Borg's message along in the log signal context and branch on the errno it contains. Borg's original message is now always shown as detailed text, so a cause the branching does not know about is still visible. Refs borgbase#2544
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Borg raises
LockFailedfor any failure to create the lock file, butreact_to_log()reported every one of them as "No Repository Permissions". The dialog also never showed what Borg actually said, becauseborg_job.pydropped the message before it reached the signal context.Two changes:
src/vorta/borg/borg_job.py— putparsed['message']into the context dict that goes out withbackup_log_event. The only other consumer of that context isMainWindow.set_log(), which ignores it, so nothing else is affected.src/vorta/application.py— in theLockFailedbranch, decide by the errno contained in Borg's message: 28 / 122 / 69 → "Repository Storage Full", 1 / 13 → the existing "No Repository Permissions" wording, anything else → a neutral "Repository Lock Failed". Borg's original message is attached as detailed text in all three cases, so a cause the branching does not know about is still visible to the user.Two details worth flagging:
[Errno N], not on the text after it. That text comes fromstrerrorand is localized — under a German locale the quota error reads "Der Speicherplatz auf dem Datenträger wurde überschritten".errnomodule, because for a remote repository the error happens on the server. A macOS client backing up to a Linux server gets 122, which is not whaterrno.EDQUOTis on macOS. There is a comment in the code saying so.The storage-full text also mentions that pruning won't work either, since that is the part that costs people time:
borg pruneneeds the same lock it cannot write, so the repository has to be freed up from outside.The three strings I touched were changed from
self.tr(f"…{repo_url}…")toself.tr("…{}…").format(repo_url). The f-string is interpolated beforetr()sees it, so the lookup key never matches the catalog and the line cannot be translated. The same pattern exists in a few other places (LockTimeoutright above,filedialog.py,repo_tab.py) — I left those alone to keep this PR to one topic. Happy to open a separate issue for them if you want it fixed.No
.ts/.qmfiles touched.Related Issue
#2544
Motivation and Context
My backups to a Hetzner Storage Box started failing and Vorta told me I had no permission to access the repository. I spent a while checking the SSH key and the permissions on the server before running Borg by hand, which said:
[Errno 122]isEDQUOT— the box was 100 % full. With this change the dialog names that, and shows Borg's message either way.How Has This Been Tested?
Arch Linux, Python 3.14, PyQt6, Borg 1.4.5.
tests/unit/test_lock.py::test_create_perm_erroris unchanged and still passes — its fixture carries[Errno 13], so it is the regression guard for the permissions branch.test_create_quota_errorwith a newcreate_quotafixture pair carrying the real[Errno 122]message; asserts the new wording and that the Borg message ends up in the detailed text.test_create_lock_failed_genericwith acreate_lockfailfixture using[Errno 30](read-only filesystem) to cover the fallback branch.QT_QPA_PLATFORM=offscreen uv run pytest tests/unit→ 257 passed, 6 skipped.make lint→ all pre-commit hooks pass.Note for anyone reproducing: running
tests/unit/test_lock.pyon its own fails ontest_create_perm_errorwith awaitUntiltimeout. That is pre-existing on master, unrelated to this change — the file depends on state another test module sets up first. It passes in the full suite.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.