unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
@ 2024-07-17 20:56 Dima Kogan
  2024-07-18  1:46 ` bug#72165: More info Dima Kogan
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Dima Kogan @ 2024-07-17 20:56 UTC (permalink / raw)
  To: 72165

Hi.

I'm running a bleeding-edge build of emacs. Using packages from:

  https://emacs.secretsauce.net/

Debian GNU/Linux. GTK+. Currently using a build from git as of
2024/07/09 (8e46f44ea0e). It is crashing periodically, with an unclear
cause.

This isn't a brand-new problem; I observed a similar crash with an earlier
build: 2024/04/30 (d24981d27ce). After that crash I upgraded, and I see
crashes still.

Anecdotally, the 2024/04/30 build has been very stable. Today I started
to debug a different issue: something about mu4e modeline updating is
signalling args-out-of-range. To debug this I'm tweaking functions like
(truncate-string-to-width), and re-evaluating them. This debugging isn't
very interesting, but something about it is causing emacs to crash, with
both builds.

I just made a core. I cannot xbacktrace because (I think) I'm looking at
a core, and not at a live process. If that would be helpful, I can
probably get that. And I see the crash every 20min maybe, while
debugging the mu4e modeline problem. Below is the backtrace. Hopefully
this speaks to somebody. Thanks!

  (gdb) bt full
  #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
          tid = <optimized out>
          ret = 0
          pd = <optimized out>
          old_mask = {
            __val = {0}
          }
          ret = <optimized out>
  #1  0x00007fc68a4a6b7f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
  #2  0x00007fc68a4584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
          ret = <optimized out>
  #3  0x0000561d3dcb9798 in terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at ./debian/build-x/src/emacs.c:469
  #4  0x0000561d3dcb9d4e in emacs_abort () at ./debian/build-x/src/sysdep.c:2391
  #5  0x0000561d3dcb6c34 in redisplay_window (window=<optimized out>, just_this_one_p=just_this_one_p@entry=false) at ./debian/build-x/src/xdisp.c:20086
          w = 0x561d6bcb2bc8
          f = <optimized out>
          buffer = <optimized out>
          old = <optimized out>
          lpoint = {
            charpos = <optimized out>,
            bytepos = <optimized out>
          }
          opoint = {
            charpos = <optimized out>,
            bytepos = <optimized out>
          }
          startp = {
            charpos = <optimized out>,
            bytepos = <optimized out>
          }
          update_mode_line = <optimized out>
          tem = <optimized out>
          it = {
            window = 0x0,
            w = 0x0,
            f = 0x0,
            method = GET_FROM_BUFFER,
            stop_charpos = 0,
            prev_stop = 0,
            base_level_stop = 0,
            end_charpos = 0,
            medium_narrowing_begv = 0,
            medium_narrowing_zv = 0,
            large_narrowing_begv = 0,
            large_narrowing_zv = 0,
            s = 0x0,
            string_nchars = 0,
            multibyte_p = false,
            tab_line_p = false,
            header_line_p = false,
            string_from_display_prop_p = false,
            string_from_prefix_prop_p = false,
            from_disp_prop_p = false,
            ellipsis_p = false,
            avoid_cursor_p = false,
            dp = 0x0,
            dpvec = 0x0,
            dpend = 0x0,
            dpvec_char_len = 0,
            dpvec_face_id = 0,
            saved_face_id = 0,
            ctl_chars = {0x0 <repeats 16 times>},
            start = {
              pos = {
                charpos = 0,
                bytepos = 0
              },
              overlay_string_index = 0,
              string_pos = {
                charpos = 0,
                bytepos = 0
              },
              dpvec_index = 0
            },
            current = {
              pos = {
                charpos = 0,
                bytepos = 0
              },
              overlay_string_index = 0,
              string_pos = {
                charpos = 0,
                bytepos = 0
              },
              dpvec_index = 0
            },
            n_overlay_strings = 0,
            overlay_strings_charpos = 0,
            overlay_strings = {0x0 <repeats 16 times>},
            string_overlays = {0x0 <repeats 16 times>},
            string = 0x0,
            from_overlay = 0x0,
            stack = {{
                string = 0x0,
                string_nchars = 0,
                end_charpos = 0,
                stop_charpos = 0,
                prev_stop = 0,
                base_level_stop = 0,
                cmp_it = {
                  stop_pos = 0,
                  id = 0,
                  ch = 0,
                  rule_idx = 0,
                  lookback = 0,
                  nglyphs = 0,
                  reversed_p = false,
                  parent_it = 0x0,
                  charpos = 0,
                  nchars = 0,
                  nbytes = 0,
                  from = 0,
                  to = 0,
                  width = 0
                },
                face_id = 0,
                u = {
                  image = {
                    object = 0x0,
                    slice = {
                      x = 0x0,
                      y = 0x0,
                      width = 0x0,
                      height = 0x0
                    },
                    image_id = 0
                  },
                  stretch = {
                    object = 0x0
                  },
                  xwidget = {
                    object = 0x0
                  }
                },
                position = {
                  charpos = 0,
                  bytepos = 0
                },
                current = {
                  pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  overlay_string_index = 0,
                  string_pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  dpvec_index = 0
                },
                from_overlay = 0x0,
                area = LEFT_MARGIN_AREA,
                method = GET_FROM_BUFFER,
                paragraph_embedding = NEUTRAL_DIR,
                multibyte_p = false,
                string_from_display_prop_p = false,
                string_from_prefix_prop_p = false,
                display_ellipsis_p = false,
                avoid_cursor_p = false,
                bidi_p = false,
                from_disp_prop_p = false,
                line_wrap = TRUNCATE,
                voffset = 0,
                space_width = 0x0,
                font_height = 0x0
              }, {
                string = 0x0,
                string_nchars = 0,
                end_charpos = 0,
                stop_charpos = 0,
                prev_stop = 0,
                base_level_stop = 0,
                cmp_it = {
                  stop_pos = 0,
                  id = 0,
                  ch = 0,
                  rule_idx = 0,
                  lookback = 0,
                  nglyphs = 0,
                  reversed_p = false,
                  parent_it = 0x0,
                  charpos = 0,
                  nchars = 0,
                  nbytes = 0,
                  from = 0,
                  to = 0,
                  width = 0
                },
                face_id = 0,
                u = {
                  image = {
                    object = 0x0,
                    slice = {
                      x = 0x0,
                      y = 0x0,
                      width = 0x0,
                      height = 0x0
                    },
                    image_id = 0
                  },
                  stretch = {
                    object = 0x0
                  },
                  xwidget = {
                    object = 0x0
                  }
                },
                position = {
                  charpos = 0,
                  bytepos = 0
                },
                current = {
                  pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  overlay_string_index = 0,
                  string_pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  dpvec_index = 0
                },
                from_overlay = 0x0,
                area = LEFT_MARGIN_AREA,
                method = GET_FROM_BUFFER,
                paragraph_embedding = NEUTRAL_DIR,
                multibyte_p = false,
                string_from_display_prop_p = false,
                string_from_prefix_prop_p = false,
                display_ellipsis_p = false,
                avoid_cursor_p = false,
                bidi_p = false,
                from_disp_prop_p = false,
                line_wrap = TRUNCATE,
                voffset = 0,
                space_width = 0x0,
                font_height = 0x0
              }, {
                string = 0x0,
                string_nchars = 0,
                end_charpos = 0,
                stop_charpos = 0,
                prev_stop = 0,
                base_level_stop = 0,
                cmp_it = {
                  stop_pos = 0,
                  id = 0,
                  ch = 0,
                  rule_idx = 0,
                  lookback = 0,
                  nglyphs = 0,
                  reversed_p = false,
                  parent_it = 0x0,
                  charpos = 0,
                  nchars = 0,
                  nbytes = 0,
                  from = 0,
                  to = 0,
                  width = 0
                },
                face_id = 0,
                u = {
                  image = {
                    object = 0x0,
                    slice = {
                      x = 0x0,
                      y = 0x0,
                      width = 0x0,
                      height = 0x0
                    },
                    image_id = 0
                  },
                  stretch = {
                    object = 0x0
                  },
                  xwidget = {
                    object = 0x0
                  }
                },
                position = {
                  charpos = 0,
                  bytepos = 0
                },
                current = {
                  pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  overlay_string_index = 0,
                  string_pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  dpvec_index = 0
                },
                from_overlay = 0x0,
                area = LEFT_MARGIN_AREA,
                method = GET_FROM_BUFFER,
                paragraph_embedding = NEUTRAL_DIR,
                multibyte_p = false,
                string_from_display_prop_p = false,
                string_from_prefix_prop_p = false,
                display_ellipsis_p = false,
                avoid_cursor_p = false,
                bidi_p = false,
                from_disp_prop_p = false,
                line_wrap = TRUNCATE,
                voffset = 0,
                space_width = 0x0,
                font_height = 0x0
              }, {
                string = 0x0,
                string_nchars = 0,
                end_charpos = 0,
                stop_charpos = 0,
                prev_stop = 0,
                base_level_stop = 0,
                cmp_it = {
                  stop_pos = 0,
                  id = 0,
                  ch = 0,
                  rule_idx = 0,
                  lookback = 0,
                  nglyphs = 0,
                  reversed_p = false,
                  parent_it = 0x0,
                  charpos = 0,
                  nchars = 0,
                  nbytes = 0,
                  from = 0,
                  to = 0,
                  width = 0
                },
                face_id = 0,
                u = {
                  image = {
                    object = 0x0,
                    slice = {
                      x = 0x0,
                      y = 0x0,
                      width = 0x0,
                      height = 0x0
                    },
                    image_id = 0
                  },
                  stretch = {
                    object = 0x0
                  },
                  xwidget = {
                    object = 0x0
                  }
                },
                position = {
                  charpos = 0,
                  bytepos = 0
                },
                current = {
                  pos = {
                    charpos = 0,
                    bytepos = 0
                  },
                  overlay_string_index = 0,
                  string_pos = {
                    charpos = 8589934595,
                    bytepos = 395136991232
                  },
                  dpvec_index = 1
                },
                from_overlay = 0x0,
                area = ANY_AREA,
                method = 4294967295,
                paragraph_embedding = NEUTRAL_DIR,
                multibyte_p = false,
                string_from_display_prop_p = false,
                string_from_prefix_prop_p = false,
                display_ellipsis_p = false,
                avoid_cursor_p = false,
                bidi_p = false,
                from_disp_prop_p = false,
                line_wrap = TRUNCATE,
                voffset = 0,
                space_width = 0x0,
                font_height = 0x0
              }, {
                string = 0x7ffd9fd78e10,
                string_nchars = 0,
                end_charpos = 0,
                stop_charpos = 0,
                prev_stop = 0,
                base_level_stop = 92,
                cmp_it = {
                  stop_pos = 0,
                  id = 0,
                  ch = 0,
                  rule_idx = 0,
                  lookback = 0,
                  nglyphs = 0,
                  reversed_p = false,
                  parent_it = 0x0,
                  charpos = 524288,
                  nchars = 0,
                  nbytes = 0,
                  from = 0,
                  to = 0,
                  width = 0
                },
                face_id = 0,
                u = {
                  image = {
                    object = 0x0,
                    slice = {
                      x = 0x0,
                      y = 0x0,
                      width = 0xffffffff,
                      height = 0x0
                    },
                    image_id = 0
                  },
                  stretch = {
                    object = 0x0
                  },
                  xwidget = {
                    object = 0x0
                  }
                },
                position = {
                  charpos = 4294967296,
                  bytepos = 47244640265
                },
                current = {
                  pos = {
                    charpos = 47244640259,
                    bytepos = 42949672963
                  },
                  overlay_string_index = 42949672961,
                  string_pos = {
                    charpos = 1,
                    bytepos = 0
                  },
                  dpvec_index = 0
                },
                from_overlay = 0x0,
                area = LEFT_MARGIN_AREA,
                method = GET_FROM_BUFFER,
                paragraph_embedding = NEUTRAL_DIR,
                multibyte_p = false,
                string_from_display_prop_p = false,
                string_from_prefix_prop_p = false,
                display_ellipsis_p = false,
                avoid_cursor_p = false,
                bidi_p = false,
                from_disp_prop_p = false,
                line_wrap = TRUNCATE,
                voffset = 0,
                space_width = 0x0,
                font_height = 0x0
              }},
            sp = 0,
            selective = 0,
            what = IT_CHARACTER,
            face_id = 0,
            selective_display_ellipsis_p = false,
            ctl_arrow_p = false,
            face_box_p = false,
            start_of_box_run_p = false,
            end_of_box_run_p = false,
            overlay_strings_at_end_processed_p = false,
            ignore_overlay_strings_at_pos_p = false,
            glyph_not_available_p = false,
            starts_in_middle_of_char_p = false,
            face_before_selective_p = false,
            constrain_row_ascent_descent_p = false,
            line_number_produced_p = false,
            align_visually_p = false,
            line_wrap = TRUNCATE,
            base_face_id = 0,
            c = 0,
            len = 0,
            cmp_it = {
              stop_pos = 0,
              id = 0,
              ch = 0,
              rule_idx = 0,
              lookback = 0,
              nglyphs = 0,
              reversed_p = false,
              parent_it = 0x0,
              charpos = 0,
              nchars = 0,
              nbytes = 0,
              from = 0,
              to = 0,
              width = 0
            },
            char_to_display = 0,
            glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE,
            image_id = 0,
            xwidget = 0x0,
            slice = {
              x = 0x0,
              y = 0x0,
              width = 0x0,
              height = 0x0
            },
            space_width = 0x0,
            voffset = 0,
            tab_width = 0,
            font_height = 0x0,
            object = 0x0,
            position = {
              charpos = 0,
              bytepos = 0
            },
            truncation_pixel_width = 0,
            continuation_pixel_width = 0,
            first_visible_x = 0,
            last_visible_x = 0,
            last_visible_y = 0,
            extra_line_spacing = 0,
            max_extra_line_spacing = 0,
            override_ascent = 0,
            override_descent = 0,
            override_boff = 0,
            glyph_row = 0x0,
            area = LEFT_MARGIN_AREA,
            nglyphs = 0,
            pixel_width = 0,
            ascent = 0,
            descent = 0,
            max_ascent = 0,
            max_descent = 0,
            phys_ascent = 0,
            phys_descent = 0,
            max_phys_ascent = 0,
            max_phys_descent = 0,
            current_x = 0,
            wrap_prefix_width = 0,
            continuation_lines_width = 0,
            eol_pos = {
              charpos = 0,
              bytepos = 0
            },
            current_y = 0,
            first_vpos = 0,
            vpos = 0,
            hpos = 0,
            lnum = 0,
            lnum_bytepos = 0,
            lnum_width = 0,
            lnum_pixel_width = 0,
            pt_lnum = 0,
            stretch_adjust = 0,
            left_user_fringe_bitmap = 0,
            right_user_fringe_bitmap = 0,
            left_user_fringe_face_id = 0,
            right_user_fringe_face_id = 0,
            bidi_p = false,
            bidi_it = {
              bytepos = 0,
              charpos = 0,
              ch = 0,
              nchars = 0,
              ch_len = 0,
              type = UNKNOWN_BT,
              type_after_wn = UNKNOWN_BT,
              orig_type = UNKNOWN_BT,
              resolved_level = 0 '\000',
              isolate_level = 0 '\000',
              invalid_levels = 0,
              invalid_isolates = 0,
              prev = {
                charpos = 0,
                type = UNKNOWN_BT,
                orig_type = UNKNOWN_BT
              },
              last_strong = {
                charpos = 0,
                type = UNKNOWN_BT,
                orig_type = UNKNOWN_BT
              },
              next_for_neutral = {
                charpos = 0,
                type = UNKNOWN_BT,
                orig_type = UNKNOWN_BT
              },
              prev_for_neutral = {
                charpos = 0,
                type = UNKNOWN_BT,
                orig_type = UNKNOWN_BT
              },
              next_for_ws = {
                charpos = 0,
                type = UNKNOWN_BT,
                orig_type = UNKNOWN_BT
              },
              bracket_pairing_pos = 0,
              bracket_enclosed_type = UNKNOWN_BT,
              next_en_pos = 0,
              next_en_type = UNKNOWN_BT,
              sos = NEUTRAL_DIR,
              scan_dir = 0,
              disp_pos = 0,
              disp_prop = 0,
              stack_idx = 0,
              level_stack = {{
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                } <repeats 52 times>, {
                  next_for_neutral_pos = 140727285151856,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 0,
                  last_strong_type = 7,
                  prev_for_neutral_type = 1,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 140727285151848,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 6692952454725819392,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140727285151856,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 5,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 384,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 3,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 94683592258741,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140727285151856,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 5,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 94683591719329,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 4,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 94683593201994,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 6,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 22,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 33168,
                  next_for_neutral_type = 5,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 6,
                  next_for_neutral_type = 0,
                  last_strong_type = 2,
                  prev_for_neutral_type = 0,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 94683593203763,
                  next_for_neutral_type = 5,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 94683623854741,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 6,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 94683593201994,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 6,
                  next_for_neutral_type = 5,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140727285152152,
                  next_for_neutral_type = 0,
                  last_strong_type = 6,
                  prev_for_neutral_type = 6,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 6,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 94683623854741,
                  next_for_neutral_type = 0,
                  last_strong_type = 2,
                  prev_for_neutral_type = 1,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 6692952454725819392,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 2,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140490765053792,
                  next_for_neutral_type = 0,
                  last_strong_type = 5,
                  prev_for_neutral_type = 3,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 6692952454725819392,
                  next_for_neutral_type = 7,
                  last_strong_type = 1,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140490764807742,
                  next_for_neutral_type = 0,
                  last_strong_type = 2,
                  prev_for_neutral_type = 6,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 64424511301,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 94683879045328,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 6,
                  level = 134 '\206',
                  flags = 142 '\216'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 7,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 7,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 140490770859150,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 15,
                  next_for_neutral_type = 4,
                  last_strong_type = 7,
                  prev_for_neutral_type = 7,
                  level = 255 '\377',
                  flags = 255 '\377'
                }, {
                  next_for_neutral_pos = -168884986026394,
                  next_for_neutral_type = 5,
                  last_strong_type = 6,
                  prev_for_neutral_type = 2,
                  level = 237 '\355',
                  flags = 133 '\205'
                }, {
                  next_for_neutral_pos = 6692952454725819392,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140490765053792,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 35662986,
                  next_for_neutral_type = 7,
                  last_strong_type = 1,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140490764807742,
                  next_for_neutral_type = 5,
                  last_strong_type = 2,
                  prev_for_neutral_type = 2,
                  level = 196 '\304',
                  flags = 63 '?'
                }, {
                  next_for_neutral_pos = 64424511301,
                  next_for_neutral_type = 7,
                  last_strong_type = 7,
                  prev_for_neutral_type = 7,
                  level = 255 '\377',
                  flags = 255 '\377'
                }, {
                  next_for_neutral_pos = 94683879045328,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 6,
                  level = 134 '\206',
                  flags = 142 '\216'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 2,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 2,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 140490770859150,
                  next_for_neutral_type = 2,
                  last_strong_type = 2,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 15,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = -196480571978419,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 7,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 0,
                  last_strong_type = 2,
                  prev_for_neutral_type = 0,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 6,
                  prev_for_neutral_type = 1,
                  level = 253 '\375',
                  flags = 61 '='
                }, {
                  next_for_neutral_pos = 6692952454725819392,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 0,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140490765053792,
                  next_for_neutral_type = 1,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 35662986,
                  next_for_neutral_type = 7,
                  last_strong_type = 1,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 140490764807742,
                  next_for_neutral_type = 0,
                  last_strong_type = 2,
                  prev_for_neutral_type = 7,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 64424511301,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 94683879045328,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 6,
                  level = 134 '\206',
                  flags = 142 '\216'
                }, {
                  next_for_neutral_pos = 1,
                  next_for_neutral_type = 0,
                  last_strong_type = 4,
                  prev_for_neutral_type = 5,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 6,
                  level = 215 '\327',
                  flags = 159 '\237'
                }, {
                  next_for_neutral_pos = 140490770859150,
                  next_for_neutral_type = 1,
                  last_strong_type = 6,
                  prev_for_neutral_type = 5,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 15,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = -196480571978419,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }, {
                  next_for_neutral_pos = 0,
                  next_for_neutral_type = 0,
                  last_strong_type = 0,
                  prev_for_neutral_type = 0,
                  level = 0 '\000',
                  flags = 0 '\000'
                }},
              string = {
                lstring = 0x0,
                s = 0x0,
                schars = 0,
                bufpos = 0,
                from_disp_str = false,
                unibyte = false
              },
              w = 0x0,
              paragraph_dir = NEUTRAL_DIR,
              separator_limit = 0,
              first_elt = false,
              new_paragraph = false,
              frame_window_p = false
            },
            paragraph_embedding = NEUTRAL_DIR,
            min_width_property = 0x0,
            min_width_start = 0
          }
          current_matrix_up_to_date_p = false
          used_current_matrix_p = false
          temp_scroll_step = false
          rc = <optimized out>
          centering_position = -1
          last_line_misfit = false
          beg_unchanged = <optimized out>
          end_unchanged = <optimized out>
          frame_line_height = <optimized out>
          margin = <optimized out>
          use_desired_matrix = <optimized out>
          itdata = 0x0
  #6  0x0000561d3dd2db23 in redisplay_window_0 (window=window@entry=0x561d6bcb2bcd) at ./debian/build-x/src/xdisp.c:18032
  #7  0x0000561d3de860da in internal_condition_case_1
      (bfun=bfun@entry=0x561d3dd2daf0 <redisplay_window_0>, arg=arg@entry=0x561d6bcb2bcd, handlers=<optimized out>, hfun=hfun@entry=0x561d3dce3310 <redisplay_window_error>)
      at ./debian/build-x/src/eval.c:1637
          val = <optimized out>
          c = 0x561d3ef56ad0
  #8  0x0000561d3dcdfb3a in redisplay_windows (window=0x561d6bcb2bcd) at ./debian/build-x/src/xdisp.c:18001
          w = 0x561d6bcb2bc8
  #9  0x0000561d3dd14ea3 in redisplay_internal () at ./debian/build-x/src/xdisp.c:17400
          gcscrollbars = <optimized out>
          f = 0x561d6bcb2940
          w = <optimized out>
          sw = <optimized out>
          fr = <optimized out>
          pending = <optimized out>
          must_finish = <optimized out>
          match_p = <optimized out>
          tlbufpos = {
            charpos = <optimized out>,
            bytepos = <optimized out>
          }
          tlendpos = {
            charpos = <optimized out>,
            bytepos = <optimized out>
          }
          number_of_visible_frames = <optimized out>
          sf = <optimized out>
          polling_stopped_here = true
          tail = 0x561d6e1ae933
          frame = 0x561d6bcb2945
          hscroll_retries = <optimized out>
          garbaged_frame_retries = <optimized out>
          consider_all_windows_p = <optimized out>
          update_miniwindow_p = <optimized out>
  #10 0x0000561d3dd16509 in redisplay () at ./debian/build-x/src/xdisp.c:16575
  #11 0x0000561d3de018d7 in read_char (commandflag=1, map=map@entry=0x561d6dc6f213, prev_event=0x0, used_mouse_menu=used_mouse_menu@entry=0x7ffd9fd7bc8b, end_time=end_time@entry=0x0)
      at ./debian/build-x/src/keyboard.c:2678
          echo_current = false
          c = <optimized out>
          local_getcjmp = {{
              __jmpbuf = {94683599852320, 5898495886293811139, 140490622174464, 0, 1, 1, 5898495886388182979, 151695970901639107},
              __mask_was_saved = 0,
              __saved_mask = {
                __val = {0, 140727285168672, 140490622174584, 140490622174584, 0, 0, 128770, 0, 32191, 32193, 6692952454725819392, 12884901888, 94683623736432, 94683615050064, 2, 140727285168720}
              }
            }}
          save_jump = {{
              __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 0},
              __mask_was_saved = 0,
              __saved_mask = {
                __val = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94683592684623, 0, 0, 2, 94683592073760, 140727285162272}
              }
            }}
          tem = <optimized out>
          save = <optimized out>
          previous_echo_area_message = 0x0
          also_record = 0x0
          reread = false
          recorded = false
          polling_stopped_here = false
          orig_kboard = 0x561d3f9e1b40
  #12 0x0000561d3de04ba2 in read_key_sequence
      (keybuf=keybuf@entry=0x7ffd9fd7bdf0, prompt=prompt@entry=0x0, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, disable_text_conversion_p=false) at ./debian/build-x/src/keyboard.c:10743
          interrupted_kboard = 0x561d3f9e1b40
          interrupted_frame = 0x561d6bcb2940
          key = <optimized out>
          used_mouse_menu = false
          echo_local_start = 0
          last_real_key_start = 0
          keys_local_start = 0
          new_binding = <optimized out>
          t = 0
          echo_start = 0
          keys_start = 0
          current_binding = 0x561d6dc6f213
          first_unbound = 31
          mock_input = 0
          used_mouse_menu_history = {false <repeats 30 times>}
          fkey = {
            parent = 0x7fc6835340d3,
            map = 0x7fc6835340d3,
            start = 0,
            end = 0
          }
          keytran = {
            parent = 0x7fc68609cdeb,
            map = 0x7fc68609cdeb,
            start = 0,
            end = 0
          }
          indec = {
            parent = 0x7fc6835340e3,
            map = 0x7fc6835340e3,
            start = 0,
            end = 0
          }
          shift_translated = <optimized out>
          delayed_switch_frame = <optimized out>
          original_uppercase_position = <optimized out>
          disabled_conversion = <optimized out>
          fake_prefixed_keys = 0x0
          first_event = 0x0
          second_event = <optimized out>
  #13 0x0000561d3de06d18 in command_loop_1 () at ./debian/build-x/src/keyboard.c:1429
          cmd = <optimized out>
          keybuf = {0x561d6dc6f973, 0x5ce224cbfa82dc00, 0xa0, 0x60, 0x0, 0x0, 0x111f0, 0x561d3df83ba8, 0x7ffd9fd7bea0, 0x561d3de874b3 <unbind_to+259>, 0x7ffd9fd7bec0, 0x2, 0xb, 0x111f0, 0x30, 0x561d6d06628d, 0x7fc68572e9cc, 0x561d6ca84763, 0x60, 0x7ffd9fd7bec0, 0x2, 0x7ffd9fd7e3ae, 0x7ffd9fd7bf20, 0x561d3ddfa492 <cmd_error+370>, 0x0, 0x0, 0xb300, 0x561d3df83ba8, 0x7ffd9fd7bf40, 0x561d3de874b3 <unbind_to+259>}
          i = <optimized out>
          last_pt = <optimized out>
          prev_modiff = 3094
          prev_buffer = 0x561d6d066288
  #14 0x0000561d3de8603e in internal_condition_case (bfun=bfun@entry=0x561d3de06b40 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x561d3ddfa320 <cmd_error>)
      at ./debian/build-x/src/eval.c:1613
          val = <optimized out>
          c = 0x561d3ef4cce0
  #15 0x0000561d3ddf1e66 in command_loop_2 (handlers=handlers@entry=0x90) at ./debian/build-x/src/keyboard.c:1168
          val = <optimized out>
  #16 0x0000561d3de85f97 in internal_catch (tag=tag@entry=0x12300, func=func@entry=0x561d3ddf1e30 <command_loop_2>, arg=arg@entry=0x90) at ./debian/build-x/src/eval.c:1292
          val = <optimized out>
          c = 0x561d3efe0280
  #17 0x0000561d3ddf1df1 in command_loop () at ./debian/build-x/src/keyboard.c:1146
  #18 0x0000561d3ddf9e59 in recursive_edit_1 () at ./debian/build-x/src/keyboard.c:754
          val = <optimized out>
  #19 0x0000561d3ddfa21c in Frecursive_edit () at ./debian/build-x/src/keyboard.c:837
          buffer = <optimized out>
  #20 0x0000561d3dcc2f9d in main (argc=2, argv=0x7ffd9fd7c2e8) at ./debian/build-x/src/emacs.c:2624
          stack_bottom_variable = 0x561d3eecc050
          old_argc = <optimized out>
          no_loadup = false
          junk = 0x0
          dname_arg = 0x0
          ch_to_dir = 0x0
          original_pwd = <optimized out>
          dump_mode = <optimized out>
          skip_args = 1
          temacs = 0x0
          attempt_load_pdump = <optimized out>
          only_version = false
          rlim = {
            rlim_cur = 10022912,
            rlim_max = 18446744073709551615
          }
          lc_all = <optimized out>
          sockfd = -1
          module_assertions = <optimized out>






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: More info
  2024-07-17 20:56 bug#72165: 31.0.50; Intermittent crashing with recent emacs build Dima Kogan
@ 2024-07-18  1:46 ` 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-23 20:51 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-07-18  1:46 UTC (permalink / raw)
  To: 72165

