[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DF41BB75-679F-4B6A-90F3-77DF228B6D3D@mac.com>
Date: Wed, 7 Nov 2007 05:56:05 -0500
From: Kyle Moffett <mrlinuxman@....com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "Ahmed S. Darwish" <darwish.07@...il.com>,
Adrian Bunk <bunk@...nel.org>,
Casey Schaufler <casey@...aufler-ca.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-security-module@...r.kernel.org,
LKML Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] Fix isspace() and other ctype.h functions to ignore chars 128-255
Originally isspace() and other similar functions in ctype.h ignored
any character with the high bit set; however this was changed during
the linux 2.1 days to map Latin-1. As following Latin-1 will most
likely break UTF-8 any any *other* encoding that is backwards-
compatible with 7-bit-ASCII, change ctype.c to ignore such characters
completely (the way they were before). Linus seems to think this is
a good thing, and he's the one that wrote the code in the first place.
Signed-off-by: Kyle Moffett <mrlinuxman@....com>
---
On Nov 06, 2007, at 10:53:08, Linus Torvalds wrote:
> On Tue, 6 Nov 2007, Kyle Moffett wrote:
>> Personally I think that isspace() accepting character 0xA0 is a bug
>
> I think I agree with you. As far as the kernel is concerned,
> "isspace()" should just accept the obvious spaces (hardspace, tab,
> newline), and *perhaps* the VT/FF kind of things.
>
> You should realize that the kernel <ctype.h> thing is *ancient*.
> It's basically there from v0.01, and while the really original one
> (I just checked) had all the non-ascii characters not trigger
> anything, it was converted to be latin1 in the 2.1.x timeframe.
>
> That's a *loong* time ago. Way before UTF-8 and other things were
> really common.
>
> So we should probably just make all the upper 128 bytes go back to
> "don't trigger anything in ctype.h" - they'd not be spaces, but
> they'd not be control characters or anything else either.
View attachment "fix-isspace-patch.txt" of type "text/plain" (1362 bytes)
Powered by blists - more mailing lists