From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: image file with Chinese file names Date: Mon, 03 Apr 2006 10:26:25 +0900 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1144027625 18234 80.91.229.2 (3 Apr 2006 01:27:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 3 Apr 2006 01:27:05 +0000 (UTC) Cc: mjchan@myrealbox.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 03 03:27:04 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FQDqS-0002pr-8x for ged-emacs-devel@m.gmane.org; Mon, 03 Apr 2006 03:27:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQDqR-0007yp-PK for ged-emacs-devel@m.gmane.org; Sun, 02 Apr 2006 21:27:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQDqF-0007tq-E6 for emacs-devel@gnu.org; Sun, 02 Apr 2006 21:26:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQDqA-0007td-Ly for emacs-devel@gnu.org; Sun, 02 Apr 2006 21:26:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQDqA-0007ta-HI for emacs-devel@gnu.org; Sun, 02 Apr 2006 21:26:46 -0400 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FQDsx-0003Oz-J9; Sun, 02 Apr 2006 21:29:40 -0400 Original-Received: from nfs.m17n.org (nfs.m17n.org [192.47.44.7]) by tsukuba.m17n.org (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k331QQMT015724; Mon, 3 Apr 2006 10:26:26 +0900 Original-Received: from etlken (etlken.m17n.org [192.47.44.125]) by nfs.m17n.org (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k331QQ14026742; Mon, 3 Apr 2006 10:26:26 +0900 Original-Received: from handa by etlken with local (Exim 3.36 #1 (Debian)) id 1FQDpp-0001SN-00; Mon, 03 Apr 2006 10:26:25 +0900 Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Thu, 30 Mar 2006 22:10:51 -0500) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:52342 Archived-At: In article , Richard Stallman writes: > I found that image.c (and image.el) doesn't pay attention to > filename encoding. For instance, when I visit a file > "=C3=80.png", Emacs crashes in png_load() as this: > Program received signal SIGSEGV, Segmentation fault. > 0x40346777 in fclose () from /lib/libc.so.6 > (gdb) bt 10 > As an image file name is passed from function to function, I > don't understand where we should put the interface between > decoded filename and encoded filename. > I looked at image.c, and I think the right place for encoding is the > end of x_find_image_file. That is, it should return an encoded name. > That appears correct for all calls to that function, though I could > not perfectly understand all of the callers. > Please try that. (Please update the comments on x_find_image_file > to say its value has been encoded.) Ok, I've just committed the attache chagne. --- Kenichi Handa handa@m17n.org 2006-04-03 Kenichi Handa * image.c: Include "charset.h" and "coding.h". (x_find_image_file): Return an encoded file name. Index: image.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/src/image.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- image.c 16 Mar 2006 08:05:34 -0000 1.50 +++ image.c 3 Apr 2006 01:23:03 -0000 1.51 @@ -39,6 +39,8 @@ #include "blockinput.h" #include "systime.h" #include +#include "charset.h" +#include "coding.h" =20 =20 #ifdef HAVE_X_WINDOWS @@ -2246,8 +2248,8 @@ =20 =20 /* Find image file FILE. Look in data-directory, then - x-bitmap-file-path. Value is the full name of the file found, or - nil if not found. */ + x-bitmap-file-path. Value is the encoded full name of the file + found, or nil if not found. */ =20 Lisp_Object x_find_image_file (file) @@ -2267,7 +2269,10 @@ if (fd =3D=3D -1) file_found =3D Qnil; else - close (fd); + { + file_found =3D ENCODE_FILE (file_found); + close (fd); + } =20 UNGCPRO; return file_found;