Subject: Re: lib/34632
To: Antony Dovgal <email@example.com>
From: Quentin Garnier <firstname.lastname@example.org>
Date: 09/27/2006 09:37:41
Content-Type: text/plain; charset=us-ascii
On Wed, Sep 27, 2006 at 11:24:42AM +0400, Antony Dovgal wrote:
> On 27.09.2006 03:37, Christos Zoulas wrote:
> >On Sep 27, 1:50am, email@example.com (Antony Dovgal) wrote:
> >-- Subject: Re: lib/34632: isalpha() and possibly other ctype functions=
> >| On 27.09.2006 01:10, Christos Zoulas wrote:
> >| > This is not a bug. Undefined includes "segmentation fault". This is=
> >| > we cast to (unsigned char) in our sources.
> >| Ok, but I'm afraid you'd need to add this to the docs and inform such=
> >projects as: SQLite, PCRElib, libxml2 and many more which do not cast it=
> >to (unsigned char) either.
> >| Currently I can see similar "expected" behaviour only on Solaris, whic=
> >also segfaults in this case.
> >| Other systems (AIX, MacOS, various Linuxes) have chosen a user-friendl=
> >way and return 0.
> >Being friendly is a slippery slope.=20
> I would not expect a function that accepts *integer* to segfault if this=
> argument has a "wrong" value.
> Would you?
It depends who you are friendly to. If Linux had been as friendly to
the author of the code, then the bug would have been fixed.
Passing an incorrect value to isalpha() is a bug. It should not happen.
If the author is careless enough to do that, who knows how many bugs are
piling right after to use that 0 returned on Linux in wrong ways?
I am sorry that as a user you have to bear with the poor habits of bad
programmers, but in NetBSD we usually choose to help people write
This is the same reason our pthreads lib aborts when the behaviour it
should have is undefined.
> >What's next? Handling NULL pointers in strcpy()?
> I don't care, sorry. As long as it works for me on Linux you can do=20
> everything you want in NetBSD.
Now who's friendly, again?
> >As far as the documentation goes we can say "undefined behavior including
> >Segmentation faults". Is that good enough?
> I already explained you why I think it's not good enough.
> I mean, *I* can live with that because I don't use it, but "undefined=20
> value" in my pov doesn't include "segfault", I expect to get an undefined=
> integer value, that's it.
It's not "undefined value", it really is "undefined behaviour". There's
> Again, this is only my thoughts, you can do anything you like.
I really prefer knowing about real bugs than hiding them.
Quentin Garnier - firstname.lastname@example.org - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)
-----END PGP SIGNATURE-----