GNU bug report logs - #73307
Fix ctype(3) usage

Previous Next

Package: emacs;

Reported by: Thomas Klausner <wiz <at> gatalith.at>

Date: Mon, 16 Sep 2024 21:26:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 73307-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 73307-done <at> debbugs.gnu.org,
 Thomas Klausner <wiz <at> gatalith.at>
Subject: Re: bug#73307: Fix ctype(3) usage
Date: Tue, 17 Sep 2024 17:05:29 -0700
[Message part 1 (text/plain, inline)]
On 2024-09-17 04:52, Eli Zaretskii wrote:
> However, I'm not sure this is the right fix, the function is
> defined with argument type of 'int'.  Paul, any comments?

Although that patch was an improvement it still had problems, as it 
incorrectly assumed the string does not end in a multibyte space, and 
that Emacs's locale matches the system's.

Emacs itself should not use <ctype.h> unless it knows the string is 
unibyte and the system locale matches Emacs's. I scanned through its 
source code looking for all problematic instances of <ctype.h> that have 
crept in (except I didn't scan the MS-Windows code, where you're the 
expert), and found five other places where ctype.h was obviously 
misused. I installed the attached to fix these glitches and am boldly 
closing this the report.

I can't easily test patch 0003, which fixes Android-specific code. 
Although I think it's an improvement, in unlikely cases I suspect it 
still doesn't exactly match what the Android kernel does with #! lines. 
I don't know whether that matters. I'll CC this to Po Lu (my goto person 
for Android) as a heads-up.
[0001-Fix-yes-or-no-p-with-multibyte-spaces.patch (text/x-patch, attachment)]
[0002-Fix-misuse-of-toupper-in-sfnt_parse_style.patch (text/x-patch, attachment)]
[0003-Fix-some-misparsing-in-check_interpreter.patch (text/x-patch, attachment)]
[0004-Use-c-ctype.h-in-lib-src.patch (text/x-patch, attachment)]

This bug report was last modified 297 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.