all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* localized strsignal problem
@ 2009-06-16  0:28 Kenichi Handa
  0 siblings, 0 replies; only message in thread
From: Kenichi Handa @ 2009-06-16  0:28 UTC (permalink / raw)
  To: emacs-devel

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  <dima@sphinx.net.ru>  (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
handa@m17n.org

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-16  0:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-16  0:28 localized strsignal problem Kenichi Handa

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.