I looked at the backtrace a bit. Here's the failing assert:

  https://github.com/dkogan/emacs-snapshot/blob/439ec471961b764b51483b74ea13777ed560fd74/src/xdisp.c#L20086

This is false:

  Z == Z_BYTE && CHARPOS (opoint) != BYTEPOS (opoint)

The backtrace is silent about the specific values of each of these, but
I can try to get them. Debugging suggestions welcome.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  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  4:58 ` Eli Zaretskii
  2024-07-18  7:25   ` Dima Kogan
  2024-07-23 20:51 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-07-18  4:58 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> From: Dima Kogan <dima@secretsauce.net>
> Date: Wed, 17 Jul 2024 13:56:27 -0700
> 
> I'm running a bleeding-edge build of emacs. Using packages from:
> 
>   https://emacs.secretsauce.net/
> 
> Debian GNU/Linux. GTK+. Currently using a build from git as of
> 2024/07/09 (8e46f44ea0e). It is crashing periodically, with an unclear
> cause.
> 
> This isn't a brand-new problem; I observed a similar crash with an earlier
> build: 2024/04/30 (d24981d27ce). After that crash I upgraded, and I see
> crashes still.
> 
> Anecdotally, the 2024/04/30 build has been very stable. Today I started
> to debug a different issue: something about mu4e modeline updating is
> signalling args-out-of-range. To debug this I'm tweaking functions like
> (truncate-string-to-width), and re-evaluating them. This debugging isn't
> very interesting, but something about it is causing emacs to crash, with
> both builds.

