]> git.eshelyaron.com Git - emacs.git/commitdiff
Tramp updates
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 11 May 2018 16:38:46 +0000 (18:38 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 11 May 2018 16:38:46 +0000 (18:38 +0200)
* 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
test/lisp/net/tramp-tests.el

index 199ac4fad24bd3ae059e0a8275afe9ebcf71e80c..a9a1a6085a4c62c1bcc0e147a661e8f9d5ff71e2 100644 (file)
@@ -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
index 15187efdd333e1e0d3d59318faa486f318cfbe42..2c0b3199be661e42af0646abd0e89170bd0bb33e 100644 (file)
@@ -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)))