From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56393: Actually fix the long lines display bug Date: Sun, 17 Jul 2022 19:00:33 +0300 Message-ID: <83sfmzpw4e.fsf@gnu.org> References: <38c1a31040d2d2bc47ae@heytings.org> <38c1a310405bd4bbe370@heytings.org> <87a69n98yy.fsf@yahoo.com> <38c1a31040f5546dbd3a@heytings.org> <87czej6buq.fsf@gnus.org> <38c1a31040e66d2b273e@heytings.org> <834jzt59jt.fsf@gnu.org> <831qux5806.fsf@gnu.org> <9C70BEF7-08EC-46A0-89D3-547417FA01F8@gmail.com> <83let43xg9.fsf@gnu.org> <83sfna3gzq.fsf@gnu.org> <83fsja36an.fsf@gnu.org> <34362AA6-6404-4727-9C60-6B6CA6736DD4@gnus.org> <83v8rvpxx7.fsf@gnu.org> <209e6aa436f84e1f729a@heytings.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5918"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 56393@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 17 18:03:54 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oD6kL-0001OE-R5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Jul 2022 18:03:54 +0200 Original-Received: from localhost ([::1]:40756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oD6kK-0002rK-Cz for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Jul 2022 12:03:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oD6ha-0008Gz-PI for bug-gnu-emacs@gnu.org; Sun, 17 Jul 2022 12:01:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oD6ha-0000fg-EC for bug-gnu-emacs@gnu.org; Sun, 17 Jul 2022 12:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oD6ha-0007jN-2R for bug-gnu-emacs@gnu.org; Sun, 17 Jul 2022 12:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Jul 2022 16:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56393 X-GNU-PR-Package: emacs Original-Received: via spool by 56393-submit@debbugs.gnu.org id=B56393.165807365729699 (code B ref 56393); Sun, 17 Jul 2022 16:01:02 +0000 Original-Received: (at 56393) by debbugs.gnu.org; 17 Jul 2022 16:00:57 +0000 Original-Received: from localhost ([127.0.0.1]:48401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD6hU-0007ix-WC for submit@debbugs.gnu.org; Sun, 17 Jul 2022 12:00:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oD6hS-0007ij-Bv for 56393@debbugs.gnu.org; Sun, 17 Jul 2022 12:00:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oD6hM-0000dy-Mh; Sun, 17 Jul 2022 12:00:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iddqPFwcBC9nZa1Nvmk3WVg39DqZ3Z4BLO/sZBiaVlQ=; b=pVqkwQ5vqVFO PJPWgdS2dAS39ggPj+bOTMXTmpo9Onk88WaTTGlfTgWfnuEvdxxrCjZN96qm86fcLRstwzBBsHxtP xnAZyjbB2Hof5RjbaQJllD5B2Lf1/ZsXj8wgYmLN37CrOSqXRbqUrkjksebo+j4/P6R/ajoY77aQ7 1Ib9NL3avBKckY3Vz2c/FiGKkKo9heNNRy7SkaHPcdWQ5TgnG7oC1MAgz73anZNVDwFhIZgzKq7XP c+vQT3CaHm42oun9nNunFReNJ75i3zMbgL9kNfEJIy8QTgCu5VOAmxsOB+rh6MwoMAi+caNxKdDhd pYmwzjmRfNdg9djRY+l2Bw==; Original-Received: from [87.69.77.57] (port=3757 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oD6hM-0006yN-5X; Sun, 17 Jul 2022 12:00:48 -0400 In-Reply-To: <209e6aa436f84e1f729a@heytings.org> (message from Gregory Heytings on Sun, 17 Jul 2022 15:37:08 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:237285 Archived-At: > Date: Sun, 17 Jul 2022 15:37:08 +0000 > From: Gregory Heytings > cc: larsi@gnus.org, 56393@debbugs.gnu.org > > > > > > I still see a segfault in get_visually_first_element. To reproduce: > > > > emacs -Q > > C-x C-f long-line.xml > > C-u 12 M-g g > > C-s C-q C-j > > > > IOW, go to line 12 and search for a newline. I think this segfaults > > because point is very far from window-start, so the narrowing doesn't > > include the position where get_visually_first_element is called. > > > > Similarly, this also segfaults: > > > > emacs -Q > > C-x C-f long-line.xml > > C-u 15000 M-g c > > C-x 2 > > > > Thanks. I can't reproduce either of these two bugs with a regular build, > both of these recipes produce the expected result. Are these segfaults > due to --enable-checking? No, I don't think so. --enable-checking produces SIGABRT, not SIGSEGV. The segfault happens because it->bidi_it.bytepos is 1, and FETCH_BYTE cannot be called with a zero argument. Here's a relevant portion of a debugging session: Thread 1 received signal SIGSEGV, Segmentation fault. 0x01055028 in get_visually_first_element (it=0x82d250) at xdisp.c:8691 8691 && (FETCH_BYTE (it->bidi_it.bytepos - 1) == '\n' (gdb) bt #0 0x01055028 in get_visually_first_element (it=0x82d250) at xdisp.c:8691 #1 0x010563d4 in next_element_from_buffer (it=0x82d250) at xdisp.c:9149 #2 0x01052bd3 in get_next_display_element (it=0x82d250) at xdisp.c:7786 #3 0x01057166 in move_it_in_display_line_to (it=0x82d250, to_charpos=306655, to_x=0, op=(MOVE_TO_X | MOVE_TO_POS)) at xdisp.c:9574 #4 0x01059ce7 in move_it_to (it=0x82d250, to_charpos=306655, to_x=-1, to_y=543, to_vpos=-1, op=10) at xdisp.c:10245 #5 0x01038364 in pos_visible_p (w=0x75fd640, charpos=306655, x=0x82e23c, y=0x82e238, rtop=0x82e24c, rbot=0x82e248, rowh=0x82e244, vpos=0x82e240) at xdisp.c:1730 #6 0x010ca308 in Fpos_visible_in_window_p (pos=XIL(0), window=XIL(0), partially=XIL(0x30)) at window.c:2000 #7 0x01276489 in funcall_subr (subr=0x173c8c0 , numargs=3, args=0x68b0248) at eval.c:3000 #8 0x012e9634 in exec_byte_code (fun=XIL(0xa000000005db8a1c), args_template=768, nargs=3, args=0x68b0208) at bytecode.c:809 #9 0x012769cd in fetch_and_exec_byte_code (fun=XIL(0xa000000005db9bdc), args_template=256, nargs=1, args=0x82ebd0) at eval.c:3045 #10 0x01276f2c in funcall_lambda (fun=XIL(0xa000000005db9bdc), nargs=1, arg_vector=0x82ebd0) at eval.c:3117 #11 0x01275ee2 in funcall_general (fun=XIL(0xa000000005db9bdc), numargs=1, args=0x82ebd0) at eval.c:2908 #12 0x0127623e in Ffuncall (nargs=2, args=0x82ebc8) at eval.c:2958 #13 0x01265666 in Ffuncall_interactively (nargs=2, args=0x82ebc8) at callint.c:291 #14 0x0127687e in funcall_subr (subr=0x1747440 , numargs=2, args=0x82ebc8) at eval.c:3023 #15 0x01275e7b in funcall_general (fun=XIL(0xa000000001747440), numargs=2, args=0x82ebc8) at eval.c:2904 #16 0x0127623e in Ffuncall (nargs=3, args=0x82ebc0) at eval.c:2958 #17 0x01268869 in Fcall_interactively (function=XIL(0x452974c), record_flag=XIL(0), keys=XIL(0xa0000000076986d8)) at callint.c:829 #18 0x01276489 in funcall_subr (subr=0x1747480 , numargs=3, args=0x68b0078) at eval.c:3000 #19 0x012e9634 in exec_byte_code (fun=XIL(0xa000000005dff734), args_template=1025, nargs=1, args=0x82f5b0) at bytecode.c:809 #20 0x012769cd in fetch_and_exec_byte_code (fun=XIL(0xa000000005dff734), args_template=1025, nargs=1, args=0x82f5a8) at eval.c:3045 #21 0x01276f2c in funcall_lambda (fun=XIL(0xa000000005dff734), nargs=1, arg_vector=0x82f5a8) at eval.c:3117 #22 0x01275ee2 in funcall_general (fun=XIL(0xa000000005dff734), numargs=1, args=0x82f5a8) at eval.c:2908 #23 0x0127623e in Ffuncall (nargs=2, args=0x82f5a0) at eval.c:2958 #24 0x0116b50a in call1 (fn=XIL(0x4440), arg1=XIL(0x452974c)) at lisp.h:3239 #25 0x0116f73c in command_loop_1 () at keyboard.c:1510 #26 0x01270662 in internal_condition_case (bfun=0x116eab0 , handlers=XIL(0x90), hfun=0x116da7e ) at eval.c:1485 #27 0x0116e51d in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1132 #28 0x0126f4e9 in internal_catch (tag=XIL(0xfe70), func=0x116e4e6 , arg=XIL(0x90)) at eval.c:1208 #29 0x0116e488 in command_loop () at keyboard.c:1110 #30 0x0116d4de in recursive_edit_1 () at keyboard.c:719 #31 0x0116d77c in Frecursive_edit () at keyboard.c:802 #32 0x011686e6 in main (argc=2, argv=0xa42a10) at emacs.c:2517 Lisp Backtrace: "pos-visible-in-window-p" (0x68b0248) "pos-visible-in-window-group-p" (0x68b01f0) "isearch-update" (0x68b01a0) "isearch-search-and-update" (0x68b0178) "isearch-process-search-string" (0x68b0138) "isearch-process-search-char" (0x68b00d8) "isearch-quote-char" (0x82ebd0) "funcall-interactively" (0x82ebc8) "call-interactively" (0x68b0078) "command-execute" (0x82f5a8) (gdb) p it.bidi_it.bytepos $1 = 1 (gdb) p bob $2 = 293760 (gdb) p it->current $3 = { pos = { charpos = 1, bytepos = 1 }, overlay_string_index = -1, string_pos = { charpos = -1, bytepos = -1 }, dpvec_index = -1 }