So when you say that "anecdotally, the 2024/04/30 build has been very
stable", what exactly do you mean?  It sounds like both that build and
the one from 2024/07/09 crash in the same way, so why do you consider
the April one "very stable"?

> I just made a core. I cannot xbacktrace because (I think) I'm looking at
> a core, and not at a live process. If that would be helpful, I can
> probably get that. And I see the crash every 20min maybe, while
> debugging the mu4e modeline problem. Below is the backtrace. Hopefully
> this speaks to somebody. Thanks!

Thanks, but please always try to supply the information that explains
the crash, not just the backtrace.  (In this case, it's a deliberate
abort, not a crash, but still.)  That means look at the source code
where GDB says the problem happens and print the values of the
variables involved in the crash.  In this case:

>   (gdb) bt full
>   #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
>           tid = <optimized out>
>           ret = 0
>           pd = <optimized out>
>           old_mask = {
>             __val = {0}
>           }
>           ret = <optimized out>
>   #1  0x00007fc68a4a6b7f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
>   #2  0x00007fc68a4584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
>           ret = <optimized out>
>   #3  0x0000561d3dcb9798 in terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at ./debian/build-x/src/emacs.c:469
>   #4  0x0000561d3dcb9d4e in emacs_abort () at ./debian/build-x/src/sysdep.c:2391
>   #5  0x0000561d3dcb6c34 in redisplay_window (window=<optimized out>, just_this_one_p=just_this_one_p@entry=false) at ./debian/build-x/src/xdisp.c:20086

The call to emacs_abort seems to be here:

  /* Some sanity checks.  */
  CHECK_WINDOW_END (w);
  if (Z == Z_BYTE && CHARPOS (opoint) != BYTEPOS (opoint))
    emacs_abort ();  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Now, your "bt full" doesn't help to understand what went wrong because
GDB is unable to find the values of many variables:

>           w = 0x561d6bcb2bc8
>           f = <optimized out>
>           buffer = <optimized out>
>           old = <optimized out>
>           lpoint = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }
>           opoint = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }

Still, at least Z and Z_BYTE should be available; what are their
values?

And regarding opoint, look back in the code a small ways to where it
was defined:

  SET_TEXT_POS (opoint, PT, PT_BYTE);

If you look up the definition of SET_TEXT_POS, you will see:

  /* Set character position of POS to CHARPOS, byte position to BYTEPOS.  */

  #define SET_TEXT_POS(POS, CHARPOS, BYTEPOS) \
       ((POS).charpos = (CHARPOS), (POS).bytepos = BYTEPOS)

which means opoint takes its character position from PT and its byte
position from PT_BYTE.  So if you print the values of PT and PT_BYTE,
we will know the ("optimized-out") values of opoint.charpos and
opoint.bytepos, and will probably be able to understand why we
aborted.  IOW:

  (gdb) frame 5
  (gdb) print Z
  (gdb) print Z_BYTE
  (gdb) print PT
  (gdb) pt PT_BYTE

