"Permission denied" error does not cause hard failure, but rather turns operation successful #486
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#486
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Running
borgmatic
withexclude_from
.Steps to reproduce (if a bug)
Run
borgmatic
withexclude_from
option, where a file would have such permissions thatborgmatic
would not be able to read it.Actual behavior (if a bug)
After that, it would go ahead and treat
create
operation successful and even runafter_backup
hook instead ofon_error
one. I actually had failing backups going unnoticed for a while because of that. I have corresponding email notifications set up on both hooks, and in this case it was fooling me to believe that everything is OK, since the emails would reflect success rather than failure. I only realized that something is wrong when I accidentally noticedsecurity
not being incremented anymore for a while.Expected behavior (if a bug)
All fatal errors should unconditinally fail the backup process, report proper exit status, and run corresponding hook. I guess some review of other code paths, not just this one, might be needed.
Environment
borgmatic version: 1.5.21
Borg version: 1.1.17
Python version: 3.10.1
I've reproduced this problem locally. Thank you for reporting it!
So I think what's going on here is Borg is returning a "warning" exit code instead of an "error" exit code, which borgmatic intentionally does not error on. One fix for this specific issue could be for borgmatic to try to read the file before handing it off to Borg.. and error if there is a permission denied error.
I implemented this fix for both
exclude_from
andpatterns_from
in borgmatic master. This will be part of the next release. Thanks for reporting it!Released in borgmatic 1.5.24.