From: Eli Zaretskii <eliz@gnu.org>
To: Andreas Politz <politza@hochschule-trier.de>
Cc: 15426@debbugs.gnu.org
Subject: bug#15426: 24.3.50; Multibyte filenames and directory-files in unibyte buffer
Date: Sat, 21 Sep 2013 14:59:49 +0300 [thread overview]
Message-ID: <83siwyjsga.fsf@gnu.org> (raw)
In-Reply-To: <87a9j6h5zb.fsf@hochschule-trier.de>
> From: Andreas Politz <politza@hochschule-trier.de>
> 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.
next prev parent reply other threads:[~2013-09-21 11:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 16:47 bug#15426: 24.3.50; Multibyte filenames and directory-files in unibyte buffer Andreas Politz
2013-09-20 17:46 ` Eli Zaretskii
2013-09-20 18:51 ` Andreas Politz
2013-09-20 19:08 ` Eli Zaretskii
2013-09-20 19:15 ` Stefan Monnier
2013-09-20 19:17 ` Eli Zaretskii
2013-09-20 20:56 ` Andreas Politz
2013-09-21 6:48 ` Eli Zaretskii
2013-09-21 9:35 ` Andreas Politz
2013-09-21 9:38 ` Andreas Politz
2013-09-21 11:59 ` Eli Zaretskii [this message]
2013-09-21 17:12 ` Andreas Politz
2013-09-21 18:53 ` Eli Zaretskii
2013-09-21 16:06 ` Stefan Monnier
2013-09-21 16:26 ` Eli Zaretskii
2013-09-22 1:29 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83siwyjsga.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=15426@debbugs.gnu.org \
--cc=politza@hochschule-trier.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.