unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
@ 2018-08-03  2:10 Keith David Bershatsky
  2018-08-03  6:45 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Keith David Bershatsky @ 2018-08-03  2:10 UTC (permalink / raw)
  To: 32351

I apologize in advance for "not yet" having a concise recipe from Emacs -Q.  I can work on creating a recipe in the coming days/weeks/months.  I am able to produce this reliably in Emacs master branch, using a full user configuration.  Here are the relevant lines from LIST to the assq_no_quit function.

(line-number-current-line . [face unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified line-number unspecified unspecified])

(line-number . [face unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified (shadow default) unspecified unspecified])

(default . [face "Courier" "nil" normal 180 normal normal nil nil "white" "black" nil nil nil nil #<font-object "-*-Courier-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1"> nil "-*-Courier-normal-normal-normal-*-18-*-*-*-m-0-fontset-auto1" unspecified]))

If I start/stop Emacs with the gdb, the KEY to assq_no_quit oscillates from the above three (3) faces.  Any ideas why this is a never ending loop?

The source code line numbers will be off because this is my working copy for developing feature requests (crosshairs/multiple-fake-cursors).  According to the gdb printout, my custom modifications are not at issue here.  Maybe it has something do with "font-object" in the default face above?

Program received signal SIGTSTP, Stopped (user).
0x0000000100216c51 in assq_no_quit (key=XIL(0x7c80), list=XIL(0x11b813b63))
    at fns.c:1487
1487	  for (; ! NILP (list); list = XCDR (list))
(gdb) bt
#0  0x0000000100216c51 in assq_no_quit (key=XIL(0x7c80), list=XIL(0x11b813b63))
    at fns.c:1487
#1  0x000000010012c656 in lface_from_face_name_no_resolve (f=0x10308cbb0, 
    face_name=XIL(0x7c80), signal_p=false) at xfaces.c:1860
#2  0x000000010012c74f in get_lface_attributes_no_remap (f=0x10308cbb0, 
    face_name=XIL(0x7c80), attrs=0x7fff5fbebb30, signal_p=false)
    at xfaces.c:1902
#3  0x000000010012c956 in get_lface_attributes (w=0x10309da30, f=0x10308cbb0, 
    face_name=XIL(0x7c80), attrs=0x7fff5fbebb30, signal_p=false, 
    named_merge_points=0x7fff5fbebbd0) at xfaces.c:1952
#4  0x000000010012d3c9 in merge_named_face (w=0x10309da30, f=0x10308cbb0, 
    face_name=XIL(0x7c80), to=0x7fff5fbebc30, named_merge_points=0x7fff5fbebbd0)
    at xfaces.c:2178
#5  0x0000000100138b28 in merge_faces (w=0x10309da30, face_name=XIL(0x7c80), 
    face_id=0, base_face_id=0) at xfaces.c:6352
#6  0x000000010007a8ba in maybe_produce_line_number (it=0x7fff5fbf5880)
    at xdisp.c:23690
#7  0x000000010005067f in move_it_in_display_line_to (it=0x7fff5fbf5880, 
    to_charpos=11104, to_x=-1, op=MOVE_TO_POS) at xdisp.c:11166
#8  0x00000001000546c4 in move_it_to (it=0x7fff5fbf5880, to_charpos=11104, 
    to_x=-1, to_y=-1, to_vpos=-1, op=8) at xdisp.c:11976
#9  0x00000001000550b4 in move_it_vertically_backward (it=0x7fff5fbf80d0, 
    dy=962) at xdisp.c:12170
#10 0x000000010006ba00 in redisplay_window (window=XIL(0x10309da35), 
    just_this_one_p=false) at xdisp.c:19855
#11 0x0000000100062ba3 in redisplay_window_0 (window=XIL(0x10309da35))
    at xdisp.c:17440
#12 0x0000000100208b85 in internal_condition_case_1 (
    bfun=0x100062b64 <redisplay_window_0>, arg=XIL(0x10309da35), 
    handlers=XIL(0x10181fe43), hfun=0x100062b2c <redisplay_window_error>)
    at eval.c:1373
