Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2009 09:12:30 -0800
From:      "Matthew Fleming" <matthew.fleming@isilon.com>
To:        <freebsd-hackers@freebsd.org>
Subject:   RE: [patch] burncd: honour for envar SPEED
Message-ID:  <06D5F9F6F655AD4C92E28B662F7F853E0338FCC2@seaxch09.desktop.isilon.com>
In-Reply-To: <20091110165936.GC2331@deviant.kiev.zoral.com.ua>
References:  <permail-200911101550071e86ffa800005ac8-a_best01@message-id.uni-muenster.de><Pine.GSO.4.64.0911100756320.5432@zeno.ucsd.edu> <20091110165936.GC2331@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
> On Tue, Nov 10, 2009 at 08:03:26AM -0800, Nate Eldredge wrote:
> > On Tue, 10 Nov 2009, Alexander Best wrote:
> >
> > >ps: would be nice if strcasecmp could protect itself from segfault
> > >with one or both of the args being NULL.
> >
> > I disagree.  What do you think it should do instead?  Return 0?  If
it
> > did, would you have found your bug?
> >
> > [snip]
>=20
> I remember System V to actually map zero page at 0, thus causing all
> string functions to behave like it was supplied empty string when
argument
> is NULL. I believe Solaris still provides the library that could be
> LD_PRELOADed for the same effect.

Just an anecdote:

My sophomore year of undergrad (1994), I was learning C for the first
time.  We had to write some little thing, and on the machines in the lab
my C program ran great; I had debugged it (I thought) and turned it in.

The instructor took my source, compiled it on Linux, and it segfaulted
when run (I think trying to print a NULL string).

If HP-UX hadn't been trying to be "friendly" I would have been able to
fully debug my code.  I am sure that if I'd known then what I know now I
could have made it bug free.  But my experience is that a lot of code
is, by necessity, written by people who aren't experts in everything
they're doing.

So an early segfault would have helped me in that C programming class.
OTOH, if instead it had been an application someone paid money for, and
it segfaulted in an untested error case instead of being graceful, I'd
be mad too.  Probably at the app writer, but still...

Cheers,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06D5F9F6F655AD4C92E28B662F7F853E0338FCC2>