|
From: | GNU bug Tracking System |
Subject: | bug#73307: closed (Fix ctype(3) usage) |
Date: | Wed, 18 Sep 2024 00:06:01 +0000 |
Your message dated Tue, 17 Sep 2024 17:05:29 -0700 with message-id <89deb908-92a6-489f-bab9-116556ce8ce4@cs.ucla.edu> and subject line Re: bug#73307: Fix ctype(3) usage has caused the debbugs.gnu.org bug report #73307, regarding Fix ctype(3) usage to be marked as done. (If you believe you have received this mail in error, please contact help-debbugs@gnu.org.) -- 73307: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73307 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems
--- Begin Message ---Subject: Fix ctype(3) usage Date: Mon, 16 Sep 2024 23:25:16 +0200 Tags: patch When compiling emacs on NetBSD-10.99.12/amd64, I get the following warning In file included from /usr/include/ctype.h:100, from fns.c:29: fns.c: In function 'Fyes_or_no_p': fns.c:3582:33: warning: array subscript has type 'char' [-Wchar-subscripts] 3582 | if ((len > 0) && !isspace (s[len - 1])) | ^ The NetBSD man page for ctype(3): https://man.netbsd.org/ctype.3 is quite explicit about the problems with this - ctype(3) functions only accept -1 and "unsigned char" and you can get very weird problems if this is disregarded. The attached patch adds the missing cast. In GNU Emacs 31.0.50 (build 1, x86_64--netbsd, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-09-16 Repository revision: f27553c30a772a0103d2e6762e4d7f588f302e4b Repository branch: HEAD System Description: NetBSD 10.99.12/amd64 Configured using: 'configure --srcdir=/scratch/wip/emacs-git/work/emacs --localstatedir=/var --with-native-compilation --without-ns --without-imagemagick --without-xaw3d --with-x-toolkit=gtk3 --prefix=/usr/pkg --build=x86_64--netbsd --host=x86_64--netbsd --infodir=/usr/pkg/info --mandir=/usr/pkg/man --enable-option-checking=yes 'CFLAGS=-O2 -g -g -fstack-clash-protection -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/libdrm' 'CPPFLAGS=-g -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/libdrm' 'LDFLAGS=-Wl,-R/usr/pkg/gcc14/lib -Wl,-zrelro -Wl,-znow -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib''patch-src_fns.c
Description: Text Data
--- End Message ---
--- Begin Message ---Subject: Re: bug#73307: Fix ctype(3) usage Date: Tue, 17 Sep 2024 17:05:29 -0700 User-agent: Mozilla Thunderbird 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
Description: Text Data0002-Fix-misuse-of-toupper-in-sfnt_parse_style.patch
Description: Text Data0003-Fix-some-misparsing-in-check_interpreter.patch
Description: Text Data0004-Use-c-ctype.h-in-lib-src.patch
Description: Text Data
--- End Message ---
[Prev in Thread] | Current Thread | [Next in Thread] |