diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-06-19 20:10:10 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-06-21 15:32:28 +0200 |
commit | bca0fefa32e083ab46a49989f225ec34e7cdbb8c (patch) | |
tree | 8c0fe33d1548a10f1d1845abcc4982dde530567e /log.c | |
parent | b74801645c23bbb349df7522663f9ac253d6dc95 (diff) | |
download | passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.tar passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.tar.gz passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.tar.bz2 passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.tar.lz passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.tar.xz passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.tar.zst passt-bca0fefa32e083ab46a49989f225ec34e7cdbb8c.zip |
conf, passt: Make --stderr do nothing, and deprecate it
The original behaviour of printing messages to standard error by
default when running from a non-interactive terminal was introduced
because the first KubeVirt integration draft used to start passt in
foreground and get messages via standard error.
For development purposes, the system logger was more convenient at
that point, and passt was running from interactive terminals only if
not started by the KubeVirt integration.
This behaviour was introduced by 84a62b79a2bc ("passt: Also log to
stderr, don't fork to background if not interactive").
Later, I added command-line options in 1e49d194d017 ("passt, pasta:
Introduce command-line options and port re-mapping") and accidentally
reversed this condition, which wasn't a problem as --stderr could
force printing to standard error anyway (and it was used by KubeVirt).
Nowadays, the KubeVirt integration uses a log file (requested via
libvirt configuration), and the same applies for Podman if one
actually needs to look at runtime logs. There are no use cases left,
as far as I know, where passt runs in foreground in non-interactive
terminals.
Seize the chance to reintroduce some sanity here. If we fork to
background, standard error is closed, so --stderr is useless in that
case.
If we run in foreground, there's no harm in printing messages to
standard error, and that accidentally became the default behaviour
anyway, so --stderr is not needed in that case.
It would be needed for non-interactive terminals, but there are no
use cases, and if there were, let's log to standard error anyway:
the user can always redirect standard error to /dev/null if needed.
Before we're up and running, we need to print to standard error anyway
if something happens, otherwise we can't report failure to start in
any kind of usage, stand-alone or in integrations.
So, make --stderr do nothing, and deprecate it.
While at it, drop a left-over comment about --foreground being the
default only for interactive terminals, because it's not the case
anymore.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'log.c')
0 files changed, 0 insertions, 0 deletions