From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 864D95A0050 for ; Wed, 19 Jun 2024 04:11:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1718763116; bh=n0yRzVyrPqc9kV/s4b7kWlLkwXyoJdayhtKXx7p6S1o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bKABLSommp6Ru/FQWfQSZaObRH5UuYYxDzgPTnIkvt6PhiPfIoXQr64sXw8T4/4dz z5vk1tfnFy/w2OcYdn10WPSHYHQ9Klhcc/fMei7HXQTKeYx1ZvHmbQtkbR2UOEimrR Ru+MmJxYOXOf1/bXtPPmPsK/QGxjhErt1kCpJBRbay/SPf4aeeaka3ueVcRIRp7767 tShySNIpECQBYodB9mBgG0MDtLFcd/0ukO3gV9W/UAD+Ut1Xe7xfuoCit3vxcRaMtW 1E77bUmsrF4ijckLmmdkF4SYOLpNKKgFJ18BepDCQoXTgHVc9fUObx2M0xg5D1SV0F PPw50MPrWEX9Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4W3nDr5ZDSz4wyl; Wed, 19 Jun 2024 12:11:56 +1000 (AEST) Date: Wed, 19 Jun 2024 12:11:51 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 4/6] log: Add _perror() logging function variants Message-ID: References: <20240617120319.1206857-1-sbrivio@redhat.com> <20240617120319.1206857-5-sbrivio@redhat.com> <20240618080216.2d873da2@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aJN/P4ryx/0GiCs6" Content-Disposition: inline In-Reply-To: <20240618080216.2d873da2@elisabeth> Message-ID-Hash: ZCUFWA5MPTOJ6Q6RED4SD74XZGG4BGEC X-Message-ID-Hash: ZCUFWA5MPTOJ6Q6RED4SD74XZGG4BGEC X-MailFrom: dgibson@gandalf.ozlabs.org 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, Yalan Zhang X-Mailman-Version: 3.3.8 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: --aJN/P4ryx/0GiCs6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 18, 2024 at 08:02:16AM +0200, Stefano Brivio wrote: > On Tue, 18 Jun 2024 10:46:36 +1000 > David Gibson wrote: >=20 > > On Mon, Jun 17, 2024 at 02:03:17PM +0200, Stefano Brivio wrote: > > > In many places, we have direct perror() calls, which completely bypass > > > logging functions and log files. > > >=20 > > > They are definitely convenient: offer similar convenience with > > > _perror() logging variants, so that we can drop those direct perror() > > > calls. > > >=20 > > > Signed-off-by: Stefano Brivio =20 > >=20 > > Hm, for anything bigger than like a screenful of code, I generally > > find an explicit message with strerror(errno) more useful than > > perror() or equivalents, but I guess if you think these are useful. >=20 > Okay, yes, it probably makes sense to have more descriptive messages as > you suggest in the comment to 5/6, but even then, we still have a lot > of cases like this one (from 6/6): >=20 > - warn("lseek() failed on /proc/net file: %s", strerror(errno)); > + warn_perror("lseek() failed on /proc/net file"); >=20 > where these _perror() variants make for tidier code, I find, regardless > of the error message itself. Eh, I mildly prefer the first variant. It is slightly longer, but makes it very clear where the strerror piece is going to appear in the context of the whole message. It's not a strong preference, though. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --aJN/P4ryx/0GiCs6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmZyPmYACgkQzQJF27ox 2GfcJA/+IYzv6Hsu36PfWUOoFVjFqd6D+1qcQ5A5oFtRGvdq3ha2l9c3WkRkTRId IHBUutY/twmVyEatfq4EzcDtwyLuY/q/tBL0wRRRC/RQiHagJwvUMaydfxTrC3fk kjd1S9dEQO7lMc7TnVUhjJVTjs3O9tkiauk1XyuAFZxG0sFOzBBsCaapeo/GOZAT MHLACVcnkiZ3Tw8mSGcC/Z9DhGOtRnfyCV89wDuYrVsfegdCPU24GiNMKe0pu/Pf CqOBXaXOgaq1g/2gONF/cH4onRFqi4MX1tD123isUCNxjJAUWFs7UhjjnmL18Bib jKNXRPZtws5TWHL4dYmLMOpZb1k8Fg8NRxSPKI4xkOIzu6UFGHhiLGMDHNHc+Crn 6RbxF2XNa57XIk2rSgfkT04+caDP+4xHNa8aXGsE8hUivcnanubmx3uV2PR+mNSB 7elWQv/24CnLxMUfOQRWgWBOxbA4tbncciOVSGOG6JQPubXOHLbhRR8QqsoQjOuo 68ECaz8Znm5LIhV+TCEjeU1FhPC2QPflwGxd9E/pnC6Hz29X06E7FJJ0n579e8wB VZhEyoF53InYnWW4XtzWyMefTKumRAUMVwE4ydYAQx6Im1PRiQqvi25aYhzfpc+E v+XP3zzF8OQwYuDTnhRwqYSG1jShKKWZqv1mSRl02RGg2WvIq8o= =fF7u -----END PGP SIGNATURE----- --aJN/P4ryx/0GiCs6--