From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id E07F25A0082 for ; Thu, 16 Feb 2023 23:22:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676586122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CGz+Hz99B2I4avedF1VWe56BPSJjkp5n1pXvO03G2VA=; b=ITlPpt0ewV7o8pcw5M1V8olQwXzNLtsYP/l0/mvXbR06/QLNCLE2SaTpw0LieJdPuNhd/K ks7tzmjNKnJDSlsubwOqhtYmeEtZLzlDOz7d/7W67FqGBO8iEU7sHiXHi3nMzXxcNgbnQ5 LdEsUfGxT+6F00TXN0zN4AHt+jrV/kI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-43-24EYj490OxqaxQ1u8F6i4Q-1; Thu, 16 Feb 2023 17:22:00 -0500 X-MC-Unique: 24EYj490OxqaxQ1u8F6i4Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD70E3810788 for ; Thu, 16 Feb 2023 22:21:59 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 858A31121314; Thu, 16 Feb 2023 22:21:59 +0000 (UTC) Date: Thu, 16 Feb 2023 23:21:46 +0100 From: Stefano Brivio To: Laine Stump Subject: Re: [PATCH v4 0/9] error logging fixes Message-ID: <20230216232146.49cbb208@elisabeth> In-Reply-To: <20230215082437.110151-1-laine@redhat.com> References: <20230215082437.110151-1-laine@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: P6PZQHSHDUBAFC2G4RGCGVZ2T4GMLTEJ X-Message-ID-Hash: P6PZQHSHDUBAFC2G4RGCGVZ2T4GMLTEJ X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, 15 Feb 2023 03:24:28 -0500 Laine Stump wrote: > 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() Applied. -- Stefano