X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-6.9 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4F1DD3A6.7060205@redhat.com>
Date: Mon, 23 Jan 2012 14:39:50 -0700
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: isprint core dump
References: <4F1DC95A.6020409@redhat.com> <2BF01EB27B56CC478AD6E5A0A28931F203DD4166@A1DAL1SWPES19MB.ams.acs-inc.net>
In-Reply-To: <2BF01EB27B56CC478AD6E5A0A28931F203DD4166@A1DAL1SWPES19MB.ams.acs-inc.net>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigA35BE23A9B40F63506035F1E"
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

--------------enigA35BE23A9B40F63506035F1E
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 01/23/2012 02:34 PM, Nellis, Kenneth wrote:
> From: Eric Blake
>=20
>> No, but it DOES come from POSIX:
>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/isprint.html
>>
>> And cygwin's behavior matches POSIX on this point; the bug is in your
>> program, not cygwin.
>=20
> Call me blown away by the level of support this function that
> dumps core is getting, when it could act sanely (IMHO) with a=20
> simple "if" statement! So much for defensive programming.

If you want defensive programming, write the defense into your program -
don't call functions with invalid arguments in the first place.  It
costs time to process an if() statement that would be reached by every
single caller, when 99.99% of the callers already comply with the
standards.  Meanwhile, since cygwin inherits its isprint()
implementation from newlib, and newlib caters to embedded systems, you
will be fighting an uphill battle to add anything that adds bloat that
slows down an embedded client.  We already get complaints about cygwin
being too slow, and you are proposing making it slower by doing
safety-net checking for buggy programs.  So we ask instead that you put
the if() in your program, and not in the core isprint() implementation.

--=20
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--------------enigA35BE23A9B40F63506035F1E
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPHdOmAAoJEKeha0olJ0Nqy9sH/iFwSs6Shrb7qkwCaD8f61Ge
PCJmI/XWGa1ahL2uz8zH6fbIW5bE47NATPJxqtWxpM7GTXLuMIcMRWEwuxW7NXiV
dSaMSyQm4bv6sUbgSYu1y2afdJ5WALA4sIrGG8FQFipKkKzB2P6auFeKtslbvcuP
X+eND4+dT5rWH0jnUpBan17dQScZe3FwqAQrdb3CIpimJTkFvTP1NYpGrLpivU6B
1C47vH9zL47BQ79RVORGKKGiiSG1MzalwdyEiUyEYJVY8SucxiJhuO9dSlpQFqaK
945/PFM/3rFggrW8yn4dUkX42atMdcJQaWh8G45xHEFHUXppOxUS5yqzFn0Wpa0=
=SrYP
-----END PGP SIGNATURE-----

--------------enigA35BE23A9B40F63506035F1E--
