diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/net/tramp-sh.el | 11 | ||||
-rw-r--r-- | lisp/net/tramp-smb.el | 87 | ||||
-rw-r--r-- | lisp/net/tramp.el | 8 |
3 files changed, 53 insertions, 53 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6251248e282..6494b0957bf 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -562,11 +562,7 @@ This variable is only used when Tramp needs to start up another shell for tilde expansion. The extra arguments should typically prevent the shell from reading its init file." :group 'tramp - ;; This might be the wrong way to test whether the widget type - ;; `alist' is available. Who knows the right way to test it? - :type (if (get 'alist 'widget-type) - '(alist :key-type string :value-type string) - '(repeat (cons string string))) + :type '(alist :key-type regexp :value-type string) :require 'tramp) (defconst tramp-actions-before-shell @@ -1088,8 +1084,9 @@ component is used as the target of the symlink." (delete-file linkname))) ;; If TARGET is a Tramp name, use just the localname component. - (when (tramp-file-name-equal-p - v (tramp-dissect-file-name (expand-file-name target))) + (when (and (tramp-tramp-file-p target) + (tramp-file-name-equal-p + v (tramp-dissect-file-name (expand-file-name target)))) (setq target (tramp-file-name-localname (tramp-dissect-file-name (expand-file-name target))))) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index f734b80d535..920e10331ba 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -430,7 +430,8 @@ pass to the OPERATION." (delete-directory tmpdir 'recursive)))) ;; We can copy recursively. - ((and (or t1 t2) (tramp-smb-get-cifs-capabilities v)) + ;; Does not work reliably. + (nil ;(and (or t1 t2) (tramp-smb-get-cifs-capabilities v)) (when (and (file-directory-p newname) (not (string-equal (file-name-nondirectory dirname) (file-name-nondirectory newname)))) @@ -888,6 +889,16 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (string-to-number (match-string 2)) ;; month (string-to-number (match-string 1)))))) ;; year (forward-line)) + + ;; Resolve symlink. + (when (and (stringp id) + (tramp-smb-send-command + vec + (format "readlink \"%s\"" (tramp-smb-get-localname vec)))) + (goto-char (point-min)) + (and (looking-at ".+ -> \\(.+\\)") + (setq id (match-string 1)))) + ;; Return the result. (list id link uid gid atime mtime ctime size mode nil inode (tramp-get-device vec))))))) @@ -1105,47 +1116,43 @@ component is used as the target of the symlink." (tramp-run-real-handler 'make-symbolic-link (list target linkname ok-if-already-exists)) - (unless (tramp-equal-remote target linkname) - (with-parsed-tramp-file-name - (if (tramp-tramp-file-p target) target linkname) nil + (with-parsed-tramp-file-name linkname nil + ;; Do the 'confirm if exists' thing. + (when (file-exists-p linkname) + ;; What to do? + (if (or (null ok-if-already-exists) ; not allowed to exist + (and (numberp ok-if-already-exists) + (not (yes-or-no-p + (format + "File %s already exists; make it a link anyway? " + localname))))) + (tramp-error v 'file-already-exists localname) + (delete-file linkname))) + + (unless (tramp-smb-get-cifs-capabilities v) + (tramp-error v 'file-error "make-symbolic-link not supported")) + + ;; If TARGET is a Tramp name, use just the localname component. + (when (and (tramp-tramp-file-p target) + (tramp-file-name-equal-p + v (tramp-dissect-file-name (expand-file-name target)))) + (setq target + (tramp-file-name-localname + (tramp-dissect-file-name (expand-file-name target))))) + + ;; We must also flush the cache of the directory, because + ;; `file-attributes' reads the values from there. + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-file-property v localname) + + (unless + (tramp-smb-send-command + v + (format "symlink \"%s\" \"%s\"" target (tramp-smb-get-localname v))) (tramp-error v 'file-error - "make-symbolic-link: %s" - "only implemented for same method, same user, same host"))) - (with-parsed-tramp-file-name target v1 - (with-parsed-tramp-file-name linkname v2 - (when (file-directory-p target) - (tramp-error - v2 'file-error - "make-symbolic-link: %s must not be a directory" target)) - ;; Do the 'confirm if exists' thing. - (when (file-exists-p linkname) - ;; What to do? - (if (or (null ok-if-already-exists) ; not allowed to exist - (and (numberp ok-if-already-exists) - (not (yes-or-no-p - (format - "File %s already exists; make it a link anyway? " - v2-localname))))) - (tramp-error v2 'file-already-exists v2-localname) - (delete-file linkname))) - (unless (tramp-smb-get-cifs-capabilities v1) - (tramp-error v2 'file-error "make-symbolic-link not supported")) - ;; We must also flush the cache of the directory, because - ;; `file-attributes' reads the values from there. - (tramp-flush-file-property v2 (file-name-directory v2-localname)) - (tramp-flush-file-property v2 v2-localname) - (unless - (tramp-smb-send-command - v1 - (format - "symlink \"%s\" \"%s\"" - (tramp-smb-get-localname v1) - (tramp-smb-get-localname v2))) - (tramp-error - v2 'file-error - "error with make-symbolic-link, see buffer `%s' for details" - (buffer-name))))))) + "error with make-symbolic-link, see buffer `%s' for details" + (buffer-name)))))) (defun tramp-smb-handle-process-file (program &optional infile destination display &rest args) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index bb68b9e9645..1a5cda7e20d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3065,12 +3065,8 @@ User is always nil." (defun tramp-handle-file-symlink-p (filename) "Like `file-symlink-p' for Tramp files." - (with-parsed-tramp-file-name filename nil - (let ((x (tramp-compat-file-attribute-type (file-attributes filename)))) - (when (stringp x) - (if (file-name-absolute-p x) - (tramp-make-tramp-file-name method user domain host port x) - x))))) + (let ((x (tramp-compat-file-attribute-type (file-attributes filename)))) + (and (stringp x) x))) (defun tramp-handle-find-backup-file-name (filename) "Like `find-backup-file-name' for Tramp files." |