#13 0x0000000100062b02 in redisplay_windows (window=XIL(0x10309da35))
    at xdisp.c:17420
#14 0x0000000100062abd in redisplay_windows (window=XIL(0x11d4d4d15))
    at xdisp.c:17414
#15 0x00000001000614ba in redisplay_internal () at xdisp.c:16889
#16 0x000000010005b887 in echo_area_display (update_frame_p=true)
    at xdisp.c:14107
* * *





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-03  2:10 bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line) Keith David Bershatsky
@ 2018-08-03  6:45 ` Eli Zaretskii
  2018-08-03 15:17 ` Keith David Bershatsky
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2018-08-03  6:45 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 32351

> Date: Thu, 02 Aug 2018 19:10:12 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
> 
> I apologize in advance for "not yet" having a concise recipe from Emacs -Q.  I can work on creating a recipe in the coming days/weeks/months.  I am able to produce this reliably in Emacs master branch, using a full user configuration.  Here are the relevant lines from LIST to the assq_no_quit function.

Where does the error message cited in the subject come from?  It
doesn't come from assq_no_quit, does it?

Also, your line numbers don't match the current master (fns.c:1487 is
not in assq_no_quit), so I cannot be sure what local changes do you
have that are involved.

And finally, yes, a recipe which at least states what are the
customizations required to reproduce would be nice.

Thanks.





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-03  2:10 bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line) Keith David Bershatsky
  2018-08-03  6:45 ` Eli Zaretskii
@ 2018-08-03 15:17 ` Keith David Bershatsky
  2018-08-03 17:54   ` Eli Zaretskii
  2018-08-05  3:26 ` Keith David Bershatsky
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Keith David Bershatsky @ 2018-08-03 15:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32351

Thank you, Eli, for looking at issue #32351.

There is no error message, just a never-ending loop.  Source code line numbers in fns.c match up with 07/07/2018 master branch bearing commit 98463bed07ecc9057094928ffdc2321eaaf3ab52.  This is my working build with feature requests (crosshairs and multiple fake cursors).  No reversions have been made to fns.c.

The general circumstances with a full configuration are as follows:

1.  Original single window in a GUI frame with native line numbers and truncate-lines non-nil.

2.  Try to create/display a new window to the right that takes up approximately 95 percent of the overall frame; e.g., my custom 12 month rotating calendar.  [A workaround would be "well, if it hurts, then don't do that".  However, it would be nice to come up with a programmatic solution to avoid a never-ending loop.]

3.  Emacs tries to display line numbers on the little sliver of a tall/razor-thin window.  However, redisplay never finishes so the new window is not yet displayed and all that is visible to the naked eye is the full-size original window.

4.  assq_no_quit goes into a forever never-ending loop.

5.  C-z in the terminal to break with gdb.

