Re: [sharutils PATCH] build: avoid range errors in use of ctype functions

Bruce Korb <[email protected]> Tue, 06 Jan 2015 17:45:19 -0800
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
On 01/06/15 16:27, Eric Blake wrote:
> On platforms where 'char' is signed, using ctype functions on
> 'char' arguments produces undefined behavior for arguments that
> are larger than 127.  In particular, on Cygwin, isspace((char)255)
> MUST return the same 0 result as isspace(EOF), while there are some
> single-byte locales in which isspace((unsigned char)255) returns 1.

Ban such locales?  ;)  Ick.  Thank you so much for going through the
stuff.  I think I will fix the "%zu" thing by casting the argument
as unsigned int -- if for no other reason than to save translation effort.

> There are also a number of ctype abuses in libopts/makeshell.c,
> but as that file is generated rather than owned by sharutils, it
> will need to be fixed upstream in the autogen package.

I'll go chastise that upstream maintainer for you.
I've fixed the shartutils stuff, but the latter will take longer.
Thanks! - Bruce