Ill-formed redirection of stderr
to stdout
in sub-processes #485
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#485
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
Say, having a custom
ssh_command
, which can print errors tostderr
(ssh
can as well, but that's easier to reproduce).Steps to reproduce (if a bug)
Run
borgmatic ... info
with a customssh_command
that prints errors tostderr
.Actual behavior (if a bug)
Notice how
borgmatic
is spewing regularstdout
output ofinfo
together with errors fromssh_command
, i.e. them not being segregated tostderr
, even though the invoked subprocess HAD written them tostderr
in the first place.Expected behavior (if a bug)
Redirections to output file descriptors
stdout
andstderr
should be properly bound in order to naturally segregate outputs in a logical manner, not just forborgmatic
itself but also for any sub-processes that it invokes.Environment
borgmatic version: 1.5.21
Borg version: 1.1.17
Python version: 3.10.1
Sorry for the delay here. I looked at the borgmatic code for this, and it appears it's very intentionally sending sub-process stderr to borgmatic stdout for simplicity. Everything gets plumbed through Python's logging system, and where the logs go (stdout or stderr) depends entirely on the level of each individual log. (Error and critical logs end up on stderr, while other log levels go to stderr.) So "fixing" this would probably entail elevating all sub-process stderr output to borgmatic error logs. That way, they'd get logged back to stderr.