unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: 5992-done@debbugs.gnu.org
Subject: bug#5992: Crash in bidi_paragraph_init
Date: Wed, 21 Apr 2010 21:14:45 +0300	[thread overview]
Message-ID: <83hbn44qqy.fsf@gnu.org> (raw)
In-Reply-To: <k2lf7ccd24b1004201549h18af54e4qa27c5a4d36621a79@mail.gmail.com>

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






  reply	other threads:[~2010-04-21 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 22:49 bug#5992: Crash in bidi_paragraph_init Juanma Barranquero
2010-04-21 18:14 ` Eli Zaretskii [this message]
2010-04-21 19:34   ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83hbn44qqy.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=5992-done@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    /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 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).