From e3a0f3daf12e208e88d712b09ef82096849b9431 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 1 Jun 2015 21:11:24 +0200 Subject: [PATCH] Sync with Tramp repository * lisp/net/tramp.el (tramp-message): Dump connection buffer error messages. (tramp-handle-make-auto-save-file-name): When calling `make-auto-save-file-name' internally, make sure it uses Unix-like behavior, not Windows-like behavior. * lisp/net/tramp-sh.el (tramp-set-file-uid-gid): Add a timeout for the local case, because "chown" might fail on w32. * lisp/net/trampver.el (tramp-repository-get-version): Don't run for XEmacs. --- lisp/net/tramp-sh.el | 14 ++++++++------ lisp/net/tramp.el | 13 +++++++++++-- lisp/net/trampver.el | 20 +++++++++++--------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5864acd8559..fda5945a18a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1459,12 +1459,14 @@ be non-negative integers." (tramp-shell-quote-argument localname)))))) ;; We handle also the local part, because there doesn't exist - ;; `set-file-uid-gid'. On W32 "chown" might not work. - (let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer))) - (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer)))) - (tramp-call-process - nil "chown" nil nil nil - (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) + ;; `set-file-uid-gid'. On W32 "chown" might not work. We add a + ;; timeout for this. + (with-timeout (5 nil) + (let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer))) + (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer)))) + (tramp-call-process + nil "chown" nil nil nil + (format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))) (defun tramp-remote-selinux-p (vec) "Check, whether SELINUX is enabled on the remote host." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 40bba145454..fc23a0bfeb5 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1530,6 +1530,12 @@ applicable)." (let ((tramp-verbose 0)) (setq vec-or-proc (tramp-get-connection-property vec-or-proc "vector" nil)))) + ;; Append connection buffer for error messages. + (when (= level 1) + (let ((tramp-verbose 0)) + (with-current-buffer (tramp-get-connection-buffer vec-or-proc) + (setq fmt-string (concat fmt-string "\n%s") + arguments (append arguments (list (buffer-string))))))) ;; Do it. (when (vectorp vec-or-proc) (apply 'tramp-debug-message @@ -4020,8 +4026,11 @@ this file, if that variable is non-nil." (file-exists-p tramp-auto-save-directory)) (make-directory tramp-auto-save-directory t)) - (let ((auto-save-file-name-transforms - (if (null tramp-auto-save-directory) auto-save-file-name-transforms)) + (let ((system-type 'not-windows) + (auto-save-file-name-transforms + (if (and (null tramp-auto-save-directory) + (boundp 'auto-save-file-name-transforms)) + (symbol-value 'auto-save-file-name-transforms))) (buffer-file-name (if (null tramp-auto-save-directory) buffer-file-name diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index c5e57053513..eb22b6080be 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el @@ -40,15 +40,17 @@ (defun tramp-repository-get-version () "Try to return as a string the repository revision of the Tramp sources." - (let ((dir (funcall 'locate-dominating-file (locate-library "tramp") ".git"))) - (when dir - (with-temp-buffer - (let ((default-directory (file-name-as-directory dir))) - (and (zerop - (ignore-errors - (call-process "git" nil '(t nil) nil "rev-parse" "HEAD"))) - (not (zerop (buffer-size))) - (replace-regexp-in-string "\n" "" (buffer-string)))))))) + (unless (featurep 'xemacs) + (let ((dir + (funcall 'locate-dominating-file (locate-library "tramp") ".git"))) + (when dir + (with-temp-buffer + (let ((default-directory (file-name-as-directory dir))) + (and (zerop + (ignore-errors + (call-process "git" nil '(t nil) nil "rev-parse" "HEAD"))) + (not (zerop (buffer-size))) + (replace-regexp-in-string "\n" "" (buffer-string))))))))) ;; Check for (X)Emacs version. (let ((x (if (or (>= emacs-major-version 22) -- 2.11.4.GIT