TypeError in logging when using retcode 75 in actions #900
Labels
No labels
blocked
breaking
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#900
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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
I have some
before_backupactions to check to make sure that the files I'm about to back up aren't in use.During my last backup, I got an exception because the test exited with the 75 retcode:
TypeError: unsupported operand type(s) for +: 'CalledProcessError' and 'str'. After a couple retries, though, thenccommand started failing (a good thing!) and the backup went as normal. So, I think this is just a problem with the logging code.Steps to reproduce
Have a
before_backupcommand that returns the 75 exit code; maybe having it also write something to stdout is necessary, I'm not sure.Actual behavior
This is from my cron error mail; I think verbosity 2 isn't needed here, but I can repro with higher verbosity if requested.
Expected behavior
It Just Works™
Other notes / implementation ideas
This
before_backuptest has worked for forever, I haven't changed it in a long time. However, I recently upgraded a bunch of stuff in the jail I use for borgmatic, including:I also switched from
pip installing both borg and borgmatic, to using the BSD port for borg andpipxfor borgmatic (pipxper your documentation's recommendation.)As for how this is invoked, it's a cronjob, run as root, that does the following:
I should note that on a macOS host that does a different backup job, I did not experience this issue. The test it does is different (
[ ! -f ~/Library/myservice/myservice.pid ] || exit 75), but it still makes use of the retcode 75 trick and it uses the same log verbosity. That host is also running python 3.11 and borgmatic 1.8.13, but it's on borg 1.4.0, with all of these installed by homebrew (though I'm pretty sure the python version being used there is actually coming from pyenv globals.)So, this could be a problem of my jail's setup, I'm not sure, but I double-checked and I don't think anything is amiss there; if it were something like the borgmatic code using the
loggingmodule from some other python version, I'd expect there to be a lot more wrong and for my backups to fail. I feel like it's more likely something to do with the way the logging module is used that's sensitive to something about the difference in thebefore_backupcommands... maybe the fact that thenc-based one has output while the[-based one does not?borgmatic version
1.8.13
borgmatic installation method
pipx install
Borg version
borg 1.2.8
Python version
Python 3.11.9
Database version (if applicable)
No response
Operating system and version
FreeBSD 13.2-RELEASE-p4
Thank you for the super detailed bug report. The good news is this was already fixed in main prior to your ticket being filed and will be part of the next release! (In case you're curious, here are the changesets:
d44dc93509and27e7ece2f5)Released in borgmatic 1.8.14!