aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorJuanma Barranquero2014-03-26 16:57:13 +0100
committerJuanma Barranquero2014-03-26 16:57:13 +0100
commit16adf2e6eb1ddf0b32ebea2d5ce8fa1e4c226614 (patch)
tree29b782fd6e7c44a834dd09442a551520e30bcbd6 /lisp/net
parent5af73b0fe8975eeb47fb270819b4143c18d71caa (diff)
parent196716cf35f81bea108c3b75362e92c86ed1c016 (diff)
downloademacs-16adf2e6eb1ddf0b32ebea2d5ce8fa1e4c226614.tar.gz
emacs-16adf2e6eb1ddf0b32ebea2d5ce8fa1e4c226614.zip
Merge from emacs-24; up to 2014-03-23T23:14:52Z!yamaoka@jpl.org
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-sh.el114
-rw-r--r--lisp/net/tramp.el82
2 files changed, 110 insertions, 86 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 106c14805d5..22ea7714743 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2110,6 +2110,12 @@ the uid and gid from FILENAME."
2110 ;; We can do it directly. 2110 ;; We can do it directly.
2111 ((let (file-name-handler-alist) 2111 ((let (file-name-handler-alist)
2112 (and (file-readable-p localname1) 2112 (and (file-readable-p localname1)
2113 ;; No sticky bit when renaming.
2114 (or (eq op 'copy)
2115 (zerop
2116 (logand
2117 (file-modes (file-name-directory localname1))
2118 (tramp-compat-octal-to-decimal "1000"))))
2113 (file-writable-p (file-name-directory localname2)) 2119 (file-writable-p (file-name-directory localname2))
2114 (or (file-directory-p localname2) 2120 (or (file-directory-p localname2)
2115 (file-writable-p localname2)))) 2121 (file-writable-p localname2))))
@@ -3311,55 +3317,57 @@ the result will be a local, non-Tramp, filename."
3311 (with-tramp-progress-reporter 3317 (with-tramp-progress-reporter
3312 v 3 (format "Checking `vc-registered' for %s" file) 3318 v 3 (format "Checking `vc-registered' for %s" file)
3313 3319
3314 (unless remote-file-name-inhibit-cache 3320 ;; There could be new files, created by the vc backend. We
3315 ;; There could be new files, created by the vc backend. We 3321 ;; cannot reuse the old cache entries, therefore. In
3316 ;; cannot reuse the old cache entries, therefore. 3322 ;; `tramp-get-file-property', `remote-file-name-inhibit-cache'
3317 (let (tramp-vc-registered-file-names 3323 ;; could also be a timestamp as `current-time' returns. This
3318 (remote-file-name-inhibit-cache (current-time)) 3324 ;; means invalidate all cache entries with an older timestamp.
3319 (file-name-handler-alist 3325 (let (tramp-vc-registered-file-names
3320 `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) 3326 (remote-file-name-inhibit-cache (current-time))
3321 3327 (file-name-handler-alist
3322 ;; Here we collect only file names, which need an operation. 3328 `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
3323 (ignore-errors (tramp-run-real-handler 'vc-registered (list file))) 3329
3324 (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) 3330 ;; Here we collect only file names, which need an operation.
3325 3331 (ignore-errors (tramp-run-real-handler 'vc-registered (list file)))
3326 ;; Send just one command, in order to fill the cache. 3332 (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
3327 (when tramp-vc-registered-file-names 3333
3328 (tramp-maybe-send-script 3334 ;; Send just one command, in order to fill the cache.
3329 v 3335 (when tramp-vc-registered-file-names
3330 (format tramp-vc-registered-read-file-names 3336 (tramp-maybe-send-script
3331 (tramp-get-file-exists-command v) 3337 v
3332 (format "%s -r" (tramp-get-test-command v))) 3338 (format tramp-vc-registered-read-file-names
3333 "tramp_vc_registered_read_file_names") 3339 (tramp-get-file-exists-command v)
3334 3340 (format "%s -r" (tramp-get-test-command v)))
3335 (dolist 3341 "tramp_vc_registered_read_file_names")
3336 (elt 3342
3337 (ignore-errors 3343 (dolist
3338 ;; We cannot use `tramp-send-command-and-read', 3344 (elt
3339 ;; because this does not cooperate well with 3345 (ignore-errors
3340 ;; heredoc documents. 3346 ;; We cannot use `tramp-send-command-and-read',
3341 (tramp-send-command 3347 ;; because this does not cooperate well with
3342 v 3348 ;; heredoc documents.
3343 (format 3349 (tramp-send-command
3344 "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n" 3350 v
3345 tramp-end-of-heredoc 3351 (format
3346 (mapconcat 'tramp-shell-quote-argument 3352 "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n"
3347 tramp-vc-registered-file-names 3353 tramp-end-of-heredoc
3348 "\n") 3354 (mapconcat 'tramp-shell-quote-argument
3349 tramp-end-of-heredoc)) 3355 tramp-vc-registered-file-names
3350 (with-current-buffer (tramp-get-connection-buffer v) 3356 "\n")
3351 ;; Read the expression. 3357 tramp-end-of-heredoc))
3352 (goto-char (point-min)) 3358 (with-current-buffer (tramp-get-connection-buffer v)
3353 (read (current-buffer))))) 3359 ;; Read the expression.
3354 3360 (goto-char (point-min))
3355 (tramp-set-file-property 3361 (read (current-buffer)))))
3356 v (car elt) (cadr elt) (cadr (cdr elt))))))) 3362
3363 (tramp-set-file-property
3364 v (car elt) (cadr elt) (cadr (cdr elt))))))
3357 3365
3358 ;; Second run. Now all `file-exists-p' or `file-readable-p' 3366 ;; Second run. Now all `file-exists-p' or `file-readable-p'
3359 ;; calls shall be answered from the file cache. We unset 3367 ;; calls shall be answered from the file cache. We unset
3360 ;; `process-file-side-effects' in order to keep the cache when 3368 ;; `process-file-side-effects' and `remote-file-name-inhibit-cache'
3361 ;; `process-file' calls appear. 3369 ;; in order to keep the cache.
3362 (let (process-file-side-effects) 3370 (let (remote-file-name-inhibit-cache process-file-side-effects)
3363 (ignore-errors 3371 (ignore-errors
3364 (tramp-run-real-handler 'vc-registered (list file)))))))) 3372 (tramp-run-real-handler 'vc-registered (list file))))))))
3365 3373
@@ -3604,8 +3612,13 @@ This function expects to be in the right *tramp* buffer."
3604 (let (result) 3612 (let (result)
3605 ;; Check whether the executable is in $PATH. "which(1)" does not 3613 ;; Check whether the executable is in $PATH. "which(1)" does not
3606 ;; report always a correct error code; therefore we check the 3614 ;; report always a correct error code; therefore we check the
3607 ;; number of words it returns. 3615 ;; number of words it returns. "SunOS 5.10" (and maybe "SunOS
3608 (unless ignore-path 3616 ;; 5.11") have problems with this command, we disable the call
3617 ;; therefore.
3618 (unless (or ignore-path
3619 (string-match
3620 (regexp-opt '("SunOS 5.10" "SunOS 5.11"))
3621 (tramp-get-connection-property vec "uname" "")))
3609 (tramp-send-command vec (format "which \\%s | wc -w" progname)) 3622 (tramp-send-command vec (format "which \\%s | wc -w" progname))
3610 (goto-char (point-min)) 3623 (goto-char (point-min))
3611 (if (looking-at "^\\s-*1$") 3624 (if (looking-at "^\\s-*1$")
@@ -4677,8 +4690,9 @@ function waits for output unless NOOUTPUT is set."
4677(defun tramp-send-command-and-check 4690(defun tramp-send-command-and-check
4678 (vec command &optional subshell dont-suppress-err) 4691 (vec command &optional subshell dont-suppress-err)
4679 "Run COMMAND and check its exit status. 4692 "Run COMMAND and check its exit status.
4680Sends `echo $?' along with the COMMAND for checking the exit status. If 4693Sends `echo $?' along with the COMMAND for checking the exit status.
4681COMMAND is nil, just sends `echo $?'. Returns the exit status found. 4694If COMMAND is nil, just sends `echo $?'. Returns `t' if the exit
4695status is 0, and `nil' otherwise.
4682 4696
4683If the optional argument SUBSHELL is non-nil, the command is 4697If the optional argument SUBSHELL is non-nil, the command is
4684executed in a subshell, ie surrounded by parentheses. If 4698executed in a subshell, ie surrounded by parentheses. If
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b9b64ed70f8..20948181414 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -241,7 +241,7 @@ pair of the form (KEY VALUE). The following KEYs are defined:
241 * `tramp-copy-program' 241 * `tramp-copy-program'
242 This specifies the name of the program to use for remotely copying 242 This specifies the name of the program to use for remotely copying
243 the file; this might be the absolute filename of rcp or the name of 243 the file; this might be the absolute filename of rcp or the name of
244 a workalike program. 244 a workalike program. It is always applied on the local host.
245 * `tramp-copy-args' 245 * `tramp-copy-args'
246 This specifies the list of parameters to pass to the above mentioned 246 This specifies the list of parameters to pass to the above mentioned
247 program, the hints for `tramp-login-args' also apply here. 247 program, the hints for `tramp-login-args' also apply here.
@@ -1044,7 +1044,9 @@ opening a connection to a remote host."
1044 1044
1045(defcustom tramp-connection-timeout 60 1045(defcustom tramp-connection-timeout 60
1046 "Defines the max time to wait for establishing a connection (in seconds). 1046 "Defines the max time to wait for establishing a connection (in seconds).
1047This can be overwritten for different connection types in `tramp-methods'." 1047This can be overwritten for different connection types in `tramp-methods'.
1048
1049The timeout does not include the time reading a password."
1048 :group 'tramp 1050 :group 'tramp
1049 :version "24.4" 1051 :version "24.4"
1050 :type 'integer) 1052 :type 'integer)
@@ -4119,40 +4121,48 @@ Invokes `password-read' if available, `read-passwd' else."
4119 (with-current-buffer (process-buffer proc) 4121 (with-current-buffer (process-buffer proc)
4120 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 4122 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
4121 (format "%s for %s " (capitalize (match-string 1)) key)))) 4123 (format "%s for %s " (capitalize (match-string 1)) key))))
4122 auth-info auth-passwd) 4124 ;; We suspend the timers while reading the password.
4123 (with-parsed-tramp-file-name key nil 4125 (stimers (with-timeout-suspend))
4124 (prog1 4126 auth-info auth-passwd)
4125 (or 4127
4126 ;; See if auth-sources contains something useful, if it's 4128 (unwind-protect
4127 ;; bound. `auth-source-user-or-password' is an obsoleted 4129 (with-parsed-tramp-file-name key nil
4128 ;; function, it has been replaced by `auth-source-search'. 4130 (prog1
4129 (and (boundp 'auth-sources) 4131 (or
4130 (tramp-get-connection-property v "first-password-request" nil) 4132 ;; See if auth-sources contains something useful, if
4131 ;; Try with Tramp's current method. 4133 ;; it's bound. `auth-source-user-or-password' is an
4132 (if (fboundp 'auth-source-search) 4134 ;; obsoleted function, it has been replaced by
4133 (setq auth-info 4135 ;; `auth-source-search'.
4134 (tramp-compat-funcall 4136 (and (boundp 'auth-sources)
4135 'auth-source-search 4137 (tramp-get-connection-property
4136 :max 1 4138 v "first-password-request" nil)
4137 :user (or tramp-current-user t) 4139 ;; Try with Tramp's current method.
4138 :host tramp-current-host 4140 (if (fboundp 'auth-source-search)
4139 :port tramp-current-method) 4141 (setq auth-info
4140 auth-passwd (plist-get (nth 0 auth-info) :secret) 4142 (tramp-compat-funcall
4141 auth-passwd (if (functionp auth-passwd) 4143 'auth-source-search
4142 (funcall auth-passwd) 4144 :max 1
4143 auth-passwd)) 4145 :user (or tramp-current-user t)
4144 (tramp-compat-funcall 4146 :host tramp-current-host
4145 'auth-source-user-or-password 4147 :port tramp-current-method)
4146 "password" tramp-current-host tramp-current-method))) 4148 auth-passwd (plist-get (nth 0 auth-info) :secret)
4147 ;; Try the password cache. 4149 auth-passwd (if (functionp auth-passwd)
4148 (when (functionp 'password-read) 4150 (funcall auth-passwd)
4149 (let ((password 4151 auth-passwd))
4150 (tramp-compat-funcall 'password-read pw-prompt key))) 4152 (tramp-compat-funcall
4151 (tramp-compat-funcall 'password-cache-add key password) 4153 'auth-source-user-or-password
4152 password)) 4154 "password" tramp-current-host tramp-current-method)))
4153 ;; Else, get the password interactively. 4155 ;; Try the password cache.
4154 (read-passwd pw-prompt)) 4156 (when (functionp 'password-read)
4155 (tramp-set-connection-property v "first-password-request" nil))))) 4157 (let ((password
4158 (tramp-compat-funcall 'password-read pw-prompt key)))
4159 (tramp-compat-funcall 'password-cache-add key password)
4160 password))
4161 ;; Else, get the password interactively.
4162 (read-passwd pw-prompt))
4163 (tramp-set-connection-property v "first-password-request" nil)))
4164 ;; Reenable the timers.
4165 (with-timeout-unsuspend stimers))))
4156 4166
4157;;;###tramp-autoload 4167;;;###tramp-autoload
4158(defun tramp-clear-passwd (vec) 4168(defun tramp-clear-passwd (vec)