From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#44349: 28.0.50; Assertion failure on macOS when resizing frame Date: Fri, 27 Nov 2020 22:24:29 +0000 Message-ID: <20201127222429.GD26836@breton.holly.idiocy.org> References: <83eelegxq6.fsf@gnu.org> <83a6w2gwxz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30542"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44349@debbugs.gnu.org, Philipp Stephani To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 27 23:25:11 2020 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 1kimAw-0007nv-3Q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Nov 2020 23:25:10 +0100 Original-Received: from localhost ([::1]:51650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kimAu-0001vR-MS for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Nov 2020 17:25:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kimAo-0001vJ-J1 for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2020 17:25:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kimAo-00027V-Bq for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2020 17:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kimAo-00021e-8Y for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2020 17:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Nov 2020 22:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44349 X-GNU-PR-Package: emacs Original-Received: via spool by 44349-submit@debbugs.gnu.org id=B44349.16065158837757 (code B ref 44349); Fri, 27 Nov 2020 22:25:02 +0000 Original-Received: (at 44349) by debbugs.gnu.org; 27 Nov 2020 22:24:43 +0000 Original-Received: from localhost ([127.0.0.1]:46494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kimAV-000213-8j for submit@debbugs.gnu.org; Fri, 27 Nov 2020 17:24:43 -0500 Original-Received: from wilbur.contactoffice.com ([212.3.242.68]:40426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kimAS-00020p-56 for 44349@debbugs.gnu.org; Fri, 27 Nov 2020 17:24:42 -0500 Original-Received: from smtpauth1.co-bxl (smtpauth1.co-bxl [10.2.0.15]) by wilbur.contactoffice.com (Postfix) with ESMTP id 8DC14D72; Fri, 27 Nov 2020 23:24:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1606515874; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; l=3321; bh=QrT+TVdBJH5HuHhl+1mqiZJ/5+xx/W8BKKeHYt7+enY=; b=O2oIf8PUQxzAD+OupcbAtGJky8jZ9dw4WBNbSDWzmXE2e0UKAcs4SldbncJb6iso 6YcwWi1WGPsgdWzUZTL4EpPLuVrhqn3H1hsvWK0orHmqbKMYoXwp5ybBEbNhNWXHfGv ArurFzIc9MZ/GI5YVoaHxIAg3DHTEYU1nXPwKCUetmj5hAV/zd8Fjdafl45rHPUS+Av uC3k2MjsubWRKtmarVVVzlzAFL2w4R9X8S02M75SeqEi1nuu0f5WEEa7sTKDJcOgEgd NSRHETKDc+N4XadC0O/z2C/e5yJWuBtuZUxZvmxYAQS/Puq9UHnaOSS8n/stA7r07Vd xW7q6++BlQ== Original-Received: by smtp.mailfence.com with ESMTPA ; Fri, 27 Nov 2020 23:24:31 +0100 (CET) Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 496FD202698775; Fri, 27 Nov 2020 22:24:30 +0000 (GMT) Mail-Followup-To: Alan Third , Eli Zaretskii , Philipp Stephani , 44349@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <83a6w2gwxz.fsf@gnu.org> X-ContactOffice-Account: com:241649512 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" Xref: news.gmane.io gmane.emacs.bugs:194463 Archived-At: --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Oct 31, 2020 at 06:52:08PM +0200, Eli Zaretskii wrote: > > From: Philipp Stephani > > Date: Sat, 31 Oct 2020 17:43:57 +0100 > > Cc: 44349@debbugs.gnu.org > > > > Am Sa., 31. Okt. 2020 um 17:35 Uhr schrieb Eli Zaretskii : > > > > > > > From: Philipp Stephani > > > > Date: Sat, 31 Oct 2020 16:57:54 +0100 > > > > > > > > > doprnt.c:493: Emacs fatal error: assertion failed: ASCII_CHAR_P (fmtchar) > > > > > Fatal error 6: Aborted > > > > > Abort trap: 6 > > > > > > I cannot say I understand why that assertion is there. > > > > Line 81 of doprnt.c states that non-ASCII characters aren't supported. > > I don't see why we would want to enforce that, it sounds like a grave > limitation. Maybe I'm missing some background here. The version we > have on emacs-27 does support non-ASCII characters in the format. Patch attached. I can't see any other special cases that need to be handled and all my tests worked, so I think this is all that's needed. -- Alan Third --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Allow-doprint-to-handle-multibyte-chars-in-format-bu.patch" >From 7bf4318f34c77e90c76944ee28693a895baf1807 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Fri, 27 Nov 2020 22:11:47 +0000 Subject: [PATCH] Allow doprint to handle multibyte chars in format (bug#44349) * src/doprnt.c (doprnt): Handle the case where fmtchar is the start of a multibyte character. --- src/doprnt.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/doprnt.c b/src/doprnt.c index 9316497720..841b8249c7 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -77,8 +77,7 @@ where flags is [+ -0], width is [0-9]+, precision is .[0-9]+, and length is empty or l or the value of the pD or pI or PRIdMAX (sans "d") macros. A % that does not introduce a valid %-sequence causes undefined behavior. - ASCII bytes in FORMAT other than % are copied through as-is; - non-ASCII bytes should not appear in FORMAT. + Bytes in FORMAT other than % are copied through as-is. The + flag character inserts a + before any positive number, while a space inserts a space before any positive number; these flags only affect %d, %o, @@ -486,14 +485,30 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, src = uLSQM, srclen = sizeof uLSQM - 1; else if (EQ (quoting_style, Qcurve) && fmtchar == '\'') src = uRSQM, srclen = sizeof uRSQM - 1; - else + else if (! LEADING_CODE_P (fmtchar)) { if (EQ (quoting_style, Qstraight) && fmtchar == '`') fmtchar = '\''; - eassert (ASCII_CHAR_P (fmtchar)); + *bufptr++ = fmtchar; continue; } + else + { + src = fmt0; + srclen = BYTES_BY_CHAR_HEAD (fmtchar); + + /* doprnt_non_null_end doesn't know about multibyte + characters so can truncate format in the middle of one. + If that happens just ignore that character. */ + for ( ; *fmt != 0 && fmt < src + srclen ; fmt++); + + if (fmt < src + srclen) + { + *bufptr++ = '\0'; + break; + } + } if (bufsize < srclen) { -- 2.26.1 --ikeVEW9yuYc//A+q--