aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/net/tramp.el34
2 files changed, 27 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6a2f3ad06e7..b7168fffd3a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12009-07-08 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
4 remote user is root, on the local host.
5 (tramp-local-host-p): Either the local user or the remote user
6 must be root. (Bug#3771)
7
12009-07-08 Nick Roberts <nickrob@snap.net.nz> 82009-07-08 Nick Roberts <nickrob@snap.net.nz>
2 9
3 * progmodes/gdb-mi.el (gdb): Remove description of 10 * progmodes/gdb-mi.el (gdb): Remove description of
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index d95430d55d2..444f55ac5d2 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2709,14 +2709,17 @@ and gid of the corresponding user is taken. Both parameters must be integers."
2709 ;; the majority of cases. 2709 ;; the majority of cases.
2710 (if (file-remote-p filename) 2710 (if (file-remote-p filename)
2711 (with-parsed-tramp-file-name filename nil 2711 (with-parsed-tramp-file-name filename nil
2712 (let ((uid (or (and (integerp uid) uid) 2712 (if (and (zerop (user-uid)) (tramp-local-host-p v))
2713 (tramp-get-remote-uid v 'integer))) 2713 ;; If we are root on the local host, we can do it directly.
2714 (gid (or (and (integerp gid) gid) 2714 (tramp-set-file-uid-gid localname uid gid)
2715 (tramp-get-remote-gid v 'integer)))) 2715 (let ((uid (or (and (integerp uid) uid)
2716 (tramp-send-command 2716 (tramp-get-remote-uid v 'integer)))
2717 v (format 2717 (gid (or (and (integerp gid) gid)
2718 "chown %d:%d %s" uid gid 2718 (tramp-get-remote-gid v 'integer))))
2719 (tramp-shell-quote-argument localname))))) 2719 (tramp-send-command
2720 v (format
2721 "chown %d:%d %s" uid gid
2722 (tramp-shell-quote-argument localname))))))
2720 2723
2721 ;; We handle also the local part, because there doesn't exist 2724 ;; We handle also the local part, because there doesn't exist
2722 ;; `set-file-uid-gid'. On W32 "chown" might not work. 2725 ;; `set-file-uid-gid'. On W32 "chown" might not work.
@@ -4395,7 +4398,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
4395 (tramp-get-remote-gid v 'integer)))) 4398 (tramp-get-remote-gid v 'integer))))
4396 4399
4397 (if (and (tramp-local-host-p v) 4400 (if (and (tramp-local-host-p v)
4398 ;; `file-writable-p' calls 'file-expand-file-name'. We 4401 ;; `file-writable-p' calls `file-expand-file-name'. We
4399 ;; cannot use `tramp-run-real-handler' therefore. 4402 ;; cannot use `tramp-run-real-handler' therefore.
4400 (let (file-name-handler-alist) 4403 (let (file-name-handler-alist)
4401 (and 4404 (and
@@ -4403,10 +4406,10 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
4403 (or (file-directory-p localname) 4406 (or (file-directory-p localname)
4404 (file-writable-p localname))))) 4407 (file-writable-p localname)))))
4405 ;; Short track: if we are on the local host, we can run directly. 4408 ;; Short track: if we are on the local host, we can run directly.
4406 (prog1 4409 (progn
4407 (tramp-run-real-handler 4410 (tramp-run-real-handler
4408 'write-region 4411 'write-region
4409 (list start end localname append 'no-message lockname confirm)) 4412 (list start end localname append 'no-message lockname confirm))
4410 (tramp-flush-file-property v localname)) 4413 (tramp-flush-file-property v localname))
4411 4414
4412 (let ((rem-dec (tramp-get-remote-coding v "remote-decoding")) 4415 (let ((rem-dec (tramp-get-remote-coding v "remote-decoding"))
@@ -7190,7 +7193,10 @@ necessary only. This function will be used in file name completion."
7190 (tramp-file-name-method vec) 7193 (tramp-file-name-method vec)
7191 (tramp-file-name-user vec) 7194 (tramp-file-name-user vec)
7192 host 7195 host
7193 (tramp-compat-temporary-file-directory)))))) 7196 (tramp-compat-temporary-file-directory)))
7197 ;; On some systems, chown runs only for root.
7198 (or (zerop (user-uid))
7199 (zerop (tramp-get-remote-uid vec 'integer))))))
7194 7200
7195;; Variables local to connection. 7201;; Variables local to connection.
7196 7202