From: Eli Zaretskii <eliz@gnu.org>
To: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Cc: 27761@debbugs.gnu.org, jwiegley@gmail.com, charles@aurox.ch,
denis.redozubov@gmail.com
Subject: bug#27761: Crash while using proof-general/company-coq on OS X
Date: Fri, 04 Aug 2017 11:24:59 +0300 [thread overview]
Message-ID: <83bmnvyc2s.fsf@gnu.org> (raw)
In-Reply-To: <wl7eyj7wma.wl%mituharu@math.s.chiba-u.ac.jp> (message from YAMAMOTO Mitsuharu on Fri, 04 Aug 2017 14:03:25 +0900)
> Date: Fri, 04 Aug 2017 14:03:25 +0900
> From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
> Cc: 27761@debbugs.gnu.org, jwiegley@gmail.com, charles@aurox.ch,
> Денис Редозубов
> <denis.redozubov@gmail.com>
>
> I tried setting a breakpoint at the only recursive call to
> get_next_display_element and print *it. The result is shown at the
> end of this mail (the line number is slightly different because I used
> the Mac port).
>
> Notably, it->what == IT_EOB, it->method == GET_FROM_STRING,
> it->stop_charpos == 4, it->current.string_pos.charpos (aka
> IT_STRING_CHARPOS (*it)) == 6, it->string is a Lisp string " 164", and
> it->face_box_p == false. Thus, GET_NEXT_DISPLAY_ELEMENT (it) at the
> entry of get_next_display_element sets it->what to IT_EOB again in
> next_element_from_string, all the top-level conditions in
> get_next_display_element become false except the last one, and goes
> directly to the recursive call again.
Yes, the problem is obviously that set_iterator_to_next doesn't pop
the iterator stack for some reason. And that seems to happen because
it->end_charpos is 4, which corresponds to " 163", but does NOT
correspond to the "forall" string. I'd like to understand how did
this happen, I think some code is missing somewhere to support this
complicated use case.
In any case, just stabbing in the dark, one possible band-aid could be
this:
diff --git a/src/xdisp.c b/src/xdisp.c
index c6f8566..95cbbe9 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7655,7 +7655,8 @@ set_iterator_to_next (struct it *it, bool reseat_p)
its end, and there is something on IT->stack, proceed
with what is on the stack. This can be either another
string, this time an overlay string, or a buffer. */
- if (IT_STRING_CHARPOS (*it) == SCHARS (it->string)
+ if ((IT_STRING_CHARPOS (*it) == SCHARS (it->string)
+ || IT_STRING_CHARPOS (*it) >= it->end_charpos)
&& it->sp > 0)
{
pop_it (it);
Another possible band-aid is this:
diff --git a/src/xdisp.c b/src/xdisp.c
index c6f8566..bc6d51c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7320,8 +7320,10 @@ get_next_display_element (struct it *it)
because otherwise that stuff will never be displayed. */
if (!success_p && it->sp > 0)
{
+ int old_sp = it->sp;
set_iterator_to_next (it, false);
- success_p = get_next_display_element (it);
+ if (it->sp != old_sp)
+ success_p = get_next_display_element (it);
}
/* Value is false if end of buffer or string reached. */
But even if these band-aids do succeed in preventing the infinite
recursion, I'd like to understand how did we arrive at the situation
where the string position is 6 while the string being displayed is "
163", a 4-character string. If you can step through the code and
describe what you see, I think it will help to find the real culprit.
Thanks.
next prev parent reply other threads:[~2017-08-04 8:24 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 2:50 bug#27761: Crash while using proof-general/company-coq on OS X Денис Редозубов
2017-07-19 13:08 ` John Wiegley
2017-07-19 17:00 ` Eli Zaretskii
2017-07-19 17:47 ` John Wiegley
2017-07-19 18:07 ` Eli Zaretskii
2017-07-19 18:34 ` John Wiegley
2017-07-19 18:40 ` Eli Zaretskii
2017-07-19 19:03 ` Денис Редозубов
2017-07-19 19:08 ` Charles A. Roelli
2017-07-19 19:12 ` Charles A. Roelli
2017-07-19 19:20 ` Денис Редозубов
2017-07-20 5:43 ` Eli Zaretskii
2017-07-20 6:20 ` Charles A. Roelli
2017-07-20 18:54 ` Charles A. Roelli
2017-07-20 19:11 ` Eli Zaretskii
2017-07-20 20:06 ` Денис Редозубов
2017-07-21 2:17 ` Денис Редозубов
2017-07-21 4:58 ` Charles A. Roelli
2017-07-21 18:43 ` Charles A. Roelli
2017-07-21 19:12 ` Eli Zaretskii
2017-07-24 16:58 ` Glenn Morris
2017-07-24 17:02 ` Eli Zaretskii
2017-07-26 19:42 ` Charles A. Roelli
2017-07-27 13:12 ` Денис Редозубов
2017-07-28 18:48 ` Charles A. Roelli
2017-07-28 19:11 ` Eli Zaretskii
2017-07-29 20:03 ` Денис Редозубов
2017-07-30 2:30 ` Eli Zaretskii
2017-07-30 15:13 ` Денис Редозубов
2017-07-30 15:16 ` Eli Zaretskii
2017-07-31 19:10 ` Charles A. Roelli
2017-07-31 19:12 ` Charles A. Roelli
2017-08-01 18:22 ` Денис Редозубов
2017-08-01 19:12 ` Eli Zaretskii
2017-08-01 21:05 ` Денис Редозубов
2017-08-01 22:27 ` John Wiegley
2017-08-01 22:48 ` Денис Редозубов
2017-08-02 3:25 ` Eli Zaretskii
2017-08-02 7:29 ` John Wiegley
2017-08-02 7:53 ` Денис Редозубов
2017-08-02 17:32 ` Eli Zaretskii
2017-08-03 8:10 ` Денис Редозубов
2017-08-03 16:14 ` Eli Zaretskii
2017-08-04 1:23 ` YAMAMOTO Mitsuharu
2017-08-04 5:03 ` YAMAMOTO Mitsuharu
2017-08-04 8:24 ` Eli Zaretskii [this message]
2017-08-07 6:16 ` YAMAMOTO Mitsuharu
2017-08-07 17:51 ` Eli Zaretskii
2017-08-07 21:27 ` Денис Редозубов
2017-08-08 2:28 ` Eli Zaretskii
2017-08-07 23:06 ` John Wiegley
2017-08-08 2:33 ` Eli Zaretskii
2017-08-08 7:24 ` John Wiegley
2017-08-08 0:23 ` YAMAMOTO Mitsuharu
2017-08-08 2:31 ` Eli Zaretskii
2017-08-04 8:17 ` Eli Zaretskii
2017-08-02 3:22 ` Eli Zaretskii
2017-07-25 1:15 ` John Wiegley
2017-07-21 5:52 ` Eli Zaretskii
2017-08-03 8:36 ` YAMAMOTO Mitsuharu
2017-08-03 16:18 ` Eli Zaretskii
2017-08-03 21:16 ` Денис Редозубов
2017-08-04 0:16 ` YAMAMOTO Mitsuharu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83bmnvyc2s.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=27761@debbugs.gnu.org \
--cc=charles@aurox.ch \
--cc=denis.redozubov@gmail.com \
--cc=jwiegley@gmail.com \
--cc=mituharu@math.s.chiba-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.