From: Laine Stump <laine@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH v4 0/9] error logging fixes
Date: Wed, 15 Feb 2023 03:24:28 -0500 [thread overview]
Message-ID: <20230215082437.110151-1-laine@redhat.com> (raw)
There are two topics covered here:
1) If a logFile is set, passt's behavior has been to send all error
messages there, and *not* to stderr. This makes it difficult for
another program that is exec'ing passt (and setting it to log to a
file) to report useful error messages when passt fails - everything
after the point that the logfile is opened is sent only to the
logfile. The first patch makes a simple change to the logging
functions that uses the value of the system logmask to decide if it
should force writing messages to stderr even when a logfile has been
specified.
Change from "v2": I'm using Stefano's suggestion of "abusing" logmask,
rather than adding a static bool to keep track.
Change from "v3": tweak a commend to Stefano's liking.
2) All the rest of the patches eliminate use of the blanket usage()
function when a commandline error is encountered (and add in
specific/details error messages when previously usage() was all that
was logged), and replace calls to err() followed by exit() with a
single call to the new function die().
Change from "v2": I changed the name of the "log and exit" function
from "errexit()" to "die()" at the suggestion of Dave Gibson (Stefano
concurred). Although it seems a bit more violent, it does make moot
many/most of Stefano's nits about needing to split lines to eliminate
> 80 characters (I did address all the rest of the things he pointed
out, though)
NB: Yes, this says it is v3, and the previous version I sent was v2,
and there *was no v1* - this is because I didn't realize that
git-publish is automatically incrementing the version number every
time I run it, and I had done a test-drive sending the patches to my
personal address prior to sending them to the list - *that* was v1.
Laine Stump (9):
log to stderr until process is daemonized, even if a log file is set
add die() to log an error message and exit with a single call
eliminate most calls to usage() in conf()
make conf_ports() exit immediately after logging error
make conf_pasta_ns() exit immediately after logging error
make conf_ugid() exit immediately after logging error
make conf_netns_opt() exit immediately after logging error
log a detailed error (not usage()) when there are extra non-option
arguments
convert all remaining err() followed by exit() to die()
conf.c | 468 ++++++++++++++++++++--------------------------------
isolation.c | 67 +++-----
log.c | 24 +--
log.h | 1 +
netlink.c | 3 +-
passt.c | 29 ++--
pasta.c | 20 +--
tap.c | 30 ++--
8 files changed, 244 insertions(+), 398 deletions(-)
--
2.39.1
next reply other threads:[~2023-02-15 8:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 8:24 Laine Stump [this message]
2023-02-15 8:24 ` [PATCH v4 1/9] log to stderr until process is daemonized, even if a log file is set Laine Stump
2023-02-15 11:54 ` Stefano Brivio
2023-02-16 5:30 ` David Gibson
2023-02-16 17:50 ` Stefano Brivio
2023-02-15 8:24 ` [PATCH v4 2/9] add die() to log an error message and exit with a single call Laine Stump
2023-02-16 5:31 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 3/9] eliminate most calls to usage() in conf() Laine Stump
2023-02-16 5:34 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 4/9] make conf_ports() exit immediately after logging error Laine Stump
2023-02-16 5:36 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 5/9] make conf_pasta_ns() " Laine Stump
2023-02-16 5:37 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 6/9] make conf_ugid() " Laine Stump
2023-02-16 5:38 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 7/9] make conf_netns_opt() " Laine Stump
2023-02-16 5:38 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 8/9] log a detailed error (not usage()) when there are extra non-option arguments Laine Stump
2023-02-16 5:39 ` David Gibson
2023-02-15 8:24 ` [PATCH v4 9/9] convert all remaining err() followed by exit() to die() Laine Stump
2023-02-16 5:40 ` David Gibson
2023-02-15 11:56 ` [PATCH v4 0/9] error logging fixes Stefano Brivio
2023-02-16 22:21 ` Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230215082437.110151-1-laine@redhat.com \
--to=laine@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).