unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dima Kogan <dima@secretsauce.net>
Cc: 72165@debbugs.gnu.org
Subject: bug#72165: 31.0.50; Intermittent crashing with recent emacs build
Date: Mon, 29 Jul 2024 14:45:52 +0300	[thread overview]
Message-ID: <86cymwzaj3.fsf@gnu.org> (raw)
In-Reply-To: <87msm0ud0z.fsf@secretsauce.net> (message from Dima Kogan on Sun,  28 Jul 2024 19:50:52 -0700)

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 72165@debbugs.gnu.org
> Date: Sun, 28 Jul 2024 19:50:52 -0700
> 
> Alright. After some flailing I was able to make it crash with rr, so now
> I can see EVERYTHING. rr is truly a miracle, and figuring this out
> without it would have been impossible.

Thanks for persevering.

> Then on line 12177 we check if we're exceeding message-log-max, and if
> so, delete some stuff from the *Messages*.
> 
>   if (FIXNATP (Vmessage_log_max))
>     {
>       scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
>                     -XFIXNAT (Vmessage_log_max) - 1, false);
>       del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false);
>     }
> 
> In the failing sequence we delete some of the non-ascii characters. So
> the byte-char offset changes: it was 4 or 8 bytes, and it becomes 0 or 4
> bytes. At this point we're still correct. But very shortly after this,
> on line 12205 we restore the oldpoint into the current point. Since we
> just deleted stuff from the BEGINNING of the buffer, the oldpoint
> doesn't point to the same thing as before. Restoring it directly is
> wrong, but this normally doesn't cause crashes. The thing that causes
> crashing is that sometimes the byte-char offset in oldpoint is no longer
> correct, and we fail the consistency checks in redisplay_window().

I'm confused by the last part of your description.  The code which
resets point to 'oldpoint' is this:

      if (point_at_end)
	TEMP_SET_PT_BOTH (Z, Z_BYTE);
      else
	/* We can't do Fgoto_char (oldpoint) because it will run some
           Lisp code.  */
	TEMP_SET_PT_BOTH (marker_position (oldpoint),
			  marker_byte_position (oldpoint));

IOW, it uses 'oldpoint', which is a marker, not a simple number.  It
was initialized like this:

      oldpoint = message_dolog_marker1;
      set_marker_restricted_both (oldpoint, Qnil, PT, PT_BYTE);

Since 'oldpoint' is a marker, it should have been moved by
del_range_both so that it still points to the same text.  Moreover,
the char <-> byte correspondence was not supposed to be disrupted by
that.

So I think something else is at work here.  Can you show the data you
collected during the rr session?  Specifically, what are the character
and byte positions of 'oldpoint' before the call to del_range_both,
how many characters and bytes were deleted by del_range_both, and what
are the character and byte position of 'oldpoint' when we call
TEMP_SET_PT_BOTH in the snippet I show above?

One possibility is that the value of 'oldpoint' gets overwritten
somehow between the place it is set and the place it is used to
restore point.  But in that case we need to find the code which
overwrites it.





  reply	other threads:[~2024-07-29 11:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 20:56 bug#72165: 31.0.50; Intermittent crashing with recent emacs build Dima Kogan
2024-07-18  1:46 ` bug#72165: More info Dima Kogan
2024-07-18  5:09   ` bug#72165: 31.0.50; Intermittent crashing with recent emacs build Eli Zaretskii
2024-07-18  4:58 ` Eli Zaretskii
2024-07-18  7:25   ` Dima Kogan
2024-07-18  7:38     ` Dima Kogan
2024-07-18  9:07       ` Eli Zaretskii
2024-07-18  9:52     ` Eli Zaretskii
2024-07-19  7:27       ` Dima Kogan
2024-07-29  2:50         ` Dima Kogan
2024-07-29 11:45           ` Eli Zaretskii [this message]
2024-07-29 12:49             ` Dima Kogan
2024-07-30 16:21               ` Eli Zaretskii
2024-07-30 20:39                 ` Dima Kogan
2024-08-01 11:03                   ` Eli Zaretskii
2024-08-01 14:14                     ` Dima Kogan
2024-08-05  1:49                       ` Dima Kogan
2024-08-05  1:51                         ` Dima Kogan
2024-08-05  2:30                           ` Eli Zaretskii
2024-07-23 20:51 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-23 21:21   ` Dima Kogan

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=86cymwzaj3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72165@debbugs.gnu.org \
    --cc=dima@secretsauce.net \
    /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).