(The "frame 5" command is to get to the callstack frame where we call
emacs_abort, shown as #5 at the right edge of the backtrace line.)

If GDB says it doesn't know about these variables with up-cased names,
like Z and PT_BYTE, it means your Emacs was built without macro
information (the -g3 compiler option), and you will need to type the
macro definitions instead.  For example (from buffer.h):

  #define PT (current_buffer->pt + 0)

So instead of "print PT" you will need to say "print current_buffer->pt".
And similarly with other variables above.

Next question is: what buffer did Emacs try to display?  To answer
that, print the name of the buffer that is current in this place in
the code:

  (gdb) print current_buffer->name_
  (gdb) xstring

If GDB says it doesn't know what "xstring" is, type:

  (gdb) source /path/to/emacs/src/.gdbinit

and then repeat the above 2 commands.

Once you know which buffer was being displayed, try to describe the
text that was in it, if you can.  (If you cannot, I can give
instructions how to find it out using GDB commands.)

Thanks.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-18  1:46 ` bug#72165: More info Dima Kogan
@ 2024-07-18  5:09   ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-07-18  5:09 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

[Please don't change the Subject line when you reply, to avoid
confusing the bug tracker and disrupting MUA threading.]

> From: Dima Kogan <dima@secretsauce.net>
> Date: Wed, 17 Jul 2024 18:46:11 -0700
> 
> I looked at the backtrace a bit. Here's the failing assert:
> 
>   https://github.com/dkogan/emacs-snapshot/blob/439ec471961b764b51483b74ea13777ed560fd74/src/xdisp.c#L20086
> 
> This is false:
> 
>   Z == Z_BYTE && CHARPOS (opoint) != BYTEPOS (opoint)

Did you mean "true" instead if "false"?  If the above is false, then
the call to emacs_abort after that if could not have possible been the
one which caused the abort.  The line number information in an
optimized build could be inaccurate, so it is important to establish
which condition caused the abort.

> The backtrace is silent about the specific values of each of these, but
> I can try to get them. Debugging suggestions welcome.

See my other message.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  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:52     ` Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: Dima Kogan @ 2024-07-18  7:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

Thank you very much for replying, Eli.


> So when you say that "anecdotally, the 2024/04/30 build has been very
> stable", what exactly do you mean? It sounds like both that build and
> the one from 2024/07/09 crash in the same way, so why do you consider
> the April one "very stable"?

Sorry, I wasn't clear. I've been using the April build for many months,
and haven't seen any crashing at all until today. Today I tried to debug
the mu4e modeline problem, and saw it crash. Then I updated to the
latest build (2024/07/09) hoping it would be fixed, and kept seeing
crashing, as I continued to debug. So whatever the problem is, it
started in April or earlier.

Here're some notes about the mu4e problem that looks correlated with
this crash, maybe. I'm hazy on the details here, so there's no bug
report yet, but I've at least pinpointed the mechanism.
truncate-string-to-width() in international/mule-util.el has

  (condition-case nil
      (while (< column end-column)
        (setq last-column column
              last-idx idx
              ch (aref str idx)
              column (+ column (char-width ch))
              idx (1+ idx)))
    (args-out-of-range (setq idx str-len)))

The intent was that we might have idx >= length(str), so (aref str idx)
would signal args-out-of-range, and the condition-case would catch it.
But this is reliably not happening under some (probably over-specified)
conditions:

- mu4e is running, with multiple mail contexts; it shows the selected
  context in its modeline, which eventually calls
  truncate-string-to-width()
- I have some remote file opened with TRAMP
- I run (shell-command) from the remote buffer

In at least this scenario, args-out-of-range errors from the above (aref
...) are uncaught (100% of the time with my config), and appear in the
*Messages* buffer. I was debugging this by tweaking and re-evaluating my
local copy of truncate-string-to-width() and other related functions in
the *scratch* buffer, while looking at the *Messages* buffer in another
window. Will get back to this in a sec.

Here's what I see in the core dump:

  (gdb) p current_thread->m_current_buffer->text->z
  $22 = 32192

  (gdb) p current_thread->m_current_buffer->text->z_byte
  $23 = 32178

  (gdb) p current_thread->m_current_buffer->pt
  $24 = 32192

  (gdb) p current_thread->m_current_buffer->pt_byte
  $25 = 32178

So that tells me that the failing condition isn't the one gdb flagged,
but the one immediately after:

  if (BYTEPOS (opoint) < CHARPOS (opoint))
    emacs_abort ();

The compiler optimizations could be responsible for the discrepancy. Am
I understanding correctly that this check makes sure that BYTEPOS >=
CHARPOS, which must always be true because sizeof(emacs character) is
always >= 1byte?

The buffer name:

  (gdb) p current_thread->m_current_buffer->name_
  $26 = XIL(0x7fc685b24c1c)

  (gdb) xstring
  $27 = (struct Lisp_String *) 0x7fc685b24c18
  "*Messages*"

I confirm that the text is our own text:

  (gdb) p &current_thread->m_current_buffer->own_text
  $43 = (struct buffer_text *) 0x7fc685a107e0

  (gdb) p current_thread->m_current_buffer->text
  $44 = (struct buffer_text *) 0x7fc685a107e0

The full structure:

  (gdb) p current_thread->m_current_buffer->own_text
  $45 = {
    beg                        = 0x561d7100f800 ...
    z                          = 32192,
    z_byte                     = 32178,
    gpt                        = 32191,
    gpt_byte                   = 32177,
    gap_size                   = 1313,
    modiff                     = 69879,
    chars_modiff               = 69879,
    save_modiff                = 1,
    overlay_modiff             = 10,
    compact                    = 53392,
    beg_unchanged              = 0,
    end_unchanged              = 0,
    unchanged_modified         = 69373,
    overlay_unchanged_modified = 6,
    intervals                  = 0x0,
    markers                    = 0x561d6da79bc0,
    inhibit_shrinking          = false,
    redisplay                  = true
  }

Looks like gpt and gpt_byte have a similar inconsistency as z and zbyte.
Looking at the definitions in buffer.h, I guess the above means that the
gap starts at gpt_byte-1 = 32176

Let's look at the last bit of the buffer:

  (gdb) printf "%.2200s\n", &current_thread->m_current_buffer->text->beg[30000]
  share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-mime-parts.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-modeline.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-notification.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-obsolete.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-org.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-pkg.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-query-items.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-search.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-server.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-speedbar.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-thread.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-update.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-vars.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-view.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-window.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e.el
  Checking /usr/share/emacs/site-lisp/elpa/mu4e-1.12.5/mu4e-actions.el
  0 matching files marked
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0) [3 times]
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range #("<fastmail>" 1 9 (face mu4e-context-face help-echo "mu4e context: fastmail")) 10)
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0) [5 times]
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range #("<fastmail>" 1 9 (face mu4e-context-face help-echo "mu4e context: fastmail")) 10)
  QuitError during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0)
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0) [2 times]
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range #("<fastmail>" 1 9 (face mu4e-context-face help-echo "mu4e context: fastmail")) 10)
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0) [5 times]

This particular print ("Error during redisplay") happens (I think) when
I removed the (condition-case ...) stuff above to let the (aref ...)
fail. I wouldn't crash most of the time. Also I'm not at all confident
that this is the only scenario where it crashed, but maybe.

Let's look just at the last little bit, to count the bytes:

  (gdb) printf "%.200s\n", &current_thread->m_current_buffer->text->beg[32000]
  mail>" 1 9 (face mu4e-context-face help-echo "mu4e context: fastmail")) 10)
  Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0) [5 times]

I asked for at most 200 bytes (up to byte 32200). I got exactly 176
bytes, so the text ends where the gap supposedly begins. That makes
sense. Let's look a bit past the end, INTO the gap

  (gdb) x /3cb &current_thread->m_current_buffer->text->beg[32176]
  0x561d710175b0:	0 '\000'	0 '\000'	114 'r'

So we have two trailing \0 bytes. Past them:

  (gdb) printf "%.200s\n", &current_thread->m_current_buffer->text->beg[32178]
  rror during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0)

Theory: there's a race condition between error handling that ends up
writing to *Messages* and the logic that aggregates duplicated messages
into things like [5 times]. People usually don't have lots of errors
happening, and they usually don't stare at the *Messages* buffer, so
this is easily missed. Anything more you would suggest?

I saw the crashing once every 20min maybe, so reproducing it is probably
possible, but not very quick and easy. Does it make sense to try to fix
the (condition-case) problem first, since that's easily reproducible?

Thank you





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-07-18  7:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

I just checked one more thing. The complaint, as I understand it, is
that the buffer size, as measured in characters is inconsistent with the
size, as measured in bytes. I just looked at the whole buffer, and
confirmed that the thing is 100% plain ascii: each byte is <= 0x7f. For
emacs does this mean that in this buffer we always have
sizeof(character) == 1?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-18  7:38     ` Dima Kogan
@ 2024-07-18  9:07       ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-07-18  9:07 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 72165@debbugs.gnu.org
> Date: Thu, 18 Jul 2024 00:38:28 -0700
> 
> I just checked one more thing. The complaint, as I understand it, is
> that the buffer size, as measured in characters is inconsistent with the
> size, as measured in bytes. I just looked at the whole buffer, and
> confirmed that the thing is 100% plain ascii: each byte is <= 0x7f. For
> emacs does this mean that in this buffer we always have
> sizeof(character) == 1?

Yes.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-18  7:25   ` Dima Kogan
  2024-07-18  7:38     ` Dima Kogan
@ 2024-07-18  9:52     ` Eli Zaretskii
  2024-07-19  7:27       ` Dima Kogan
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-07-18  9:52 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 72165@debbugs.gnu.org
> Date: Thu, 18 Jul 2024 00:25:14 -0700
> 
> Here's what I see in the core dump:
> 
>   (gdb) p current_thread->m_current_buffer->text->z
>   $22 = 32192
> 
>   (gdb) p current_thread->m_current_buffer->text->z_byte
>   $23 = 32178
> 
>   (gdb) p current_thread->m_current_buffer->pt
>   $24 = 32192
> 
>   (gdb) p current_thread->m_current_buffer->pt_byte
>   $25 = 32178
> 
> So that tells me that the failing condition isn't the one gdb flagged,
> but the one immediately after:
> 
>   if (BYTEPOS (opoint) < CHARPOS (opoint))
>     emacs_abort ();

Yes.

> The compiler optimizations could be responsible for the discrepancy.

Yes, this happens frequently in optimized code.

> Am
> I understanding correctly that this check makes sure that BYTEPOS >=
> CHARPOS, which must always be true because sizeof(emacs character) is
> always >= 1byte?

Yes.

> The buffer name:
> 
>   (gdb) p current_thread->m_current_buffer->name_
>   $26 = XIL(0x7fc685b24c1c)
> 
>   (gdb) xstring
>   $27 = (struct Lisp_String *) 0x7fc685b24c18
>   "*Messages*"

And the *Messages* buffer was displayed in some window when this
happened?

> The full structure:
> 
>   (gdb) p current_thread->m_current_buffer->own_text
>   $45 = {
>     beg                        = 0x561d7100f800 ...
>     z                          = 32192,
>     z_byte                     = 32178,
>     gpt                        = 32191,
>     gpt_byte                   = 32177,

That's the bug: in these two pairs, the character and byte values
should be identical.

The question is: which code modified Z and GPT without updating the
corresponding _BYTE variables, or the other way around?

> Let's look just at the last little bit, to count the bytes:
> 
>   (gdb) printf "%.200s\n", &current_thread->m_current_buffer->text->beg[32000]
>   mail>" 1 9 (face mu4e-context-face help-echo "mu4e context: fastmail")) 10)
>   Error during redisplay: (eval (mu4e--modeline-string) t) signaled (args-out-of-range "" 0) [5 times]
> 
> I asked for at most 200 bytes (up to byte 32200). I got exactly 176
> bytes, so the text ends where the gap supposedly begins. That makes
> sense.

This means Z_BYTE and GPT_BYTE are correct, but the corresponding Z
and GPT values are incorrect.

My suggestion is to run Emacs under GDB with a watchpoint on Z_BYTE,
conditioned on the situation that Z_BYTE and Z are not equal.

This watchpoint needs to be defined when the current buffer is the
*Messages* buffer.  One way of doing that is as follows:

  $ gdb ./emacs
  ...
  (gdb) break Frecenter
  (gdb) run

After Emacs starts, type "C-x b *Messages* RET" to display *Messages*
in a window, then type C-l to trigger the Frecenter breakpoint, and
when GDB kicks in, type at the GDB prompt as follows:

  (gdb) n
  (gdb) n
  (gdb) p buf
  (gdb) watch $1->text->z_byte if $1->text->z_byte != $1->text->z

This relies on the fact that our code always changes Z_BYTE _after_
the suitable change to Z.  The only exception to this rule that I
found is in insdel.c:del_range_2, where we do it in the opposite
order.  So for the above to work, you need to edit that function and
transpose the line of code which modify Z_BYTE with the one which
modifies Z.  Then rebuild Emacs and use the resulting binary to debug
this with the above watchpoint.

> Theory: there's a race condition between error handling that ends up
> writing to *Messages* and the logic that aggregates duplicated messages
> into things like [5 times].

I don't see how this could happen, for two reasons:

 . emacs is a single-threaded program, so how can two pieces of code
   that run in the same thread produce a race condition?
 . in this particular case, both writing to *Messages* and aggregation
   of identical messages happen in the same function, one after the
   other; see xdisp.c:message_dolog.

> I saw the crashing once every 20min maybe, so reproducing it is probably
> possible, but not very quick and easy. Does it make sense to try to fix
> the (condition-case) problem first, since that's easily reproducible?

I don't see how fixing that problem could help.  It might even
interfere, if that problem somehow triggers this one.  Or did I miss
something?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-18  9:52     ` Eli Zaretskii
@ 2024-07-19  7:27       ` Dima Kogan
  2024-07-29  2:50         ` Dima Kogan
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-07-19  7:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

