public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH v4 0/9] error logging fixes
@ 2023-02-15  8:24 Laine Stump
  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
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: Laine Stump @ 2023-02-15  8:24 UTC (permalink / raw)
  To: passt-dev

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


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-02-16 22:22 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15  8:24 [PATCH v4 0/9] error logging fixes Laine Stump
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

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).