Subject: Re: port-xen/29887: sysctl kern.consdev coredumps
To: YAMAMOTO Takashi <email@example.com>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 06/20/2005 17:51:52
Content-Type: text/plain; charset=us-ascii
On Tue, Jun 21, 2005 at 09:04:49AM +0900, YAMAMOTO Takashi wrote:
> > > i really think this kind of "suppress coredump" thing is a bad practi=
> > > if you want explicit checks, _DIAGASSERT is for you.
> > I disagree. I think suppressing coredumpes is an excellent idea, where=
> > reasonable.
> > My day job is working on a shipping product. Core dumps are bad. Core=
> > dumps generate customer service issues, and impact the reliaility of th=
> > product. I would much rather have customers reporting logs like "Error =
> > with client (null)" than passing back stack traces.
> yes, "(null)" can be useful or dangerous, depending on the calling contex=
> however, there is no way for a library to know which is the case.
> fixing your product is appropriate because you know it's useful there.
But it's not broken.
While you are correct that the library has no way of knowing which of the
two choices it should use, our common practice for printf() has been to
not core dump. We have had that behavior since 4.4BSD, i.e. longer than
there has been a NetBSD. Thus BSD developers decided that not core dumping=
was the better choice overall.
You are the one who is championing making printf() and puts() and friends
core dump when passed NULL. That's changing behavior for printf(). Thus I=
believe you should be explaining to us how this will make our programs=20
better, rather than telling us to change our code.
I agree we should not make system libraries, by default, perform a lot of=
extra input validation. I believe that _DIAGASSERT is fine for them.=20
However I believe that printf() for the '%s' format and puts() are=20
different. I believe we should retain the printf "(null)" behavior and,=20
especially in light of the gcc optimization, we should extend the behavior=
to puts(). And that's it. I believe this as I see printf("%s") being used=
in error-case-logging code in programs, and I feel it is much simpler to=20
let "%s" deal with NULL than to make EVERY caller be defensive.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----