From unknown Fri Jun 20 07:09:39 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#5710 <5710@debbugs.gnu.org> To: bug#5710 <5710@debbugs.gnu.org> Subject: Status: 23.1; Fatal error in format Reply-To: bug#5710 <5710@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:09:39 +0000 retitle 5710 23.1; Fatal error in format reassign 5710 emacs submitter 5710 Andreas Politz severity 5710 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 12 09:23:27 2010 Received: (at submit) by debbugs.gnu.org; 12 Mar 2010 14:23:27 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nq5ls-0004Dp-Mv for submit@debbugs.gnu.org; Fri, 12 Mar 2010 09:23:27 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nq4q6-0003o0-51 for submit@debbugs.gnu.org; Fri, 12 Mar 2010 08:23:43 -0500 Received: from mail.gnu.org ([199.232.76.166]:52680 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nq4q1-0002He-5T for submit@debbugs.gnu.org; Fri, 12 Mar 2010 08:23:37 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nq4pj-0006xK-Tp for submit@debbugs.gnu.org; Fri, 12 Mar 2010 08:23:36 -0500 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.1.0 Received: from lists.gnu.org ([199.232.76.165]:52441) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nq4pg-0006wK-IF for submit@debbugs.gnu.org; Fri, 12 Mar 2010 08:23:16 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nq4pf-00063r-B8 for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2010 08:23:15 -0500 Received: from [140.186.70.92] (port=42439 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nq4pd-00062K-Vy for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2010 08:23:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nq4pb-0005bN-Ia for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2010 08:23:13 -0500 Received: from gateway-b.fh-trier.de ([143.93.54.182]:58882) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nq4pb-0005Ry-9W for bug-gnu-emacs@gnu.org; Fri, 12 Mar 2010 08:23:11 -0500 Received: from raven (dslb-088-068-211-054.pools.arcor-ip.net [88.68.211.54]) (Authenticated sender: politza) by gateway-b.fh-trier.de (Postfix) with ESMTP id 8B5A417B48F for ; Fri, 12 Mar 2010 14:22:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=fh-trier.de; s=default; t=1268400164; bh=qp4L7eb3+zaaS5CvANsnm5VRcaY=; h=From:To:Subject: Date:Message-ID:MIME-Version:Content-Type; b=XHz0YnU1cH3zk6Fc//gSY qDO6qqOc4ku5CthBgdm98pyKV2NDp48olHYMwOOKi3xHjJhSsFO34v209irxSOCidj7 QhWTMc7eJ0+zAX0sDe1E2xXNiXNaIj5/51AsjcQ9eQEcsefEnedq/agtNI6V+E3McEY NPEgmetPnKyOdS18= From: Andreas Politz To: bug-gnu-emacs@gnu.org Subject: 23.1; Fatal error in format Date: Fri, 12 Mar 2010 14:22:44 +0100 Message-ID: <87vdd1ekt7.fsf@fh-trier.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum FH-Trier (r/ft)] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 12 Mar 2010 09:23:23 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. Please describe exactly what actions triggered the bug and the precise symptoms of the bug: (format "%16.s" "0123456789abcdef") makes emacs abort. This reflects the following situation in editfns.c : total = 5 + 5 + 1 = 11 field_width = 16 precision = 0 thissize = 0 actual_width = 16 thissize += max(0,16 - 16) = 0 total += 0 + 4 = 15 I think it is clearly a mistake to substract the width of the whole argument-string from the field_width, regardless of how much of it will actually end up in the result, depending on the precision mod. That's the basis for the following patch. diff --git a/src/editfns.c b/src/editfns.c index c2c5d26..b1af0fc 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3779,6 +3779,8 @@ usage: (format STRING &rest OBJECTS) */) the case PRECISION = 0. */ thissize = precision[n] ? CONVERTED_BYTE_SIZE (multibyte, args[n]) : 0; actual_width = lisp_string_width (args[n], -1, NULL, NULL); + if (precision[n] != -1) + actual_width = min(actual_width,precision[n]); } /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ else if (INTEGERP (args[n]) && *format != 's') If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. If you would like to further debug the crash, please read the file /usr/share/emacs/23.1/etc/DEBUG for instructions. In GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3) of 2009-11-02 on excelsior, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10605000 configured using `configure '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: C value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: C/l Minor modes in effect: diff-auto-refine-mode: t shell-dirtrack-mode: t narrow-stack-mode: t easy-repeat-mode: t recentf-mode: t ido-hacks-mode: t window-numbering-mode: t show-paren-mode: t icomplete-mode: t global-hi-lock-mode: t hi-lock-mode: t display-time-mode: t savehist-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t Recent input: u a l RET M-b M-s C-r C-r C-r C-r C-r C-s C-s RET C-x o M-m M-f M-f M-f M-b C-e C-j a c t u a M-/ SPC = SPC p r e c M-/ [ n ] SPC > SPC M-b M-b C-b C-b C-e M-m M-d M-d C-d C-d C-d i f SPC ( C-e C-h = SPC 0 ) M-b C-b C-h C-h ! = C-f C-d - 1 C-f C-j a c t u M-/ SPC = SPC m i n ( a c M-/ , p r e M-/ [ n ] ) ; C-c C-c C-p C-a C-2 M-; C-x C-g C-c C-c C-/ TAB C-n TAB C-p M-m C-k C-k M-f M-f M-f M-f C-p M-b M-b C-k C-n M-f M-b M-f M-f M-b C-y C-M-k C-h C-j C-f m a x ( 0 , M-f M-f C-f C-f ) TAB C-f C-p C-p C-a C-k C-M-f C-M-f C-M-f C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ M-f C-M-f M-v M-v M-v M-v C-v C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-v C-v C-s t h i s C-s C-s C-s RET C-r f i e l d RET C-v C-v C-v M-v C-/ C-f C-/ C-x v C-. C-x 1 C-, C-, C-x b C-x v C-. C-x v = y M-: M-p M-f M-f C-b . 1 M-: M-p ( l e n d t h C-h C-h C-h g t h SPC C-e ) M-1 M-x b u g p r e C-g M-x e m a c s - b u Recent messages: Auto-saving...done Redo! [2 times] Type "q" to restore this window. Type C-x 1 to delete the help window. Buffer editfns.c modified; save it? (y or n) Saving file /home/politza/src/emacs23/src/editfns.c... Wrote /home/politza/src/emacs23/src/editfns.c Finding changes in /home/politza/src/emacs23/src/editfns.c...done " H" 20 (#o24, #x14) Quit From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 13 14:57:25 2010 Received: (at 5710) by debbugs.gnu.org; 13 Mar 2010 19:57:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NqXSf-0002Dy-6l for submit@debbugs.gnu.org; Sat, 13 Mar 2010 14:57:25 -0500 Received: from pantheon-po34.its.yale.edu ([130.132.50.80]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NqXSd-0002Dt-Sw for 5710@debbugs.gnu.org; Sat, 13 Mar 2010 14:57:24 -0500 Received: from furry (173-14-147-246-NewEngland.hfc.comcastbusiness.net [173.14.147.246]) (authenticated bits=0) by pantheon-po34.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o2DJvI08027186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 13 Mar 2010 14:57:19 -0500 Received: by furry (Postfix, from userid 1000) id D52B2C011; Sat, 13 Mar 2010 14:57:18 -0500 (EST) From: Chong Yidong To: Andreas Politz , Stefan Monnier Subject: Re: 23.1; Fatal error in format Date: Sat, 13 Mar 2010 14:57:18 -0500 Message-ID: <87aaucgfkx.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 5710 Cc: 5710@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) > (format "%16.s" "0123456789abcdef") > > makes emacs abort. This reflects the following situation in editfns.c : > > total = 5 + 5 + 1 = 11 > field_width = 16 > precision = 0 > thissize = 0 > actual_width = 16 > > thissize += max(0,16 - 16) = 0 > total += 0 + 4 = 15 > > I think it is clearly a mistake to substract the width of the > whole argument-string from the field_width, regardless of how > much of it will actually end up in the result, depending > on the precision mod. Thanks. I agree with your analysis, and have checked your patch into the trunk. Stefan, I think it's worthwhile to include this patch in the release branch as well, though it's not a regression (it appears to be a longstanding bug). Aborts in `format' are not good. What's your opinion? From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 15 11:52:18 2010 Received: (at control) by debbugs.gnu.org; 15 Mar 2010 15:52:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NrCaY-0005DP-0L for submit@debbugs.gnu.org; Mon, 15 Mar 2010 11:52:18 -0400 Received: from pantheon-po25.its.yale.edu ([130.132.50.119]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NrCaW-0005DK-LH for control@debbugs.gnu.org; Mon, 15 Mar 2010 11:52:17 -0400 Received: from furry (dhcp128036014175.central.yale.edu [128.36.14.175]) (authenticated bits=0) by pantheon-po25.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o2FFqB0P001532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 15 Mar 2010 11:52:12 -0400 Received: by furry (Postfix, from userid 1000) id CA329C011; Mon, 15 Mar 2010 11:52:11 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 5710 Date: Mon, 15 Mar 2010 11:52:11 -0400 Message-ID: <87ocipa8gk.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) close 5710 thanks From unknown Fri Jun 20 07:09:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 13 Apr 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator