From e3d115ae86f7baa1483c5f14f1ac7d60d8aefa81 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 11 May 2018 18:38:46 +0200 Subject: [PATCH] Tramp updates * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes): Parse multibyte symlinks correctly. * test/lisp/net/tramp/tramp-tests.el (tramp--test-utf8): Improve backward compatibility. --- lisp/net/tramp-gvfs.el | 12 ++++++++++++ test/lisp/net/tramp-tests.el | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 199ac4fad24..a9a1a6085a4 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1158,6 +1158,18 @@ If FILE-SYSTEM is non-nil, return file system attributes." (setq dirp (if (equal "directory" (cdr (assoc "type" attributes))) t)) (setq res-symlink-target (cdr (assoc "standard::symlink-target" attributes))) + (when (stringp res-symlink-target) + (setq res-symlink-target + ;; Parse unibyte codes "\xNN". We assume they are + ;; non-ASCII codepoints in the range #x80 through #xff. + ;; Convert them to multibyte. + (decode-coding-string + (replace-regexp-in-string + "\\\\x\\([[:xdigit:]]\\{2\\}\\)" + (lambda (x) + (unibyte-string (string-to-number (match-string 1 x) 16))) + res-symlink-target) + 'utf-8))) ;; ... number links (setq res-numlinks (string-to-number diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 15187efdd33..2c0b3199be6 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4716,7 +4716,7 @@ Use the `ls' command." (and (stringp (setq x (eval (get-language-info (car x) 'sample-text)))) (not (unencodable-char-position - 0 nil file-name-coding-system nil x)) + 0 (length x) file-name-coding-system nil x)) ;; ?\n and ?/ shouldn't be part of any file name. ?\t, ;; ?. and ?? do not work for "smb" method. (replace-regexp-in-string "[\t\n/.?]" "" x))) -- 2.39.5