unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: hi@yagnesh.org, 17011@debbugs.gnu.org
Subject: bug#17011: 24.3.50; Random Emacs crash when opening image/pdf files from magit.
Date: Wed, 26 Mar 2014 17:19:36 +0200	[thread overview]
Message-ID: <83ha6lyol3.fsf@gnu.org> (raw)
In-Reply-To: <533268CE.9020908@cs.ucla.edu>

> Date: Tue, 25 Mar 2014 22:42:38 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> Cc: 17011@debbugs.gnu.org
> 
> Thanks, with that backtrace I reproduced the core dump as follows:
> 
> Build emacs with -DENABLE_CHECKING in CFLAGS.
> ./emacs -Q
> M-x find-file-literally RET somefile RET
> M-x set-var RET case-fold-search RET t RET
> M-: (char-equal 270 300) RET
> 
> I installed a patch as emacs-24 bzr 116863, which worked for me; please 
> give it a try.
> 
> http://bzr.savannah.gnu.org/lh/emacs/emacs-24/revision/116863

That's a backward-incompatible change: it changes behavior for those
eight-bit bytes that are now interpreted as Latin letters.  I don't
think we should make incompatible changes on the release branch (or at
all) in this case.

I suggest the following compatible change (the diffs are relative to
the emacs-24 sources before r116833):

--- src/editfns.c~0	2014-01-26 07:13:31 +0200
+++ src/editfns.c	2014-03-26 10:14:31 +0200
@@ -4378,16 +4378,19 @@ Case is ignored if `case-fold-search' is
     return Qnil;
 
   i1 = XFASTINT (c1);
-  if (NILP (BVAR (current_buffer, enable_multibyte_characters))
-      && ! ASCII_CHAR_P (i1))
-    {
-      MAKE_CHAR_MULTIBYTE (i1);
-    }
   i2 = XFASTINT (c2);
-  if (NILP (BVAR (current_buffer, enable_multibyte_characters))
-      && ! ASCII_CHAR_P (i2))
+  if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
     {
-      MAKE_CHAR_MULTIBYTE (i2);
+      /* It should still be possible to compare multibyte characters
+	 even though the current buffer is unibyte (see bug#17011).
+	 This causes dilemma wrt characters between 128 and 255 --
+	 they could be either eight-bit raw bytes or Latin-1
+	 characters.  We resolve this dilemma here in favor of
+	 eight-bit bytes, since we are in a unibyte buffer.  */
+      if (! ASCII_CHAR_P (i1) && i1 < 0x0100)
+	MAKE_CHAR_MULTIBYTE (i1);
+      if (! ASCII_CHAR_P (i2) && i2 < 0x0100)
+	MAKE_CHAR_MULTIBYTE (i2);
     }
   return (downcase (i1) == downcase (i2) ? Qt :  Qnil);
 }





  reply	other threads:[~2014-03-26 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  5:10 bug#17011: 24.3.50; Random Emacs crash when opening image/pdf files from magit Yagnesh Raghava Yakkala
2014-03-26  5:42 ` Paul Eggert
2014-03-26 15:19   ` Eli Zaretskii [this message]
2014-03-26 18:01     ` Paul Eggert
2014-03-26 18:53       ` Eli Zaretskii
2014-03-30  5:53 ` Paul Eggert

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=83ha6lyol3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17011@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=hi@yagnesh.org \
    /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).