From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#40317: 27.0.90; Reverting a buffer that visits C file signals an error Date: Sat, 19 Sep 2020 11:48:12 +0000 Message-ID: <20200919114812.GB6057@ACM> References: <83zh5m2p8p.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4007"; mail-complaints-to="usenet@ciao.gmane.io" Cc: damien@cassou.me, 40317@debbugs.gnu.org, Jeff Norden To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 19 13:49:10 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 1kJbMc-0000vJ-EN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 13:49:10 +0200 Original-Received: from localhost ([::1]:37686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJbMb-0007pi-1u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 07:49:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJbMU-0007pM-Kc for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 07:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34239) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJbMU-00023i-Bj for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 07:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJbMU-0003HR-9i for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 07:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Sep 2020 11:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40317 X-GNU-PR-Package: emacs Original-Received: via spool by 40317-submit@debbugs.gnu.org id=B40317.160051610212555 (code B ref 40317); Sat, 19 Sep 2020 11:49:02 +0000 Original-Received: (at 40317) by debbugs.gnu.org; 19 Sep 2020 11:48:22 +0000 Original-Received: from localhost ([127.0.0.1]:45785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJbLp-0003GR-Tk for submit@debbugs.gnu.org; Sat, 19 Sep 2020 07:48:22 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:23989 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1kJbLn-0003GD-Oa for 40317@debbugs.gnu.org; Sat, 19 Sep 2020 07:48:20 -0400 Original-Received: (qmail 83510 invoked by uid 3782); 19 Sep 2020 11:48:13 -0000 Original-Received: from acm.muc.de (p2e5d565a.dip0.t-ipconnect.de [46.93.86.90]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sat, 19 Sep 2020 13:48:12 +0200 Original-Received: (qmail 7652 invoked by uid 1000); 19 Sep 2020 11:48:12 -0000 Content-Disposition: inline In-Reply-To: <83zh5m2p8p.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:188379 Archived-At: Hello, Eli. On Sat, Sep 19, 2020 at 10:35:18 +0300, Eli Zaretskii wrote: > > From: Jeff Norden > > Cc: 40317@debbugs.gnu.org, eliz@gnu.org, > > damien@cassou.me > > Date: Fri, 18 Sep 2020 17:03:07 -0500 > > Somehow, and I sure don't know how, I think that c-after-change gets > > called with: c-new-END already set to the value of point-max after the > > insertion; and with the other variables set so that that beg, end, and > > old-len remain unchanged. It's the only scenario that I can see that > > fits the backtrace that Eli posted. > > If Damien and/or Eli can temporarily try out the test that I suggested > > and get it to trigger, I think that would verify this. In fact, maybe > > warn would be even better: > > (if (> c-new-END (point-max)) > > (warn "c-new-END is too big! %d > %d" c-new-END (point-max))) > Unfortunately, the problem no longer happens to me, not in many > moons. Not sure why: I didn't change my usage patterns. The reason is the following patch, which was committed slightly before you reported the bug, but before you had updated your Emacs to include it: commit a3c2d186eb514b505e61c2a89a1df886dbfcb06b Author: Alan Mackenzie Date: Wed Mar 4 21:17:04 2020 +0000 CC Mode: Fix the handling of two adjacent after-change-functionses. The bug involved failing to set c-new-END correctly, which lead to an args-out-of-range error when after-change-functions was invoked twice without an intervening invocation of before-change-functions. * lisp/progmodes/cc-mode.el (c-after-change): Correct a coding error in the handling of c-just-done-before-change. What triggered the bug there was insert-file-contents not calling before-change-functions when called from revert-buffer. > Hopefully, Damien will be able to test this theory. Thanks. What Damien has found appears to be a bug distinct from the one you reported in March. -- Alan Mackenzie (Nuremberg, Germany).