Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vkjv3ntkak7egz6g7gpu7ojel6nvrjjcf4fq7iymatmn7qkoai@6onkgtmfjpgu>
Date: Sun, 10 Mar 2024 06:01:14 +0000
From: NRK <nrk@...root.org>
To: Alejandro Colomar <alx@...nel.org>
Cc: Rich Felker <dalias@...c.org>, Guillem Jover <guillem@...rons.org>,
 	libc-alpha@...rceware.org, musl@...ts.openwall.com,
 libbsd@...ts.freedesktop.org, 	"Serge E. Hallyn" <serge@...lyn.com>,
 "Skyler Ferrante (RIT Student)" <sjf5462@....edu>,
 	Iker Pedrosa <ipedrosa@...hat.com>, Christian Brauner <christian@...uner.io>
Subject: Re: Re: Tweaking the program name for <err.h> functions

> What do you offer to use instead? snprintf(3) + perror(3) + exit(3)?

No need to have an intermediate buffer with snprintf when you can just
use vfprintf directly.

> I suggest you remove err.h from libc, and let a standalone library to
> implement them separately, allowing to configure them.

These are not mutually exclusive. You can have err.h in libc while also
having them as separate library.

And besides, these are not good interfaces anyways. Aside from what Rich
already said, you'll realize this soon when you need to use various
posix_* or pthread_* functions which don't set the errno and instead
return an error code.

Also, I don't think your fear of "NIH bug" is well grounded. This is not
some highly complicated error-prone code, it's just simple logging
facility.

I am aware that there exists certain programming cultures [*] where
having to write code instead of "import leftpad" is seen as taboo of the
highest order. But in this case you don't even *have to* write anything
when you can just copy err.c from musl and customize it.

(* Counterculture to this also exists, such as Go's "A little copying
is better than a little dependency" proverb for example.)

- NRK

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.