From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 10 17:24:34 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78A051065694 for ; Tue, 10 Nov 2009 17:24:34 +0000 (UTC) (envelope-from matthew.fleming@isilon.com) Received: from seaxch09.isilon.com (seaxch09.isilon.com [74.85.160.25]) by mx1.freebsd.org (Postfix) with ESMTP id 5B66C8FC12 for ; Tue, 10 Nov 2009 17:24:33 +0000 (UTC) x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Date: Tue, 10 Nov 2009 09:12:30 -0800 Message-ID: <06D5F9F6F655AD4C92E28B662F7F853E0338FCC2@seaxch09.desktop.isilon.com> In-Reply-To: <20091110165936.GC2331@deviant.kiev.zoral.com.ua> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [patch] burncd: honour for envar SPEED Thread-Index: AcpiJ1uWRDDQopBKSxK/tWFmRb32wgAAI49A References: <20091110165936.GC2331@deviant.kiev.zoral.com.ua> From: "Matthew Fleming" To: Subject: RE: [patch] burncd: honour for envar SPEED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 17:24:34 -0000 > 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