From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Norden Newsgroups: gmane.emacs.bugs Subject: bug#40317: 27.0.90; Reverting a buffer that visits C file signals an error Date: Fri, 18 Sep 2020 17:03:07 -0500 Message-ID: References: <83k1335m2e.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7157"; mail-complaints-to="usenet@ciao.gmane.io" Cc: damien@cassou.me, 40317@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 19 00:05:51 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 1kJOVq-0001eq-5a for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 00:05:50 +0200 Original-Received: from localhost ([::1]:53132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJOVp-0004VM-2O for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Sep 2020 18:05:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJOU6-0003f7-1l for bug-gnu-emacs@gnu.org; Fri, 18 Sep 2020 18:04:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33157) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJOU5-0006nC-OQ for bug-gnu-emacs@gnu.org; Fri, 18 Sep 2020 18:04:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJOU5-0008KU-Jw for bug-gnu-emacs@gnu.org; Fri, 18 Sep 2020 18:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jeff Norden Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Sep 2020 22:04:01 +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.160046659331963 (code B ref 40317); Fri, 18 Sep 2020 22:04:01 +0000 Original-Received: (at 40317) by debbugs.gnu.org; 18 Sep 2020 22:03:13 +0000 Original-Received: from localhost ([127.0.0.1]:44703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJOTJ-0008JS-F4 for submit@debbugs.gnu.org; Fri, 18 Sep 2020 18:03:13 -0400 Original-Received: from mta.tntech.edu ([149.149.2.87]:21543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJOTH-0008JK-QQ for 40317@debbugs.gnu.org; Fri, 18 Sep 2020 18:03:12 -0400 Original-Received: from math.tntech.edu (unknown [149.149.102.6]) by mta.tntech.edu (Postfix) with ESMTPS id 7BDB23000066; Fri, 18 Sep 2020 17:03:10 -0500 (CDT) Original-Received: from norden.tntech.edu ([149.149.102.4] helo=norden.math.tntech.edu) by math.tntech.edu with esmtp (Exim 4.92) (envelope-from ) id 1kJOTE-0001Ho-2I; Fri, 18 Sep 2020 17:03:08 -0500 Original-Received: by norden.math.tntech.edu (Postfix, from userid 742) id 061092572B73; Fri, 18 Sep 2020 17:03:07 -0500 (CDT) In-Reply-To: <20200918201335.GE5497@ACM> (message from Alan Mackenzie on Fri, 18 Sep 2020 20:13:35 +0000) X-SA-Spam-Score: 0.0 X-SA-Spam-Report: Spam detection software, running on the system "math.tntech.edu", has NOT identified this incoming email as spam. If you have any questions, contact @@CONTACT_ADDRESS@@ pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_HELO_TEMPERROR SPF: test of HELO record failed (temperror) 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:188355 Archived-At: > I've spent quite a long time looking at this, trying various means to > trigger the error (via `insert-file-contents' and `revert-buffer'). > > Then it suddenly dawned on me that the (setq c-new-END (.....)) is OK. > If the body of the the last `unless' has been run, (- end beg) and > old-len are equal to each other, and to the buffer length. So c-new-END > doesn't get changed in this case. Yup, I guess I was more tired than I realized when I sent that off last night, and jumped to a conclusion. So, I'll fall back to my original theory, which I changed when noticed the code that precedes the (setq c-new-END ...) line. 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))) This should produce a warnings window *and* a backtrace with the args-out-of-range error. Don't change the line above yet if the goal is to diagnose this. Assuming this does cause a combination warning and backtrace to occur, then I guess there are two choices: 1) Try to figure out how the after-change function gets called in this way, or 2) Just add a min to prevent c-new-END from exceeding point-max, and leave it at that. Regards, -Jeff