6.  Step:  while (CONSP (list)

7.  Step:  list = XCDR (list);

8.  Repeat stepping to infinity; e.g., step 500 yields the same results as paragraph 6/7 above.

I can reproduce this on my end every time, so if there is anything you would like to see with gdb, I'd be happy to print.  However, I may need some guidance regarding how to do it, since I just know the basics such as pp OBJECT, print, step and so forth.  I anticipate having some time in the evenings over the weekend and can work on trying to come up with an Emacs -Q recipe.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [08-02-2018 23:45:37] <03 Aug 2018 09:45:37 +0300>
> From: Eli Zaretskii <eliz@gnu.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> CC: 32351@debbugs.gnu.org
> Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
> 
> > Date: Thu, 02 Aug 2018 19:10:12 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> >
> > I apologize in advance for "not yet" having a concise recipe from Emacs -Q.  I can work on creating a recipe in the coming days/weeks/months.  I am able to produce this reliably in Emacs master branch, using a full user configuration.  Here are the relevant lines from LIST to the assq_no_quit function.
> 
> Where does the error message cited in the subject come from?  It
> doesn't come from assq_no_quit, does it?
> 
> Also, your line numbers don't match the current master (fns.c:1487 is
> not in assq_no_quit), so I cannot be sure what local changes do you
> have that are involved.
> 
> And finally, yes, a recipe which at least states what are the
> customizations required to reproduce would be nice.
> 
> Thanks.





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-03 15:17 ` Keith David Bershatsky
@ 2018-08-03 17:54   ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2018-08-03 17:54 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 32351

> Date:  Fri, 03 Aug 2018 08:17:30 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  32351@debbugs.gnu.org
> 
> 1.  Original single window in a GUI frame with native line numbers and truncate-lines non-nil.
> 
> 2.  Try to create/display a new window to the right that takes up approximately 95 percent of the overall frame; e.g., my custom 12 month rotating calendar.  [A workaround would be "well, if it hurts, then don't do that".  However, it would be nice to come up with a programmatic solution to avoid a never-ending loop.]
> 
> 3.  Emacs tries to display line numbers on the little sliver of a tall/razor-thin window.  However, redisplay never finishes so the new window is not yet displayed and all that is visible to the naked eye is the full-size original window.
> 
> 4.  assq_no_quit goes into a forever never-ending loop.

Are you saying that this happens when the window is too narrow to show
the line numbers?  If so, what solution would you like to have? refuse
to display the line numbers?





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-03  2:10 bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line) Keith David Bershatsky
  2018-08-03  6:45 ` Eli Zaretskii
  2018-08-03 15:17 ` Keith David Bershatsky
@ 2018-08-05  3:26 ` Keith David Bershatsky
  2018-08-13  1:36 ` Keith David Bershatsky
  2018-08-28 18:46 ` Keith David Bershatsky
  4 siblings, 0 replies; 9+ messages in thread
From: Keith David Bershatsky @ 2018-08-05  3:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32351

Yes, refusing to display the line numbers seems like a good choice to avoid a never-ending infinite loop.

At the outset of maybe_produce_line_number, I added the following code:

  int text_area_width = window_box_width (it->w, TEXT_AREA);
  if (!NILP (Vdisplay_line_numbers)
      && text_area_width < it->lnum_pixel_width)
    return;

It does not necessarily have to be that code exactly, but something along those lines would suffice.

And, the never-ending loop is now gone when using the above modification.  Due to my inexperience with gdb, I erroneously assumed that assq_no_quit or the function calling it was to blame.  However, pressing C-z to break with gdb simply ended up on assq_no_quit by the laws of probability because the LIST takes more time to process than everything else in the redisplay of the target window loop.  By setting up a break in maybe_produce_line_numbers and other functions, I was able to see that the loop is caused by trying/retrying to display the window containing line numbers.

With the above code, redisplay finishes successfully and I can see that just one (1) column of text is visible in the tall/thin sliver of a window.  And, the above code of course disables line numbers in this situation.

If it is not too much trouble, would it be possible for you to please teach me how to print a human-readable int with gdb such as text_area_width.  I ended up with:

(gdb) print text_area_width 
$1 = 1606380704

To see a human-readable value, I turned it into a Lisp Object and used pp OBJECT.  It would be nice to print int values from gdb and see human readable values without modifying the code to turn the int it into a Lisp Object prior thereto.

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [08-03-2018 10:54:37] <03 Aug 2018 20:54:37 +0300>
> From: Eli Zaretskii <eliz@gnu.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> CC: 32351@debbugs.gnu.org
> Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
> 
> > Date:  Fri, 03 Aug 2018 08:17:30 -0700
> > From:  Keith David Bershatsky <esq@lawlist.com>
> > Cc:  32351@debbugs.gnu.org
> >
> > 1.  Original single window in a GUI frame with native line numbers and truncate-lines non-nil.
> >
> > 2.  Try to create/display a new window to the right that takes up approximately 95 percent of the overall frame; e.g., my custom 12 month rotating calendar.  [A workaround would be "well, if it hurts, then don't do that".  However, it would be nice to come up with a programmatic solution to avoid a never-ending loop.]
> >
> > 3.  Emacs tries to display line numbers on the little sliver of a tall/razor-thin window.  However, redisplay never finishes so the new window is not yet displayed and all that is visible to the naked eye is the full-size original window.
> >
> > 4.  assq_no_quit goes into a forever never-ending loop.
> 
> Are you saying that this happens when the window is too narrow to show
> the line numbers?  If so, what solution would you like to have? refuse
> to display the line numbers?





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-03  2:10 bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line) Keith David Bershatsky
                   ` (2 preceding siblings ...)
  2018-08-05  3:26 ` Keith David Bershatsky
