From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Klausner Newsgroups: gmane.emacs.bugs Subject: bug#73307: Fix ctype(3) usage Date: Mon, 16 Sep 2024 23:25:16 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="i0B56l7oc1tpSdhG" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19293"; mail-complaints-to="usenet@ciao.gmane.io" To: 73307@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 16 23:26:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqJEf-0004mo-Vl for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Sep 2024 23:26:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqJEL-0003Iz-Al; Mon, 16 Sep 2024 17:25:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqJEG-0003HQ-CP for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 17:25:52 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sqJEC-0005F1-Cd for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 17:25:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:Subject; bh=WAaIhgnJcDtM4fks+sEzIGS/PmAW6G/Vi4U0rcUftYc=; b=sCq4nURYGvezBe6sazR4x//CDw5HZ9QkntfOVppgtIO+a1RqpLbau7jxkL3vuBlmlb345arT4lApFS/A6SRoMAucjKYtldQ2PkRZckqb4bjVKEfhpyd6/SBaMsSGsfDXWkvQL2zu2XGWpuvUKCCdP/LhKVsb9iHIWsG7z5bhrSql9i1hNtMP/vX/sgsOfXaHyk6V3OwoQmbL8ozcX+5NLPb3cGF52UsfVXFF82gruJNbk69O0qeT8Hz8cWrXsDIUYi8lY86v1r0aOV1I5iNKuVgeZ5NdDaG5uOpsCR7xVIYx1rlF0vEYOwBd5fvBe9GsFEtCpkRgXvW+t+rEsLlUhw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqJEQ-0001PL-39 for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Klausner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Sep 2024 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73307 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17265219395372 (code B ref -1); Mon, 16 Sep 2024 21:26:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Sep 2024 21:25:39 +0000 Original-Received: from localhost ([127.0.0.1]:53493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqJE3-0001Oa-E9 for submit@debbugs.gnu.org; Mon, 16 Sep 2024 17:25:39 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqJE2-0001OT-1u for submit@debbugs.gnu.org; Mon, 16 Sep 2024 17:25:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqJDn-0003Bl-N6 for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 17:25:24 -0400 Original-Received: from gatalith.at ([45.132.245.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqJDl-0005AL-IM for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 17:25:23 -0400 Original-Received: by gatalith.at (Postfix, from userid 1000) id 6584A3914F8; Mon, 16 Sep 2024 23:25:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gatalith.at; s=dkim; t=1726521917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=WAaIhgnJcDtM4fks+sEzIGS/PmAW6G/Vi4U0rcUftYc=; b=DOJ9WUZJUu7f1SWhO/dAFqoxr64/pmZH7n/pjwKIMayrZOOn9+bf2Op3VDjkEjBGUiV24/ 3+ATgM4Yc3aqZo3m6bLT9Vhsflajin7ojOjXkS0KMKr3vdRAY970Un2iBRQM/vbuT4wXRd 1DTcj1WUutkljYJeGgxJLlJDukC5eRw= Content-Disposition: inline Received-SPF: pass client-ip=45.132.245.72; envelope-from=wiz@gatalith.at; helo=gatalith.at X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291916 Archived-At: --i0B56l7oc1tpSdhG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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'' --i0B56l7oc1tpSdhG Content-Type: text/x-c; charset=us-ascii Content-Disposition: attachment; filename="patch-src_fns.c" $NetBSD$ Fix ctype(3) usage. --- src/fns.c.orig 2024-09-16 21:11:40.908684144 +0000 +++ src/fns.c @@ -3579,7 +3579,7 @@ by a mouse, or by some window-system ges { char *s = SSDATA (prompt); ptrdiff_t len = strlen (s); - if ((len > 0) && !isspace (s[len - 1])) + if ((len > 0) && !isspace ((unsigned char)s[len - 1])) prompt = CALLN (Fconcat, prompt, build_string (" ")); } prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt); --i0B56l7oc1tpSdhG--