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: file-attribute on certain Chinese filenames failed Date: Tue, 13 Feb 2007 14:36:42 +0900 Message-ID: References: <45c9d948.5c6acfa4.4c9b.ffffeb01@mx.google.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1171345036 4962 80.91.229.12 (13 Feb 2007 05:37:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Feb 2007 05:37:16 +0000 (UTC) Cc: emacs-devel@gnu.org To: MJ Chan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 13 06:37:09 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HGqLk-0006Ex-85 for ged-emacs-devel@m.gmane.org; Tue, 13 Feb 2007 06:37:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HGqLj-0005GG-Io for ged-emacs-devel@m.gmane.org; Tue, 13 Feb 2007 00:37:07 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HGqLW-0005G1-U2 for emacs-devel@gnu.org; Tue, 13 Feb 2007 00:36:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HGqLU-0005Fn-RQ for emacs-devel@gnu.org; Tue, 13 Feb 2007 00:36:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HGqLU-0005Fk-Lz for emacs-devel@gnu.org; Tue, 13 Feb 2007 00:36:52 -0500 Original-Received: from mx1.aist.go.jp ([150.29.246.133]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HGqLT-0006mE-U4 for emacs-devel@gnu.org; Tue, 13 Feb 2007 00:36:52 -0500 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id l1D5ahpS010635; Tue, 13 Feb 2007 14:36:43 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp1.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id l1D5agjo014911; Tue, 13 Feb 2007 14:36:42 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp1.aist.go.jp with ESMTP id l1D5agoC029142; Tue, 13 Feb 2007 14:36:42 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.63) (envelope-from ) id 1HGqLK-0004Nf-0P; Tue, 13 Feb 2007 14:36:42 +0900 In-reply-to: <45c9d948.5c6acfa4.4c9b.ffffeb01@mx.google.com> (message from MJ Chan on Wed, 07 Feb 2007 05:51:04 -0800 (PST)) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.93 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) X-detected-kernel: Solaris 8 (1) 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:66328 Archived-At: In article <45c9d948.5c6acfa4.4c9b.ffffeb01@mx.google.com>, MJ Chan writes: > I had trouble in accessing some files that contains certain Chinese > (big5) characters (in fact, I found only one character so far that is > causing the problem; all others are good). After checking around, I > found that the problem would take place in "lstat" call in the C > source. One example is in "file-attributes" (src/dired.c). > For example, if I created a file named "=26345" (see below for the > "describe-char" on that particular Chinese character) and then > evaluated this, it returned nil. > (file-attributes "=26345") > nil I can't reproduce that problem on GNU/Linux. For instance, it seems that this code work correctly. (let ((file-name-coding-system 'big5) (filename (string #x26345))) (with-temp-file filename (insert "abc\n")) (file-attributes filename)) => (nil 1 8308 8308 (17873 19356) (17873 19356) (17873 19356) 4 "-rw-rw-r--" nil 11175288 21) But, when I run the same code on Windows, write-region causes this error: (file-error "Opening output file" "invalid argument" "c:/cygwin/home/handa/\x26345") I suspect that this is because the big5 sequence of the character #x26345 is "\267|", and Windows-XP (at least my Japanese version) doesn't allow creating a file containing "|". For instance, I can't create a file "a|" either. > As mentioned above, the culprit seems to be in calling lstat with > encoded version of the file name as shown below (taken from dired.c) > GCPRO1 (filename); > encoded = ENCODE_FILE (filename); > UNGCPRO; > if (lstat (SDATA (encoded), &s) < 0) > return Qnil; > If I changed the call to use un-encoded filename (i.e. lstat > (filename,...)), then it is good. But I am not sure if this is the > right thing to do. I believe it's not the right fix, and first of all, I have no idea why such a change fixes your case. Anyway, it seems that this is an Windows specific problem. --- Kenichi Handa handa@m17n.org