From: Jeff Norden <jnorden@tntech.edu>
To: Alan Mackenzie <acm@muc.de>
Cc: damien@cassou.me, 40317@debbugs.gnu.org
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 [thread overview]
Message-ID: <fdh7ruivz8.fsf@norden.tntech.edu> (raw)
In-Reply-To: <20200918201335.GE5497@ACM> (message from Alan Mackenzie on Fri, 18 Sep 2020 20:13:35 +0000)
> 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
next prev parent reply other threads:[~2020-09-18 22:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-29 13:26 bug#40317: 27.0.90; Reverting a buffer that visits C file signals an error Eli Zaretskii
2020-09-16 12:24 ` Damien Cassou
2020-09-16 14:26 ` Eli Zaretskii
2020-09-16 14:51 ` Damien Cassou
2020-09-16 15:09 ` Eli Zaretskii
2020-09-16 18:19 ` Damien Cassou
2020-09-18 1:21 ` Jeff Norden
2020-09-18 19:46 ` Damien Cassou
2020-09-18 20:13 ` Alan Mackenzie
2020-09-18 22:03 ` Jeff Norden [this message]
2020-09-19 7:35 ` Eli Zaretskii
2020-09-19 11:48 ` Alan Mackenzie
2020-09-20 17:25 ` Alan Mackenzie
2020-10-29 14:19 ` Damien Cassou
2022-02-20 15:11 ` Lars Ingebrigtsen
2022-02-21 10:09 ` Damien Cassou
2022-02-21 14:08 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fdh7ruivz8.fsf@norden.tntech.edu \
--to=jnorden@tntech.edu \
--cc=40317@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=damien@cassou.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).