GNU bug report logs - #40317
27.0.90; Reverting a buffer that visits C file signals an error

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Mon, 30 Mar 2020 02:36:22 UTC

Severity: normal

Tags: moreinfo

Found in version 27.0.90

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 40317 <at> debbugs.gnu.org (full text, mbox):

From: Jeff Norden <jnorden <at> tntech.edu>
To: Alan Mackenzie <acm <at> muc.de>
Cc: damien <at> cassou.me, eliz <at> gnu.org, 40317 <at> debbugs.gnu.org
Subject: Re: bug#40317: 27.0.90; Reverting a buffer that visits C file
 signals an error
Date: Fri, 18 Sep 2020 17:03:07 -0500
> 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




This bug report was last modified 3 years and 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.