From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#15426: 24.3.50; Multibyte filenames and directory-files in unibyte buffer Date: Sat, 21 Sep 2013 14:59:49 +0300 Message-ID: <83siwyjsga.fsf@gnu.org> References: <87ob7nh22t.fsf@hochschule-trier.de> <831u4jl738.fsf@gnu.org> <83wqmbjoat.fsf@gnu.org> <87eh8jgqkp.fsf@hochschule-trier.de> <83vc1uk6ul.fsf@gnu.org> <87a9j6h5zb.fsf@hochschule-trier.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1379764819 5380 80.91.229.3 (21 Sep 2013 12:00:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Sep 2013 12:00:19 +0000 (UTC) Cc: 15426@debbugs.gnu.org To: Andreas Politz Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 21 14:00:21 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VNLrI-0007gB-MT for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Sep 2013 14:00:20 +0200 Original-Received: from localhost ([::1]:59892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNLrI-0002Fn-AZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Sep 2013 08:00:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNLr9-00028E-KT for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 08:00:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VNLr3-0000AQ-Qk for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 08:00:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNLr3-00009t-OW for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 08:00:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VNLr2-00078W-70 for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2013 08:00:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Sep 2013 12:00:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15426 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15426-submit@debbugs.gnu.org id=B15426.137976479427386 (code B ref 15426); Sat, 21 Sep 2013 12:00:04 +0000 Original-Received: (at 15426) by debbugs.gnu.org; 21 Sep 2013 11:59:54 +0000 Original-Received: from localhost ([127.0.0.1]:53060 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNLqr-00077d-BT for submit@debbugs.gnu.org; Sat, 21 Sep 2013 07:59:53 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:40297) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNLqo-00077L-HW for 15426@debbugs.gnu.org; Sat, 21 Sep 2013 07:59:51 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MTH0080058UPH00@a-mtaout22.012.net.il> for 15426@debbugs.gnu.org; Sat, 21 Sep 2013 14:59:43 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MTH0080U5BJM530@a-mtaout22.012.net.il>; Sat, 21 Sep 2013 14:59:43 +0300 (IDT) In-reply-to: <87a9j6h5zb.fsf@hochschule-trier.de> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78648 Archived-At: > From: Andreas Politz > Cc: monnier@iro.umontreal.ca, 15426@debbugs.gnu.org > Date: Sat, 21 Sep 2013 11:35:52 +0200 > > If I save this in mb-dir/foo.el, where mb-dir is a directory containing > multi-bytes, the results (d1 and d2) of the same calls to > `directory-list' are different in the uni-byte and multi-byte buffer. For the record, a much simpler test case is this: M-: (multibyte-string-p (car (directory-files default-directory t))) RET invoked from the unibyte buffer that visits your mb-dir/foo.el. Note that default-directory is a multibyte string, as shown by calling multibyte-string-p on it. So the problem happens inside the directory-files call. (You should never trust what the echo area shows when potentially unibyte strings are involved, always use multibyte-string-p to tell if a string is multibyte or unibyte.) The bug that caused this should be fixed now in revision 114421 on the trunk. > It seems that the 2 byte sequences of the UTF-8 characters are > replaced by some 4 bytes. That's how Emacs represents raw bytes internally in a multibyte buffer, so that "expansion" is a clear sign of a unibyte string. > Anyway, the resulting filename d2 names a non-existent file. Because encoding a unibyte string with raw bytes in their internal representation will never get you the right file name. > > "The minibuffer displays" is the key point here:[...] > > No, the key is that the file's existence depends on the buffer's > multi-byte status, in which the code is evaluated. The truth is neither (although what the minibuffer displays in these cases can easily fool you, so don't trust it). The truth was that the code in a subroutine of directory-files, when it is called with its second argument non-nil, incorrectly marked the full file name it produced as a unibyte string. The rest was the consequence of that. Thanks.