aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2018-05-18 16:34:19 +0300
committerEli Zaretskii2018-06-02 12:37:19 +0300
commit6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c (patch)
tree406a66a7ed14dca5884fb5001473c6a9a624e71e /lisp
parent35c1ab1419174f72010c745d963a55b6c183443c (diff)
downloademacs-6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c.tar.gz
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')
-rw-r--r--lisp/startup.el14
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'."
552 (if default-directory 552 (if default-directory
553 (setq default-directory 553 (setq default-directory
554 (if (eq system-type 'windows-nt) 554 (if (eq system-type 'windows-nt)
555 ;; Convert backslashes to forward slashes. 555 ;; We pass the decoded default-directory as
556 (expand-file-name 556 ;; the 2nd arg to expand-file-name to make
557 (decode-coding-string default-directory coding t)) 557 ;; sure it sees a multibyte string as the
558 ;; default directory; this avoids the side
559 ;; effect of returning a unibyte string from
560 ;; expand-file-name because it still sees
561 ;; the undecoded value of default-directory.
562 (let ((defdir (decode-coding-string default-directory
563 coding t)))
564 ;; Convert backslashes to forward slashes.
565 (expand-file-name defdir defdir))
558 (decode-coding-string default-directory coding t)))))) 566 (decode-coding-string default-directory coding t))))))
559 567
560 ;; Decode all the important variables and directory lists, now 568 ;; Decode all the important variables and directory lists, now