unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5992: Crash in bidi_paragraph_init
@ 2010-04-20 22:49 Juanma Barranquero
  2010-04-21 18:14 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Juanma Barranquero @ 2010-04-20 22:49 UTC (permalink / raw)
  To: 5992

Package: emacs,bidi
Version: 24.0.50

emacs -Q --eval "(setq-default bidi-display-reordering t)"
..\doc\lispref\locals.texi


Breakpoint 1, w32_abort () at w32fns.c:7349
7349      button = MessageBox (NULL,
(gdb) bt
#0  w32_abort () at w32fns.c:7349
#1  0x012bf00b in bidi_paragraph_init (dir=NEUTRAL_DIR,
bidi_it=0x88d9c8) at bidi.c:909
#2  0x01066004 in set_iterator_to_next (it=0x88d470, reseat_p=1) at xdisp.c:6260
#3  0x0108f3f0 in display_line (it=0x88d470) at xdisp.c:17725
#4  0x010847c7 in try_window (window=55639045, pos=..., flags=1) at
xdisp.c:14674
#5  0x01082be5 in redisplay_window (window=55639045,
just_this_one_p=0) at xdisp.c:14295
#6  0x0107bada in redisplay_window_0 (window=55639045) at xdisp.c:12587
#7  0x010362ca in internal_condition_case_1 (bfun=0x107baa7
<redisplay_window_0>, arg=55639045, handlers=49859198,
    hfun=0x107ba86 <redisplay_window_error>) at eval.c:1560
#8  0x0107ba6d in redisplay_windows (window=55639045) at xdisp.c:12566
#9  0x010796dc in redisplay_internal (preserve_echo_area=0) at xdisp.c:12138
#10 0x010762ec in redisplay () at xdisp.c:11368
#11 0x0100a784 in read_char (commandflag=1, nmaps=2, maps=0x88f960,
prev_event=49874970, used_mouse_menu=0x88fa38, end_time=0x0) at
keyboard.c:2576
#12 0x0101d3f0 in read_key_sequence (keybuf=0x88fbcc, bufsize=30,
prompt=49874970, dont_downcase_last=0, can_return_switch_frame=1,
    fix_current_buffer=1) at keyboard.c:9349
#13 0x01007bf7 in command_loop_1 () at keyboard.c:1636
#14 0x010361e2 in internal_condition_case (bfun=0x100734e
<command_loop_1>, handlers=49932506, hfun=0x1006a75 <cmd_error>) at
eval.c:1512
#15 0x01006f4f in command_loop_2 () at keyboard.c:1356
#16 0x01035c64 in internal_catch (tag=49930674, func=0x1006f2a
<command_loop_2>, arg=49874970) at eval.c:1248
#17 0x01006f08 in command_loop () at keyboard.c:1335
#18 0x01006180 in recursive_edit_1 () at keyboard.c:950
#19 0x0100669b in Frecursive_edit () at keyboard.c:1012
#20 0x01002a95 in main (argc=5, argv=0xd52d30) at emacs.c:1784







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

* bug#5992: Crash in bidi_paragraph_init
  2010-04-20 22:49 bug#5992: Crash in bidi_paragraph_init Juanma Barranquero
@ 2010-04-21 18:14 ` Eli Zaretskii
  2010-04-21 19:34   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2010-04-21 18:14 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 5992-done

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Wed, 21 Apr 2010 00:49:15 +0200
> Cc: 
> 
> emacs -Q --eval "(setq-default bidi-display-reordering t)"
> ..\doc\lispref\locals.texi
> 
> 
> Breakpoint 1, w32_abort () at w32fns.c:7349
> 7349      button = MessageBox (NULL,
> (gdb) bt
> #0  w32_abort () at w32fns.c:7349
> #1  0x012bf00b in bidi_paragraph_init (dir=NEUTRAL_DIR,
> bidi_it=0x88d9c8) at bidi.c:909
> #2  0x01066004 in set_iterator_to_next (it=0x88d470, reseat_p=1) at xdisp.c:6260

This happens because texinfo.el defines a local value for
paragraph-start and paragraph-separate that match non-empty lines that
don't need to include newlines:

  (setq paragraph-separate
	(concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
  (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))

Thus, "@foo " is a paragraph separator.  The bidi reordering code is
not ready for such surprises, because UAX#9 says:

   The algorithm reorders text only within a paragraph; characters in
   one paragraph have no effect on characters in a different
   paragraph. Paragraphs are divided by the Paragraph Separator or
   appropriate Newline Function [...]. Paragraphs may also be
   determined by higher-level protocols: for example, the text in two
   different cells of a table will be in different paragraphs.

We use the ``higher-level protocols'' fire escape to define a
paragraph in Emacsy way.  But the algorithm still expects the
paragraph to begin and end in a newline.  If paragraph-start and
paragraph-separate don't cooperate, sooner or later bidi.c will crash.

In retrospect, it was too audacious of me to use the buffer-local
value of these two variables, considering the interesting ways in
which various modes define them.

I installed a change that uses only the default values of these
variables.  If people think this is not flexible enough, we can always
add something like bidi-paragraph-start etc., or find some other
solution.






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

* bug#5992: Crash in bidi_paragraph_init
  2010-04-21 18:14 ` Eli Zaretskii
@ 2010-04-21 19:34   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2010-04-21 19:34 UTC (permalink / raw)
  To: 5992

> This happens because texinfo.el defines a local value for
> paragraph-start and paragraph-separate that match non-empty lines that
> don't need to include newlines:

>   (setq paragraph-separate
> 	(concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
>   (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))

> Thus, "@foo " is a paragraph separator.

Actually, IIRC what paragraphs.el says is not quite that "@foo " is
a paragraph separator, but that a line that starts with "@foo " is
a paragraph separator (i.e. is not part of a paragraph).

So it doesn't seem incompatible with your needs.


        Stefan






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

end of thread, other threads:[~2010-04-21 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20 22:49 bug#5992: Crash in bidi_paragraph_init Juanma Barranquero
2010-04-21 18:14 ` Eli Zaretskii
2010-04-21 19:34   ` Stefan Monnier

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