>>   (gdb) xstring
>>   $27 = (struct Lisp_String *) 0x7fc685b24c18
>>   "*Messages*"
>
> And the *Messages* buffer was displayed in some window when this
> happened?

Yes. I was watching it to find my other bug.

Thank you very much for the detailed notes. I just played with it for a
bit, trying to get it to break again, and I couldn't do it. I'll try
again in a few days, and will report what I find out.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  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  4:58 ` 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
  2 siblings, 1 reply; 21+ messages in thread
From: Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-23 20:51 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

Dima Kogan <dima@secretsauce.net> writes:

> Hi.
>
> I'm running a bleeding-edge build of emacs. Using packages from:
>
>   https://emacs.secretsauce.net/
>
> Debian GNU/Linux. GTK+. Currently using a build from git as of
> 2024/07/09 (8e46f44ea0e). It is crashing periodically, with an unclear
> cause.
>
> This isn't a brand-new problem; I observed a similar crash with an earlier
> build: 2024/04/30 (d24981d27ce). After that crash I upgraded, and I see
> crashes still.
>
> Anecdotally, the 2024/04/30 build has been very stable. Today I started
> to debug a different issue: something about mu4e modeline updating is
> signalling args-out-of-range. To debug this I'm tweaking functions like
> (truncate-string-to-width), and re-evaluating them. This debugging isn't
> very interesting, but something about it is causing emacs to crash, with
> both builds.
>
> I just made a core. I cannot xbacktrace because (I think) I'm looking at
> a core, and not at a live process. If that would be helpful, I can
> probably get that. And I see the crash every 20min maybe, while
> debugging the mu4e modeline problem. Below is the backtrace. Hopefully
> this speaks to somebody. Thanks!

You mention mu4e twice.  Does this happen only with mu4e?
mu4e is usually distributed separately from Emacs, which version are you using?

>
>   (gdb) bt full
>   #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
>           tid = <optimized out>
>           ret = 0
>           pd = <optimized out>
>           old_mask = {
>             __val = {0}
>           }
>           ret = <optimized out>
>   #1  0x00007fc68a4a6b7f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
>   #2  0x00007fc68a4584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
>           ret = <optimized out>
>   #3  0x0000561d3dcb9798 in terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at ./debian/build-x/src/emacs.c:469
>   #4  0x0000561d3dcb9d4e in emacs_abort () at ./debian/build-x/src/sysdep.c:2391
>   #5  0x0000561d3dcb6c34 in redisplay_window (window=<optimized out>, just_this_one_p=just_this_one_p@entry=false) at ./debian/build-x/src/xdisp.c:20086
>           w = 0x561d6bcb2bc8
>           f = <optimized out>
>           buffer = <optimized out>
>           old = <optimized out>
>           lpoint = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }
>           opoint = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }
>           startp = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }
>           update_mode_line = <optimized out>
>           tem = <optimized out>
>           it = {
>             window = 0x0,
>             w = 0x0,
>             f = 0x0,
>             method = GET_FROM_BUFFER,
>             stop_charpos = 0,
>             prev_stop = 0,
>             base_level_stop = 0,
>             end_charpos = 0,
>             medium_narrowing_begv = 0,
>             medium_narrowing_zv = 0,
>             large_narrowing_begv = 0,
>             large_narrowing_zv = 0,
>             s = 0x0,
>             string_nchars = 0,
>             multibyte_p = false,
>             tab_line_p = false,
>             header_line_p = false,
>             string_from_display_prop_p = false,
>             string_from_prefix_prop_p = false,
>             from_disp_prop_p = false,
>             ellipsis_p = false,
>             avoid_cursor_p = false,
>             dp = 0x0,
>             dpvec = 0x0,
>             dpend = 0x0,
>             dpvec_char_len = 0,
>             dpvec_face_id = 0,
>             saved_face_id = 0,
>             ctl_chars = {0x0 <repeats 16 times>},
>             start = {
>               pos = {
>                 charpos = 0,
>                 bytepos = 0
>               },
>               overlay_string_index = 0,
>               string_pos = {
>                 charpos = 0,
>                 bytepos = 0
>               },
>               dpvec_index = 0
>             },
>             current = {
>               pos = {
>                 charpos = 0,
>                 bytepos = 0
>               },
>               overlay_string_index = 0,
>               string_pos = {
>                 charpos = 0,
>                 bytepos = 0
>               },
>               dpvec_index = 0
>             },
>             n_overlay_strings = 0,
>             overlay_strings_charpos = 0,
>             overlay_strings = {0x0 <repeats 16 times>},
>             string_overlays = {0x0 <repeats 16 times>},
>             string = 0x0,
>             from_overlay = 0x0,
>             stack = {{
>                 string = 0x0,
>                 string_nchars = 0,
>                 end_charpos = 0,
>                 stop_charpos = 0,
>                 prev_stop = 0,
>                 base_level_stop = 0,
>                 cmp_it = {
>                   stop_pos = 0,
>                   id = 0,
>                   ch = 0,
>                   rule_idx = 0,
>                   lookback = 0,
>                   nglyphs = 0,
>                   reversed_p = false,
>                   parent_it = 0x0,
>                   charpos = 0,
>                   nchars = 0,
>                   nbytes = 0,
>                   from = 0,
>                   to = 0,
>                   width = 0
>                 },
>                 face_id = 0,
>                 u = {
>                   image = {
>                     object = 0x0,
>                     slice = {
>                       x = 0x0,
>                       y = 0x0,
>                       width = 0x0,
>                       height = 0x0
>                     },
>                     image_id = 0
>                   },
>                   stretch = {
>                     object = 0x0
>                   },
>                   xwidget = {
>                     object = 0x0
>                   }
>                 },
>                 position = {
>                   charpos = 0,
>                   bytepos = 0
>                 },
>                 current = {
>                   pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   overlay_string_index = 0,
>                   string_pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   dpvec_index = 0
>                 },
>                 from_overlay = 0x0,
>                 area = LEFT_MARGIN_AREA,
>                 method = GET_FROM_BUFFER,
>                 paragraph_embedding = NEUTRAL_DIR,
>                 multibyte_p = false,
>                 string_from_display_prop_p = false,
>                 string_from_prefix_prop_p = false,
>                 display_ellipsis_p = false,
>                 avoid_cursor_p = false,
>                 bidi_p = false,
>                 from_disp_prop_p = false,
>                 line_wrap = TRUNCATE,
>                 voffset = 0,
>                 space_width = 0x0,
>                 font_height = 0x0
>               }, {
>                 string = 0x0,
>                 string_nchars = 0,
>                 end_charpos = 0,
>                 stop_charpos = 0,
>                 prev_stop = 0,
>                 base_level_stop = 0,
>                 cmp_it = {
>                   stop_pos = 0,
>                   id = 0,
>                   ch = 0,
>                   rule_idx = 0,
>                   lookback = 0,
>                   nglyphs = 0,
>                   reversed_p = false,
>                   parent_it = 0x0,
>                   charpos = 0,
>                   nchars = 0,
>                   nbytes = 0,
>                   from = 0,
>                   to = 0,
>                   width = 0
>                 },
>                 face_id = 0,
>                 u = {
>                   image = {
>                     object = 0x0,
>                     slice = {
>                       x = 0x0,
>                       y = 0x0,
>                       width = 0x0,
>                       height = 0x0
>                     },
>                     image_id = 0
>                   },
>                   stretch = {
>                     object = 0x0
>                   },
>                   xwidget = {
>                     object = 0x0
>                   }
>                 },
>                 position = {
>                   charpos = 0,
>                   bytepos = 0
>                 },
>                 current = {
>                   pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   overlay_string_index = 0,
>                   string_pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   dpvec_index = 0
>                 },
>                 from_overlay = 0x0,
>                 area = LEFT_MARGIN_AREA,
>                 method = GET_FROM_BUFFER,
>                 paragraph_embedding = NEUTRAL_DIR,
>                 multibyte_p = false,
>                 string_from_display_prop_p = false,
>                 string_from_prefix_prop_p = false,
>                 display_ellipsis_p = false,
>                 avoid_cursor_p = false,
>                 bidi_p = false,
>                 from_disp_prop_p = false,
>                 line_wrap = TRUNCATE,
>                 voffset = 0,
>                 space_width = 0x0,
>                 font_height = 0x0
>               }, {
>                 string = 0x0,
>                 string_nchars = 0,
>                 end_charpos = 0,
>                 stop_charpos = 0,
>                 prev_stop = 0,
>                 base_level_stop = 0,
>                 cmp_it = {
>                   stop_pos = 0,
>                   id = 0,
>                   ch = 0,
>                   rule_idx = 0,
>                   lookback = 0,
>                   nglyphs = 0,
>                   reversed_p = false,
>                   parent_it = 0x0,
>                   charpos = 0,
>                   nchars = 0,
>                   nbytes = 0,
>                   from = 0,
>                   to = 0,
>                   width = 0
>                 },
>                 face_id = 0,
>                 u = {
>                   image = {
>                     object = 0x0,
>                     slice = {
>                       x = 0x0,
>                       y = 0x0,
>                       width = 0x0,
>                       height = 0x0
>                     },
>                     image_id = 0
>                   },
>                   stretch = {
>                     object = 0x0
>                   },
>                   xwidget = {
>                     object = 0x0
>                   }
>                 },
>                 position = {
>                   charpos = 0,
>                   bytepos = 0
>                 },
>                 current = {
>                   pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   overlay_string_index = 0,
>                   string_pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   dpvec_index = 0
>                 },
>                 from_overlay = 0x0,
>                 area = LEFT_MARGIN_AREA,
>                 method = GET_FROM_BUFFER,
>                 paragraph_embedding = NEUTRAL_DIR,
>                 multibyte_p = false,
>                 string_from_display_prop_p = false,
>                 string_from_prefix_prop_p = false,
>                 display_ellipsis_p = false,
>                 avoid_cursor_p = false,
>                 bidi_p = false,
>                 from_disp_prop_p = false,
>                 line_wrap = TRUNCATE,
>                 voffset = 0,
>                 space_width = 0x0,
>                 font_height = 0x0
>               }, {
>                 string = 0x0,
>                 string_nchars = 0,
>                 end_charpos = 0,
>                 stop_charpos = 0,
>                 prev_stop = 0,
>                 base_level_stop = 0,
>                 cmp_it = {
>                   stop_pos = 0,
>                   id = 0,
>                   ch = 0,
>                   rule_idx = 0,
>                   lookback = 0,
>                   nglyphs = 0,
>                   reversed_p = false,
>                   parent_it = 0x0,
>                   charpos = 0,
>                   nchars = 0,
>                   nbytes = 0,
>                   from = 0,
>                   to = 0,
>                   width = 0
>                 },
>                 face_id = 0,
>                 u = {
>                   image = {
>                     object = 0x0,
>                     slice = {
>                       x = 0x0,
>                       y = 0x0,
>                       width = 0x0,
>                       height = 0x0
>                     },
>                     image_id = 0
>                   },
>                   stretch = {
>                     object = 0x0
>                   },
>                   xwidget = {
>                     object = 0x0
>                   }
>                 },
>                 position = {
>                   charpos = 0,
>                   bytepos = 0
>                 },
>                 current = {
>                   pos = {
>                     charpos = 0,
>                     bytepos = 0
>                   },
>                   overlay_string_index = 0,
>                   string_pos = {
>                     charpos = 8589934595,
>                     bytepos = 395136991232
>                   },
>                   dpvec_index = 1
>                 },
>                 from_overlay = 0x0,
>                 area = ANY_AREA,
>                 method = 4294967295,
>                 paragraph_embedding = NEUTRAL_DIR,
>                 multibyte_p = false,
>                 string_from_display_prop_p = false,
>                 string_from_prefix_prop_p = false,
>                 display_ellipsis_p = false,
>                 avoid_cursor_p = false,
>                 bidi_p = false,
>                 from_disp_prop_p = false,
>                 line_wrap = TRUNCATE,
>                 voffset = 0,
>                 space_width = 0x0,
>                 font_height = 0x0
>               }, {
>                 string = 0x7ffd9fd78e10,
>                 string_nchars = 0,
>                 end_charpos = 0,
>                 stop_charpos = 0,
>                 prev_stop = 0,
>                 base_level_stop = 92,
>                 cmp_it = {
>                   stop_pos = 0,
>                   id = 0,
>                   ch = 0,
>                   rule_idx = 0,
>                   lookback = 0,
>                   nglyphs = 0,
>                   reversed_p = false,
>                   parent_it = 0x0,
>                   charpos = 524288,
>                   nchars = 0,
>                   nbytes = 0,
>                   from = 0,
>                   to = 0,
>                   width = 0
>                 },
>                 face_id = 0,
>                 u = {
>                   image = {
>                     object = 0x0,
>                     slice = {
>                       x = 0x0,
>                       y = 0x0,
>                       width = 0xffffffff,
>                       height = 0x0
>                     },
>                     image_id = 0
>                   },
>                   stretch = {
>                     object = 0x0
>                   },
>                   xwidget = {
>                     object = 0x0
>                   }
>                 },
>                 position = {
>                   charpos = 4294967296,
>                   bytepos = 47244640265
>                 },
>                 current = {
>                   pos = {
>                     charpos = 47244640259,
>                     bytepos = 42949672963
>                   },
>                   overlay_string_index = 42949672961,
>                   string_pos = {
>                     charpos = 1,
>                     bytepos = 0
>                   },
>                   dpvec_index = 0
>                 },
>                 from_overlay = 0x0,
>                 area = LEFT_MARGIN_AREA,
>                 method = GET_FROM_BUFFER,
>                 paragraph_embedding = NEUTRAL_DIR,
>                 multibyte_p = false,
>                 string_from_display_prop_p = false,
>                 string_from_prefix_prop_p = false,
>                 display_ellipsis_p = false,
>                 avoid_cursor_p = false,
>                 bidi_p = false,
>                 from_disp_prop_p = false,
>                 line_wrap = TRUNCATE,
>                 voffset = 0,
>                 space_width = 0x0,
>                 font_height = 0x0
>               }},
>             sp = 0,
>             selective = 0,
>             what = IT_CHARACTER,
>             face_id = 0,
>             selective_display_ellipsis_p = false,
>             ctl_arrow_p = false,
>             face_box_p = false,
>             start_of_box_run_p = false,
>             end_of_box_run_p = false,
>             overlay_strings_at_end_processed_p = false,
>             ignore_overlay_strings_at_pos_p = false,
>             glyph_not_available_p = false,
>             starts_in_middle_of_char_p = false,
>             face_before_selective_p = false,
>             constrain_row_ascent_descent_p = false,
>             line_number_produced_p = false,
>             align_visually_p = false,
>             line_wrap = TRUNCATE,
>             base_face_id = 0,
>             c = 0,
>             len = 0,
>             cmp_it = {
>               stop_pos = 0,
>               id = 0,
>               ch = 0,
>               rule_idx = 0,
>               lookback = 0,
>               nglyphs = 0,
>               reversed_p = false,
>               parent_it = 0x0,
>               charpos = 0,
>               nchars = 0,
>               nbytes = 0,
>               from = 0,
>               to = 0,
>               width = 0
>             },
>             char_to_display = 0,
>             glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE,
>             image_id = 0,
>             xwidget = 0x0,
>             slice = {
>               x = 0x0,
>               y = 0x0,
>               width = 0x0,
>               height = 0x0
>             },
>             space_width = 0x0,
>             voffset = 0,
>             tab_width = 0,
>             font_height = 0x0,
>             object = 0x0,
>             position = {
>               charpos = 0,
>               bytepos = 0
>             },
>             truncation_pixel_width = 0,
>             continuation_pixel_width = 0,
>             first_visible_x = 0,
>             last_visible_x = 0,
>             last_visible_y = 0,
>             extra_line_spacing = 0,
>             max_extra_line_spacing = 0,
>             override_ascent = 0,
>             override_descent = 0,
>             override_boff = 0,
>             glyph_row = 0x0,
>             area = LEFT_MARGIN_AREA,
>             nglyphs = 0,
>             pixel_width = 0,
>             ascent = 0,
>             descent = 0,
>             max_ascent = 0,
>             max_descent = 0,
>             phys_ascent = 0,
>             phys_descent = 0,
>             max_phys_ascent = 0,
>             max_phys_descent = 0,
>             current_x = 0,
>             wrap_prefix_width = 0,
>             continuation_lines_width = 0,
>             eol_pos = {
>               charpos = 0,
>               bytepos = 0
>             },
>             current_y = 0,
>             first_vpos = 0,
>             vpos = 0,
>             hpos = 0,
>             lnum = 0,
>             lnum_bytepos = 0,
>             lnum_width = 0,
>             lnum_pixel_width = 0,
>             pt_lnum = 0,
>             stretch_adjust = 0,
>             left_user_fringe_bitmap = 0,
>             right_user_fringe_bitmap = 0,
>             left_user_fringe_face_id = 0,
>             right_user_fringe_face_id = 0,
>             bidi_p = false,
>             bidi_it = {
>               bytepos = 0,
>               charpos = 0,
>               ch = 0,
>               nchars = 0,
>               ch_len = 0,
>               type = UNKNOWN_BT,
>               type_after_wn = UNKNOWN_BT,
>               orig_type = UNKNOWN_BT,
>               resolved_level = 0 '\000',
>               isolate_level = 0 '\000',
>               invalid_levels = 0,
>               invalid_isolates = 0,
>               prev = {
>                 charpos = 0,
>                 type = UNKNOWN_BT,
>                 orig_type = UNKNOWN_BT
>               },
>               last_strong = {
>                 charpos = 0,
>                 type = UNKNOWN_BT,
>                 orig_type = UNKNOWN_BT
>               },
>               next_for_neutral = {
>                 charpos = 0,
>                 type = UNKNOWN_BT,
>                 orig_type = UNKNOWN_BT
>               },
>               prev_for_neutral = {
>                 charpos = 0,
>                 type = UNKNOWN_BT,
>                 orig_type = UNKNOWN_BT
>               },
>               next_for_ws = {
>                 charpos = 0,
>                 type = UNKNOWN_BT,
>                 orig_type = UNKNOWN_BT
>               },
>               bracket_pairing_pos = 0,
>               bracket_enclosed_type = UNKNOWN_BT,
>               next_en_pos = 0,
>               next_en_type = UNKNOWN_BT,
>               sos = NEUTRAL_DIR,
>               scan_dir = 0,
>               disp_pos = 0,
>               disp_prop = 0,
>               stack_idx = 0,
>               level_stack = {{
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 } <repeats 52 times>, {
>                   next_for_neutral_pos = 140727285151856,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 7,
>                   prev_for_neutral_type = 1,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 140727285151848,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 6692952454725819392,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140727285151856,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 5,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 384,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 3,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 94683592258741,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140727285151856,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 5,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 94683591719329,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 4,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 94683593201994,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 6,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 22,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 33168,
>                   next_for_neutral_type = 5,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 6,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 0,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 94683593203763,
>                   next_for_neutral_type = 5,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 94683623854741,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 6,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 94683593201994,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 6,
>                   next_for_neutral_type = 5,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140727285152152,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 6,
>                   prev_for_neutral_type = 6,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 6,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 94683623854741,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 1,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 6692952454725819392,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 2,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140490765053792,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 5,
>                   prev_for_neutral_type = 3,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 6692952454725819392,
>                   next_for_neutral_type = 7,
>                   last_strong_type = 1,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140490764807742,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 6,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 64424511301,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 94683879045328,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 6,
>                   level = 134 '\206',
>                   flags = 142 '\216'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 7,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 7,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 140490770859150,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 15,
>                   next_for_neutral_type = 4,
>                   last_strong_type = 7,
>                   prev_for_neutral_type = 7,
>                   level = 255 '\377',
>                   flags = 255 '\377'
>                 }, {
>                   next_for_neutral_pos = -168884986026394,
>                   next_for_neutral_type = 5,
>                   last_strong_type = 6,
>                   prev_for_neutral_type = 2,
>                   level = 237 '\355',
>                   flags = 133 '\205'
>                 }, {
>                   next_for_neutral_pos = 6692952454725819392,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140490765053792,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 35662986,
>                   next_for_neutral_type = 7,
>                   last_strong_type = 1,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140490764807742,
>                   next_for_neutral_type = 5,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 2,
>                   level = 196 '\304',
>                   flags = 63 '?'
>                 }, {
>                   next_for_neutral_pos = 64424511301,
>                   next_for_neutral_type = 7,
>                   last_strong_type = 7,
>                   prev_for_neutral_type = 7,
>                   level = 255 '\377',
>                   flags = 255 '\377'
>                 }, {
>                   next_for_neutral_pos = 94683879045328,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 6,
>                   level = 134 '\206',
>                   flags = 142 '\216'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 2,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 2,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 140490770859150,
>                   next_for_neutral_type = 2,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 15,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = -196480571978419,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 7,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 0,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 6,
>                   prev_for_neutral_type = 1,
>                   level = 253 '\375',
>                   flags = 61 '='
>                 }, {
>                   next_for_neutral_pos = 6692952454725819392,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 0,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140490765053792,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 35662986,
>                   next_for_neutral_type = 7,
>                   last_strong_type = 1,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 140490764807742,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 2,
>                   prev_for_neutral_type = 7,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 64424511301,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 94683879045328,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 6,
>                   level = 134 '\206',
>                   flags = 142 '\216'
>                 }, {
>                   next_for_neutral_pos = 1,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 4,
>                   prev_for_neutral_type = 5,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 6,
>                   level = 215 '\327',
>                   flags = 159 '\237'
>                 }, {
>                   next_for_neutral_pos = 140490770859150,
>                   next_for_neutral_type = 1,
>                   last_strong_type = 6,
>                   prev_for_neutral_type = 5,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 15,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = -196480571978419,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }, {
>                   next_for_neutral_pos = 0,
>                   next_for_neutral_type = 0,
>                   last_strong_type = 0,
>                   prev_for_neutral_type = 0,
>                   level = 0 '\000',
>                   flags = 0 '\000'
>                 }},
>               string = {
>                 lstring = 0x0,
>                 s = 0x0,
>                 schars = 0,
>                 bufpos = 0,
>                 from_disp_str = false,
>                 unibyte = false
>               },
>               w = 0x0,
>               paragraph_dir = NEUTRAL_DIR,
>               separator_limit = 0,
>               first_elt = false,
>               new_paragraph = false,
>               frame_window_p = false
>             },
>             paragraph_embedding = NEUTRAL_DIR,
>             min_width_property = 0x0,
>             min_width_start = 0
>           }
>           current_matrix_up_to_date_p = false
>           used_current_matrix_p = false
>           temp_scroll_step = false
>           rc = <optimized out>
>           centering_position = -1
>           last_line_misfit = false
>           beg_unchanged = <optimized out>
>           end_unchanged = <optimized out>
>           frame_line_height = <optimized out>
>           margin = <optimized out>
>           use_desired_matrix = <optimized out>
>           itdata = 0x0
>   #6  0x0000561d3dd2db23 in redisplay_window_0 (window=window@entry=0x561d6bcb2bcd) at ./debian/build-x/src/xdisp.c:18032
>   #7  0x0000561d3de860da in internal_condition_case_1
>       (bfun=bfun@entry=0x561d3dd2daf0 <redisplay_window_0>, arg=arg@entry=0x561d6bcb2bcd, handlers=<optimized out>, hfun=hfun@entry=0x561d3dce3310 <redisplay_window_error>)
>       at ./debian/build-x/src/eval.c:1637
>           val = <optimized out>
>           c = 0x561d3ef56ad0
>   #8  0x0000561d3dcdfb3a in redisplay_windows (window=0x561d6bcb2bcd) at ./debian/build-x/src/xdisp.c:18001
>           w = 0x561d6bcb2bc8
>   #9  0x0000561d3dd14ea3 in redisplay_internal () at ./debian/build-x/src/xdisp.c:17400
>           gcscrollbars = <optimized out>
>           f = 0x561d6bcb2940
>           w = <optimized out>
>           sw = <optimized out>
>           fr = <optimized out>
>           pending = <optimized out>
>           must_finish = <optimized out>
>           match_p = <optimized out>
>           tlbufpos = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }
>           tlendpos = {
>             charpos = <optimized out>,
>             bytepos = <optimized out>
>           }
>           number_of_visible_frames = <optimized out>
>           sf = <optimized out>
>           polling_stopped_here = true
>           tail = 0x561d6e1ae933
>           frame = 0x561d6bcb2945
>           hscroll_retries = <optimized out>
>           garbaged_frame_retries = <optimized out>
>           consider_all_windows_p = <optimized out>
>           update_miniwindow_p = <optimized out>
>   #10 0x0000561d3dd16509 in redisplay () at ./debian/build-x/src/xdisp.c:16575
>   #11 0x0000561d3de018d7 in read_char (commandflag=1, map=map@entry=0x561d6dc6f213, prev_event=0x0, used_mouse_menu=used_mouse_menu@entry=0x7ffd9fd7bc8b, end_time=end_time@entry=0x0)
>       at ./debian/build-x/src/keyboard.c:2678
>           echo_current = false
>           c = <optimized out>
>           local_getcjmp = {{
>               __jmpbuf = {94683599852320, 5898495886293811139, 140490622174464, 0, 1, 1, 5898495886388182979, 151695970901639107},
>               __mask_was_saved = 0,
>               __saved_mask = {
>                 __val = {0, 140727285168672, 140490622174584, 140490622174584, 0, 0, 128770, 0, 32191, 32193, 6692952454725819392, 12884901888, 94683623736432, 94683615050064, 2, 140727285168720}
>               }
>             }}
>           save_jump = {{
>               __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 0},
>               __mask_was_saved = 0,
>               __saved_mask = {
>                 __val = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94683592684623, 0, 0, 2, 94683592073760, 140727285162272}
>               }
>             }}
>           tem = <optimized out>
>           save = <optimized out>
>           previous_echo_area_message = 0x0
>           also_record = 0x0
>           reread = false
>           recorded = false
>           polling_stopped_here = false
>           orig_kboard = 0x561d3f9e1b40
>   #12 0x0000561d3de04ba2 in read_key_sequence
>       (keybuf=keybuf@entry=0x7ffd9fd7bdf0, prompt=prompt@entry=0x0, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, disable_text_conversion_p=false) at ./debian/build-x/src/keyboard.c:10743
>           interrupted_kboard = 0x561d3f9e1b40
>           interrupted_frame = 0x561d6bcb2940
>           key = <optimized out>
>           used_mouse_menu = false
>           echo_local_start = 0
>           last_real_key_start = 0
>           keys_local_start = 0
>           new_binding = <optimized out>
>           t = 0
>           echo_start = 0
>           keys_start = 0
>           current_binding = 0x561d6dc6f213
>           first_unbound = 31
>           mock_input = 0
>           used_mouse_menu_history = {false <repeats 30 times>}
>           fkey = {
>             parent = 0x7fc6835340d3,
>             map = 0x7fc6835340d3,
>             start = 0,
>             end = 0
>           }
>           keytran = {
>             parent = 0x7fc68609cdeb,
>             map = 0x7fc68609cdeb,
>             start = 0,
>             end = 0
>           }
>           indec = {
>             parent = 0x7fc6835340e3,
>             map = 0x7fc6835340e3,
>             start = 0,
>             end = 0
>           }
>           shift_translated = <optimized out>
>           delayed_switch_frame = <optimized out>
>           original_uppercase_position = <optimized out>
>           disabled_conversion = <optimized out>
>           fake_prefixed_keys = 0x0
>           first_event = 0x0
>           second_event = <optimized out>
>   #13 0x0000561d3de06d18 in command_loop_1 () at ./debian/build-x/src/keyboard.c:1429
>           cmd = <optimized out>
>           keybuf = {0x561d6dc6f973, 0x5ce224cbfa82dc00, 0xa0, 0x60, 0x0, 0x0, 0x111f0, 0x561d3df83ba8, 0x7ffd9fd7bea0, 0x561d3de874b3 <unbind_to+259>, 0x7ffd9fd7bec0, 0x2, 0xb, 0x111f0, 0x30, 0x561d6d06628d, 0x7fc68572e9cc, 0x561d6ca84763, 0x60, 0x7ffd9fd7bec0, 0x2, 0x7ffd9fd7e3ae, 0x7ffd9fd7bf20, 0x561d3ddfa492 <cmd_error+370>, 0x0, 0x0, 0xb300, 0x561d3df83ba8, 0x7ffd9fd7bf40, 0x561d3de874b3 <unbind_to+259>}
>           i = <optimized out>
>           last_pt = <optimized out>
>           prev_modiff = 3094
>           prev_buffer = 0x561d6d066288
>   #14 0x0000561d3de8603e in internal_condition_case (bfun=bfun@entry=0x561d3de06b40 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x561d3ddfa320 <cmd_error>)
>       at ./debian/build-x/src/eval.c:1613
>           val = <optimized out>
>           c = 0x561d3ef4cce0
>   #15 0x0000561d3ddf1e66 in command_loop_2 (handlers=handlers@entry=0x90) at ./debian/build-x/src/keyboard.c:1168
>           val = <optimized out>
>   #16 0x0000561d3de85f97 in internal_catch (tag=tag@entry=0x12300, func=func@entry=0x561d3ddf1e30 <command_loop_2>, arg=arg@entry=0x90) at ./debian/build-x/src/eval.c:1292
>           val = <optimized out>
>           c = 0x561d3efe0280
>   #17 0x0000561d3ddf1df1 in command_loop () at ./debian/build-x/src/keyboard.c:1146
>   #18 0x0000561d3ddf9e59 in recursive_edit_1 () at ./debian/build-x/src/keyboard.c:754
>           val = <optimized out>
>   #19 0x0000561d3ddfa21c in Frecursive_edit () at ./debian/build-x/src/keyboard.c:837
>           buffer = <optimized out>
>   #20 0x0000561d3dcc2f9d in main (argc=2, argv=0x7ffd9fd7c2e8) at ./debian/build-x/src/emacs.c:2624
>           stack_bottom_variable = 0x561d3eecc050
>           old_argc = <optimized out>
>           no_loadup = false
>           junk = 0x0
>           dname_arg = 0x0
>           ch_to_dir = 0x0
>           original_pwd = <optimized out>
>           dump_mode = <optimized out>
>           skip_args = 1
>           temacs = 0x0
>           attempt_load_pdump = <optimized out>
>           only_version = false
>           rlim = {
>             rlim_cur = 10022912,
>             rlim_max = 18446744073709551615
>           }
>           lc_all = <optimized out>
>           sockfd = -1
>           module_assertions = <optimized out>





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  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
  0 siblings, 0 replies; 21+ messages in thread
From: Dima Kogan @ 2024-07-23 21:21 UTC (permalink / raw)
  To: Jeremy Bryant; +Cc: 72165

Jeremy Bryant <jb@jeremybryant.net> writes:

> You mention mu4e twice. Does this happen only with mu4e? mu4e is
> usually distributed separately from Emacs, which version are you
> using?

I don't think mu4e is responsible directly. I ran the april build of
emacs for months with no issues, and only saw the crashes when trying to
debug the *Messages* problem tickled by mu4e. So I doubt somebody else
could readily reproduce the crash. In fact, so far, I haven't been able
to reproduce it either, with the watchpoint enabled. But while debugging
earlier, I saw it crash maybe 4 times within a few hours, so it's
definitely an extant issue.

For the record:

$ dpkg -l mu4e
ii  mu4e           1.12.5-1





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-19  7:27       ` Dima Kogan
@ 2024-07-29  2:50         ` Dima Kogan
  2024-07-29 11:45           ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-07-29  2:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

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.

I walked around the rr trace, and I clearly see the crashing mechanism.
I don't dare fix it myself, but hopefully one of you will be able to,
without a lot of trouble.

The buggy function is message_dolog():

  https://github.com/dkogan/emacs-snapshot/blob/439ec471961/src/xdisp.c#L12041

On line 12075 we save the current point as a marker (i.e. both the byte
and char positions):

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

In the failing sequence I had some non-ascii characters, so PT_BYTE
would be ahead of PT (by either 4 or 8 bytes). This difference is
recorded into oldpoint.

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().

OK. If more investigating is needed, I still have the rr trace, and can
pull it up again. But I think we're clear on what's happening, and
hopefully no more digging is required.

Thanks!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-29  2:50         ` Dima Kogan
@ 2024-07-29 11:45           ` Eli Zaretskii
  2024-07-29 12:49             ` Dima Kogan
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-07-29 11:45 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> 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.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-29 11:45           ` Eli Zaretskii
@ 2024-07-29 12:49             ` Dima Kogan
  2024-07-30 16:21               ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-07-29 12:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

