diff options
author | Eli Zaretskii <eliz@gnu.org> | 2018-05-18 16:34:19 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-06-02 12:37:19 +0300 |
commit | 6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c (patch) | |
tree | 406a66a7ed14dca5884fb5001473c6a9a624e71e /lisp/startup.el | |
parent | 35c1ab1419174f72010c745d963a55b6c183443c (diff) | |
download | emacs-6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c.tar.gz emacs-6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c.tar.bz2 emacs-6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c.zip |
Fix decoding of directories when "~" includes non-ASCII chars
* src/fileio.c (Fexpand_file_name): Don't build multibyte strings
from unibyte non-ASCII strings when NAME and DEFAULT_DIRECTORY
have different multibyteness, as this adds bytes to the byte
sequence, and in some situations, e.g., when the home directory
includes non-ASCII characters, can fail file APIs. (Bug#30755)
* lisp/startup.el (normal-top-level): Make sure default-directory
is set to a multibyte string when decoded on MS-Windows.
(cherry picked from commit 3aab8626ba5080bb04d0fdae52d99c850a842a52)
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 9d16b59defd..33f8ca63f8d 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -552,9 +552,17 @@ It is the default value of the variable `top-level'." (if default-directory (setq default-directory (if (eq system-type 'windows-nt) - ;; Convert backslashes to forward slashes. - (expand-file-name - (decode-coding-string default-directory coding t)) + ;; We pass the decoded default-directory as + ;; the 2nd arg to expand-file-name to make + ;; sure it sees a multibyte string as the + ;; default directory; this avoids the side + ;; effect of returning a unibyte string from + ;; expand-file-name because it still sees + ;; the undecoded value of default-directory. + (let ((defdir (decode-coding-string default-directory + coding t))) + ;; Convert backslashes to forward slashes. + (expand-file-name defdir defdir)) (decode-coding-string default-directory coding t)))))) ;; Decode all the important variables and directory lists, now |