From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73307: Fix ctype(3) usage Date: Tue, 17 Sep 2024 14:52:20 +0300 Message-ID: <86r09ibiq3.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33454"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73307@debbugs.gnu.org To: Thomas Klausner , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 17 13:53:07 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 1sqWlX-0008V3-1X for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 13:53:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqWlJ-0006VW-SV; Tue, 17 Sep 2024 07:52:53 -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 1sqWlE-0006Uw-Ja for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 07:52:48 -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 1sqWlD-00033S-D5 for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 07:52:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=tMe2wvesoIZEte4jcAQ36LLbIyv5z8DWqW+YpZ8vsUI=; b=Cv4iIX3RdysyNwNctykP9qy0P6TwYb0NlBNqMoOgv8DLmk3iBrSBso7xJ6aGFCEFC4OsezcVtXuCpYENrXr1His/uq0Ke6BWVXmdT2JSI+AirufRM6EtfS5TBtl/GQq7HdLNQPW5ZSw+akGuVByxARZC+GD1r4LS/4bH8ap7XuJOTBeRGriOW4a69fX6+rXE3OKvkDlfsliW5+WFdk+EGpvUVAltfjIwkQzYbQTfedJufQt+KRUteR4XKvbTtUC6GyuKY67QiQzRf3xly/1MihQ3z4G/FVS1YawfeMxKG6BG+6OHa1/C4hHIJfAtY0o7232xQDrUZhPPJdVkjEC6Uw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqWlR-0007iw-UK for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 07:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Sep 2024 11:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73307 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73307-submit@debbugs.gnu.org id=B73307.172657396729659 (code B ref 73307); Tue, 17 Sep 2024 11:53:01 +0000 Original-Received: (at 73307) by debbugs.gnu.org; 17 Sep 2024 11:52:47 +0000 Original-Received: from localhost ([127.0.0.1]:54124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqWlD-0007iJ-AJ for submit@debbugs.gnu.org; Tue, 17 Sep 2024 07:52:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqWlB-0007i4-B0 for 73307@debbugs.gnu.org; Tue, 17 Sep 2024 07:52:46 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqWkp-00031a-F4; Tue, 17 Sep 2024 07:52:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=tMe2wvesoIZEte4jcAQ36LLbIyv5z8DWqW+YpZ8vsUI=; b=dPiNxvhDAiIn Dmr3/uOrIZn+qZQ3YnNxL8WNkBlWX48rB9m+Q7U2y9KluuiRPON9iVoEpVTCuAH0+uLZRc2U+eNL6 EDmSpfRNTwS1uIBwTQtjXvG4IFsef5fA9jgTx0hHiTFWhRVhb8dRPn4jWeQ43fQk31LljqO7PDJ+F J2L8gQj0PSycvTRr5GM2WtXXKlaTKE5CwTmKTO880Xrempg+qD6t3LMzfhR8o+yadyCPx9sJNV06B xWc8l0cQxfobhJ6d7ifurQxCq6eRIm1ggzWjnzGvTpJf1XRdHcB8ZPHxXcXBtYYO1297GYhTQOfL1 Y6Q5Wj04tdqTMdaqFV2FSw==; In-Reply-To: (message from Thomas Klausner on Mon, 16 Sep 2024 23:25:16 +0200) 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:291933 Archived-At: > Date: Mon, 16 Sep 2024 23:25:16 +0200 > From: Thomas Klausner > > 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. > [...] > > --- 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); Thanks. However, I'm not sure this is the right fix, the function is defined with argument type of 'int'. Paul, any comments?