> 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.

That is excellent to know! I'm not super familiar with the internals of
emacs, so I don't know what is supposed to be handled, and might have
jumped to the conclusion.

Let's look again. I'm at a different cycle from before, but it still
fails from a message-log-max truncation.

- I'm at the top of redisplay_window() that has a crashing state, right
  after a redisplay_window() cycle with a non-crashing state. The
  crashing state has z_byte-z = 8 but pt_byte-pt = 12. Both are at the
  end of the buffer, and 8 is the correct value.

- I run backwards until the truncation in message_dolog():

	  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);
	    }

  Right after this both z_byte-z=8 (correct) and the point is at the
  beginning. This is correct, and the truncation itself didn't break
  anything. Note: this was (eventually) called from redisplay_window(),
  in the display_mode_lines() call in xdisp.c:20941

- Then we restore the oldpoint; what I suggested was the problem
  previously:

      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));

  After that, both z_byte-z and pt_byte-pt are 8. This is correct.

- Then we do this, in redisplay_window() in xdisp.c:21908

  /* Restore current_buffer and value of point in it.  The window
     update may have changed the buffer, so first make sure `opoint'
     is still valid (Bug#6177).  */
  if (CHARPOS (opoint) < BEGV)
    TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
  else if (CHARPOS (opoint) > ZV)
    TEMP_SET_PT_BOTH (Z, Z_BYTE);
  else
    TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));

  We pick the "else" branch. The end result is the exact failing state
  we hit on the next pass through redisplay_window().


