From cc90c25a50e536669ac327f7e05ec9194d1650d0 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 30 Aug 2015 09:59:02 +0200 Subject: [PATCH] * lisp/net/tramp-sh.el (tramp-convert-file-attributes): Revert patch from 2015-08-24. Tramp shall be have like for local files. * test/automated/tramp-tests.el (tramp-test18-file-attributes): Adapt test. --- lisp/net/tramp-sh.el | 18 ++++++++---------- test/automated/tramp-tests.el | 7 ++++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index c5ffb26b551..8cae8dc92b9 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5114,18 +5114,10 @@ raises an error." Convert file mode bits to string and set virtual device number. Return ATTR." (when attr - ;; Convert symlink from `tramp-do-file-attributes-with-stat'. - (when (consp (car attr)) - (if (and (stringp (caar attr)) - (string-match ".+ -> .\\(.+\\)." (caar attr))) - (setcar attr (match-string 1 (caar attr))) - (setcar attr nil))) - ;; Remove color escape sequences and double slashes from symlink. + ;; Remove color escape sequences from symlink. (when (stringp (car attr)) (while (string-match tramp-color-escape-sequence-regexp (car attr)) - (setcar attr (replace-match "" nil nil (car attr)))) - (while (string-match "//" (car attr)) - (setcar attr (replace-match "/" nil nil (car attr))))) + (setcar attr (replace-match "" nil nil (car attr))))) ;; Convert uid and gid. Use -1 as indication of unusable value. (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0)) (setcar (nthcdr 2 attr) -1)) @@ -5166,6 +5158,12 @@ Return ATTR." ;; Convert directory indication bit. (when (string-match "^d" (nth 8 attr)) (setcar attr t)) + ;; Convert symlink from `tramp-do-file-attributes-with-stat'. + (when (consp (car attr)) + (if (and (stringp (caar attr)) + (string-match ".+ -> .\\(.+\\)." (caar attr))) + (setcar attr (match-string 1 (caar attr))) + (setcar attr nil))) ;; Set file's gid change bit. (setcar (nthcdr 9 attr) (if (numberp (nth 3 attr)) diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 498a0cfa7da..c5cab7d5991 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1118,9 +1118,10 @@ This tests also `file-readable-p' and `file-regular-p'." t))) (when (file-symlink-p tmp-name2) (setq attr (file-attributes tmp-name2)) - (should (string-equal - (car attr) - (file-remote-p (file-truename tmp-name3) 'localname))) + (should + (string-equal + (car attr) + (tramp-file-name-localname (tramp-dissect-file-name tmp-name3)))) (delete-file tmp-name2)) (delete-file tmp-name1) -- 2.39.2