emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

localized strsignal problem


From: Kenichi Handa
Subject: localized strsignal problem
Date: Tue, 16 Jun 2009 09:28:41 +0900

It is reported that this change causes args_out_of_range
error in Faset of status_message if strsignal returns a
string encoded in some locale encoding.

2009-06-09  Dmitry Dzhus  <address@hidden>  (tiny change)

        * process.c (status_message): Fix handling of multibyte signal
        string (Bug#3499).

That is because:
        string = build_string (signame);
returns a unibyte string containing 8-bit bytes in non-UTF-8
locale, and Faset can't change the multibuteness of string
in such a case.

So, I installed the attached patch.  But, as I don't have a
system whose strsignal returns a localized string, I can't
test it.  At least, I sent this patch to the above bug
reporter and he said that the patch surely fixed the
problem.

---
Kenichi Handa
address@hidden

--- process.c.~1.585.~  2009-06-11 13:54:48.000000000 +0900
+++ process.c   2009-06-15 13:48:57.000000000 +0900
@@ -464,15 +464,24 @@
   if (EQ (symbol, Qsignal) || EQ (symbol, Qstop))
     {
       char *signame;
-      int c;
       synchronize_system_messages_locale ();
       signame = strsignal (code);
       if (signame == 0)
-       signame = "unknown";
-      string = build_string (signame);
+       string = build_string ("unknown");
+      else
+       {
+         int c1, c2;
+
+         string = make_unibyte_string (signame, strlen (signame));
+         if (! NILP (Vlocale_coding_system))
+           string = (code_convert_string_norecord
+                     (string, Vlocale_coding_system, 0));
+         c1 = STRING_CHAR ((char *) SDATA (string), 0);
+         c2 = DOWNCASE (c1);
+         if (c1 != c2)
+           Faset (string, 0, make_number (c2));
+       }
       string2 = build_string (coredump ? " (core dumped)\n" : "\n");
-      c = STRING_CHAR ((char *) SDATA (string), 0);
-      Faset (string, 0, make_number (DOWNCASE (c)));
       return concat2 (string, string2);
     }
   else if (EQ (symbol, Qexit))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]