This sounds like a different flavor of what I described yesterday. So in
summary: in a redisplay_window() call:

- We set the opoint on line 20064. This is a text_pos, NOT a marker. So
  it wouldn't be updated due to the buffer changing.

- On line 20941 we call display_mode_lines() which eventually deletes
  lines at the start of *Messages* and moves the point.

- On line 21908 we restore the opoint, saved prior to the lines being
  deleted, and no longer valid

Does this sequence sound more reasonable to you? The description from
the previous email made sense to me yesterday, but maybe I was too
sleep-deprived to tell for certain. Looking through yesterday's gdb
session, I don't see the smoking gun anymore.

Thanks much!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-29 12:49             ` Dima Kogan
@ 2024-07-30 16:21               ` Eli Zaretskii
  2024-07-30 20:39                 ` Dima Kogan
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-07-30 16:21 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 72165@debbugs.gnu.org
> Date: Mon, 29 Jul 2024 05:49:54 -0700
> 
> - I'm at the top of redisplay_window() that has a crashing state, right
>   after a redisplay_window() cycle with a non-crashing state. The
>   crashing state has z_byte-z = 8 but pt_byte-pt = 12. Both are at the
>   end of the buffer, and 8 is the correct value.
> 
> - I run backwards until the truncation in message_dolog():
> 
> 	  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);
> 	    }
> 
>   Right after this both z_byte-z=8 (correct) and the point is at the
>   beginning. This is correct, and the truncation itself didn't break
>   anything. Note: this was (eventually) called from redisplay_window(),
>   in the display_mode_lines() call in xdisp.c:20941
> 
> - Then we restore the oldpoint; what I suggested was the problem
>   previously:
> 
>       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));
> 
>   After that, both z_byte-z and pt_byte-pt are 8. This is correct.
> 
> - Then we do this, in redisplay_window() in xdisp.c:21908
> 
>   /* Restore current_buffer and value of point in it.  The window
>      update may have changed the buffer, so first make sure `opoint'
>      is still valid (Bug#6177).  */
>   if (CHARPOS (opoint) < BEGV)
>     TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
>   else if (CHARPOS (opoint) > ZV)
>     TEMP_SET_PT_BOTH (Z, Z_BYTE);
>   else
>     TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));
> 
>   We pick the "else" branch. The end result is the exact failing state
>   we hit on the next pass through redisplay_window().
> 
> 
> This sounds like a different flavor of what I described yesterday. So in
> summary: in a redisplay_window() call:
> 
> - We set the opoint on line 20064. This is a text_pos, NOT a marker. So
>   it wouldn't be updated due to the buffer changing.
> 
> - On line 20941 we call display_mode_lines() which eventually deletes
>   lines at the start of *Messages* and moves the point.
> 
> - On line 21908 we restore the opoint, saved prior to the lines being
>   deleted, and no longer valid