@ 2018-08-13  1:36 ` Keith David Bershatsky
  2018-08-28 11:12   ` Eli Zaretskii
  2018-08-28 18:46 ` Keith David Bershatsky
  4 siblings, 1 reply; 9+ messages in thread
From: Keith David Bershatsky @ 2018-08-13  1:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32351

The preceding post to issue #32351 contains a proposed solution, which appears to resolve the issue.

Here is the Emacs -Q recipe (to create the infinite redisplay loop) for both Emacs master branch and also Emacs 26.  Tested on Emacs GUI versions built --with-ns.

(let ((buffer-one (get-buffer-create "*ONE*"))
      (buffer-two (get-buffer-create "*TWO*"))
      (alist (list (cons 'window-width (- (window-width) 5))))
      (window (split-window (selected-window) nil 'right)))
    (with-current-buffer buffer-one
      (set (make-local-variable 'truncate-partial-width-windows) nil)
      (dotimes (i 200)
        (insert-char 9786 10)
        (insert-char 10 1))
      (setq display-line-numbers t))
    (with-current-buffer buffer-two
      (dotimes (i 200)
        (insert-char 9786 80)
        (insert-char 10 1)))
    (set-window-buffer (selected-window) buffer-one)
    (window--display-buffer buffer-two window 'window alist nil))





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-13  1:36 ` Keith David Bershatsky
@ 2018-08-28 11:12   ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2018-08-28 11:12 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 32351

> Date:  Sun, 12 Aug 2018 18:36:02 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  32351@debbugs.gnu.org
> 
> The preceding post to issue #32351 contains a proposed solution, which appears to resolve the issue.
> 
> Here is the Emacs -Q recipe (to create the infinite redisplay loop) for both Emacs master branch and also Emacs 26.  Tested on Emacs GUI versions built --with-ns.

Thanks, should be fixed now on the emacs-26 branch.





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-03  2:10 bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line) Keith David Bershatsky
                   ` (3 preceding siblings ...)
  2018-08-13  1:36 ` Keith David Bershatsky
@ 2018-08-28 18:46 ` Keith David Bershatsky
  2018-08-28 19:19   ` Eli Zaretskii
  4 siblings, 1 reply; 9+ messages in thread
From: Keith David Bershatsky @ 2018-08-28 18:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32351

The test case for Emacs -q (mentioned in Message #20 of this thread) now succeeds without entering an infinite loop on Emacs 26 built --with-ns.  Good job!

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [08-28-2018 04:12:31] <28 Aug 2018 14:12:31 +0300>
> From: Eli Zaretskii <eliz@gnu.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> CC: 32351@debbugs.gnu.org
> Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
> 
> 
> Thanks, should be fixed now on the emacs-26 branch.





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

* bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
  2018-08-28 18:46 ` Keith David Bershatsky
@ 2018-08-28 19:19   ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2018-08-28 19:19 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 32351-done

> Date:  Tue, 28 Aug 2018 11:46:24 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  32351@debbugs.gnu.org
> 
> The test case for Emacs -q (mentioned in Message #20 of this thread) now succeeds without entering an infinite loop on Emacs 26 built --with-ns.  Good job!

Thanks for testing, I'm therefore closing the bug.





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

end of thread, other threads:[~2018-08-28 19:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03  2:10 bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line) Keith David Bershatsky
2018-08-03  6:45 ` Eli Zaretskii
2018-08-03 15:17 ` Keith David Bershatsky
2018-08-03 17:54   ` Eli Zaretskii
2018-08-05  3:26 ` Keith David Bershatsky
2018-08-13  1:36 ` Keith David Bershatsky
2018-08-28 11:12   ` Eli Zaretskii
2018-08-28 18:46 ` Keith David Bershatsky
2018-08-28 19:19   ` Eli Zaretskii

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