So let me see if I understand you correctly regarding what happens:

  . The *Messages* buffer is displayed in a window, which is
    redisplayed, and the display engine calls redisplay_window for it.
  . redisplay_window records the original position of point in the
    *Messages* buffer, then calls display_mode_lines, as it does for
    any window whose mode line needs to be redrawn for some reason
  . somewhere inside display_mode_lines, we call message_dolog, most
    probably because the mode-line format calls :eval, which signals
    an error
  . message_dolog adds some text to *Messages* and removes some other
    text from it, which invalidates the position of point recorded at
    the beginning of redisplay_window
  . redisplay_window then uses invalid value of point (including its
    byte position, which no longer corresponds to the character
    position) to set point, and that opens the gates of hell

Is that correct?  If so, this puzzle has the following pieces:

  . *Messages* is displayed and includes non-ASCII text
  . mode-line-format that signals an error when the window showing
    *Messages* is redisplayed
  . the size of *Messages* buffer and its contents are such that
    moving point to the value recorded at entry to redisplay_window
    produces a mismatch between PT and PT_BYTE

If all of the above happen, we are toast.  Right?

Can you verify that the above theory is true?  For example does
CHARS_MODIFF value of the buffer after display_mode_lines returns
differ from its value before the call?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-30 16:21               ` Eli Zaretskii
@ 2024-07-30 20:39                 ` Dima Kogan
  2024-08-01 11:03                   ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-07-30 20:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

> So let me see if I understand you correctly regarding what happens:
>
>   . The *Messages* buffer is displayed in a window, which is
>     redisplayed, and the display engine calls redisplay_window for it.
>   . redisplay_window records the original position of point in the
>     *Messages* buffer, then calls display_mode_lines, as it does for
>     any window whose mode line needs to be redrawn for some reason
>   . somewhere inside display_mode_lines, we call message_dolog, most
>     probably because the mode-line format calls :eval, which signals
>     an error
>   . message_dolog adds some text to *Messages* and removes some other
>     text from it, which invalidates the position of point recorded at
>     the beginning of redisplay_window
>   . redisplay_window then uses invalid value of point (including its
>     byte position, which no longer corresponds to the character
>     position) to set point, and that opens the gates of hell
>
> Is that correct?

Yes


> If so, this puzzle has the following pieces:
>
>   . *Messages* is displayed and includes non-ASCII text

Yes. My current understanding is that ASCII-only text could make the new
stuff in *Messages* end up in the wrong place, but wouldn't cause a
crash


>   . mode-line-format that signals an error when the window showing
>     *Messages* is redisplayed
>   . the size of *Messages* buffer and its contents are such that
>     moving point to the value recorded at entry to redisplay_window
>     produces a mismatch between PT and PT_BYTE
>
> If all of the above happen, we are toast.  Right?

Yes


> Can you verify that the above theory is true?

This is consistent with everything I see.


> For example does CHARS_MODIFF value of the buffer after
> display_mode_lines returns differ from its value before the call?

Top    of display_mode_lines(): CHARS_MODIFF = 29606
Bottom of display_mode_lines(): CHARS_MODIFF = 29703





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-07-30 20:39                 ` Dima Kogan
@ 2024-08-01 11:03                   ` Eli Zaretskii
  2024-08-01 14:14                     ` Dima Kogan
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-08-01 11:03 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 72165@debbugs.gnu.org
> Date: Wed, 31 Jul 2024 05:39:28 +0900
> 
> > So let me see if I understand you correctly regarding what happens:
> >
> >   . The *Messages* buffer is displayed in a window, which is
> >     redisplayed, and the display engine calls redisplay_window for it.
> >   . redisplay_window records the original position of point in the
> >     *Messages* buffer, then calls display_mode_lines, as it does for
> >     any window whose mode line needs to be redrawn for some reason
> >   . somewhere inside display_mode_lines, we call message_dolog, most
> >     probably because the mode-line format calls :eval, which signals
> >     an error
> >   . message_dolog adds some text to *Messages* and removes some other
> >     text from it, which invalidates the position of point recorded at
> >     the beginning of redisplay_window
> >   . redisplay_window then uses invalid value of point (including its
> >     byte position, which no longer corresponds to the character
> >     position) to set point, and that opens the gates of hell
> >
> > Is that correct?
> 
> Yes
> 
> 
> > If so, this puzzle has the following pieces:
> >
> >   . *Messages* is displayed and includes non-ASCII text
> 
> Yes. My current understanding is that ASCII-only text could make the new
> stuff in *Messages* end up in the wrong place, but wouldn't cause a
> crash
> 
> 
> >   . mode-line-format that signals an error when the window showing
> >     *Messages* is redisplayed
> >   . the size of *Messages* buffer and its contents are such that
> >     moving point to the value recorded at entry to redisplay_window
> >     produces a mismatch between PT and PT_BYTE
> >
> > If all of the above happen, we are toast.  Right?
> 
> Yes
> 
> 
> > Can you verify that the above theory is true?
> 
> This is consistent with everything I see.
> 
> 
> > For example does CHARS_MODIFF value of the buffer after
> > display_mode_lines returns differ from its value before the call?
> 
> Top    of display_mode_lines(): CHARS_MODIFF = 29606
> Bottom of display_mode_lines(): CHARS_MODIFF = 29703

Thanks.  I've now installed a fix on the emacs-30 branch; let's hope
this bug will not happen anymore.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-08-01 11:03                   ` Eli Zaretskii
@ 2024-08-01 14:14                     ` Dima Kogan
  2024-08-05  1:49                       ` Dima Kogan
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-08-01 14:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks. I've now installed a fix on the emacs-30 branch; let's hope
> this bug will not happen anymore.

Excellent. Thank you. Let me do a rebuild and try to confirm that this
has indeed been fixed. I'll report back on this bug in a week or two.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-08-01 14:14                     ` Dima Kogan
@ 2024-08-05  1:49                       ` Dima Kogan
  2024-08-05  1:51                         ` Dima Kogan
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-08-05  1:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165-done

> Excellent. Thank you. Let me do a rebuild and try to confirm that this
> has indeed been fixed.

I just tried to make it crash with the patch applied, and I can't do it.
It's not a perfect test, since I never had a 100% method of doing that,
but I'm willing to believe. I'm closing the bug.

Thank you very much!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-08-05  1:49                       ` Dima Kogan
@ 2024-08-05  1:51                         ` Dima Kogan
  2024-08-05  2:30                           ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Dima Kogan @ 2024-08-05  1:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72165

Oh, and can this be merged into master?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#72165: 31.0.50; Intermittent crashing with recent emacs build
  2024-08-05  1:51                         ` Dima Kogan
@ 2024-08-05  2:30                           ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-08-05  2:30 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 72165

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 72165@debbugs.gnu.org
> Date: Mon, 05 Aug 2024 08:51:33 +0700
> 
> Oh, and can this be merged into master?

It already was merged.





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-08-05  2:30 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).