Skip to content

Commit eb1698c

Browse files
committed
Fix an error in tramp-vc-file-name-handler
* lisp/net/tramp.el (tramp-accept-process-output, tramp-send-string): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) (tramp-sh-handle-make-process): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-file-acl, tramp-smb-handle-process-file) (tramp-smb-handle-set-file-acl) (tramp-smb-handle-start-file-process): Do not suppress timers. * lisp/net/tramp-sh.el (tramp-vc-file-name-handler): Check, that `tramp-file-name-for-operation' returns a proper Tramp file.
1 parent 4255f0f commit eb1698c

File tree

4 files changed

+33
-63
lines changed

4 files changed

+33
-63
lines changed

lisp/net/tramp-adb.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
975975
(or (null program) tramp-process-connection-type))
976976
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
977977
(name1 name)
978-
(i 0)
979-
;; We do not want to run timers.
980-
timer-list timer-idle-list)
978+
(i 0))
981979

982980
(while (get-process name1)
983981
;; NAME must be unique as process name.

lisp/net/tramp-sh.el

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,9 +2417,7 @@ The method used must be an out-of-band method."
24172417
;; The default directory must be remote.
24182418
(let ((default-directory
24192419
(file-name-directory (if t1 filename newname)))
2420-
(process-environment (copy-sequence process-environment))
2421-
;; We do not want to run timers.
2422-
timer-list timer-idle-list)
2420+
(process-environment (copy-sequence process-environment)))
24232421
;; Set the transfer process properties.
24242422
(tramp-set-connection-property
24252423
v "process-name" (buffer-name (current-buffer)))
@@ -2878,8 +2876,6 @@ the result will be a local, non-Tramp, file name."
28782876
;; has been started several times in `eshell' and
28792877
;; friends.
28802878
tramp-current-connection
2881-
;; We do not want to run timers.
2882-
timer-list timer-idle-list
28832879
p)
28842880

28852881
(while (get-process name1)
@@ -3550,24 +3546,29 @@ Fall back to normal file name handler if no Tramp handler exists."
35503546
(tramp-replace-environment-variables
35513547
(apply #'tramp-file-name-for-operation operation args)))
35523548
(fn (assoc operation tramp-sh-file-name-handler-alist)))
3553-
(with-parsed-tramp-file-name filename nil
3554-
(cond
3555-
;; That's what we want: file names, for which checks are
3556-
;; applied. We assume that VC uses only `file-exists-p' and
3557-
;; `file-readable-p' checks; otherwise we must extend the
3558-
;; list. We do not perform any action, but return nil, in
3559-
;; order to keep `vc-registered' running.
3560-
((and fn (memq operation '(file-exists-p file-readable-p)))
3561-
(add-to-list 'tramp-vc-registered-file-names localname 'append)
3562-
nil)
3563-
;; `process-file' and `start-file-process' shall be ignored.
3564-
((and fn (eq operation 'process-file) 0))
3565-
((and fn (eq operation 'start-file-process) nil))
3566-
;; Tramp file name handlers like `expand-file-name'. They
3567-
;; must still work.
3568-
(fn (save-match-data (apply (cdr fn) args)))
3569-
;; Default file name handlers, we don't care.
3570-
(t (tramp-run-real-handler operation args)))))))
3549+
(if (tramp-tramp-file-p filename)
3550+
(with-parsed-tramp-file-name filename nil
3551+
(cond
3552+
;; That's what we want: file names, for which checks are
3553+
;; applied. We assume that VC uses only `file-exists-p'
3554+
;; and `file-readable-p' checks; otherwise we must extend
3555+
;; the list. We do not perform any action, but return
3556+
;; nil, in order to keep `vc-registered' running.
3557+
((and fn (memq operation '(file-exists-p file-readable-p)))
3558+
(add-to-list 'tramp-vc-registered-file-names localname 'append)
3559+
nil)
3560+
;; `process-file' and `start-file-process' shall be ignored.
3561+
((and fn (eq operation 'process-file) 0))
3562+
((and fn (eq operation 'start-file-process) nil))
3563+
;; Tramp file name handlers like `expand-file-name'. They
3564+
;; must still work.
3565+
(fn (save-match-data (apply (cdr fn) args)))
3566+
;; Default file name handlers, we don't care.
3567+
(t (tramp-run-real-handler operation args))))
3568+
3569+
;; When `tramp-mode' is not enabled, or the file name is
3570+
;; quoted, we don't do anything.
3571+
(tramp-run-real-handler operation args)))))
35713572

35723573
(defun tramp-sh-handle-file-notify-add-watch (file-name flags _callback)
35733574
"Like `file-notify-add-watch' for Tramp files."

lisp/net/tramp-smb.el

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,7 @@ pass to the OPERATION."
452452
(expand-file-name
453453
tramp-temp-name-prefix
454454
(tramp-compat-temporary-file-directory))))
455-
(args (list (concat "//" host "/" share) "-E"))
456-
;; We do not want to run timers.
457-
timer-list timer-idle-list)
455+
(args (list (concat "//" host "/" share) "-E")))
458456

459457
(if (not (zerop (length user)))
460458
(setq args (append args (list "-U" user)))
@@ -742,9 +740,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
742740
(let* ((share (tramp-smb-get-share v))
743741
(localname (replace-regexp-in-string
744742
"\\\\" "/" (tramp-smb-get-localname v)))
745-
(args (list (concat "//" host "/" share) "-E"))
746-
;; We do not want to run timers.
747-
timer-list timer-idle-list)
743+
(args (list (concat "//" host "/" share) "-E")))
748744

749745
(if (not (zerop (length user)))
750746
(setq args (append args (list "-U" user)))
@@ -1218,8 +1214,6 @@ component is used as the target of the symlink."
12181214
(let* ((name (file-name-nondirectory program))
12191215
(name1 name)
12201216
(i 0)
1221-
;; We do not want to run timers.
1222-
timer-list timer-idle-list
12231217
input tmpinput outbuf command ret)
12241218

12251219
;; Determine input.
@@ -1395,9 +1389,7 @@ component is used as the target of the symlink."
13951389
"\\\\" "/" (tramp-smb-get-localname v)))
13961390
(args (list (concat "//" host "/" share) "-E" "-S"
13971391
(replace-regexp-in-string
1398-
"\n" "," acl-string)))
1399-
;; We do not want to run timers.
1400-
timer-list timer-idle-list)
1392+
"\n" "," acl-string))))
14011393

14021394
(if (not (zerop (length user)))
14031395
(setq args (append args (list "-U" user)))
@@ -1477,9 +1469,7 @@ component is used as the target of the symlink."
14771469
(command (mapconcat #'identity (cons program args) " "))
14781470
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
14791471
(name1 name)
1480-
(i 0)
1481-
;; We do not want to run timers.
1482-
timer-list timer-idle-list)
1472+
(i 0))
14831473
(unwind-protect
14841474
(save-excursion
14851475
(save-restriction

lisp/net/tramp.el

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,7 +3640,8 @@ support symbolic links."
36403640

36413641
(if (and (not current-buffer-p) (integerp asynchronous))
36423642
(let ((tramp-remote-process-environment
3643-
;; `async-shell-command-width' has been introduced with Emacs 27.1.
3643+
;; `async-shell-command-width' has been introduced with
3644+
;; Emacs 27.1.
36443645
(if (natnump (bound-and-true-p async-shell-command-width))
36453646
(cons (format "COLUMNS=%d"
36463647
(bound-and-true-p async-shell-command-width))
@@ -4087,24 +4088,14 @@ for process communication also."
40874088
(with-current-buffer (process-buffer proc)
40884089
(let ((inhibit-read-only t)
40894090
last-coding-system-used
4090-
;; We do not want to run timers.
4091-
(tl timer-list)
4092-
(stimers (with-timeout-suspend))
4093-
timer-list timer-idle-list
40944091
result)
4095-
;; Enable our progress reporter.
4096-
(dolist (timer tl)
4097-
(if (eq (timer--function timer) #'tramp-progress-reporter-update)
4098-
(push timer timer-list)))
40994092
;; JUST-THIS-ONE is set due to Bug#12145.
41004093
(tramp-message
41014094
proc 10 "%s %s %s %s\n%s"
41024095
proc timeout (process-status proc)
41034096
(with-local-quit
41044097
(setq result (accept-process-output proc timeout nil t)))
41054098
(buffer-string))
4106-
;; Reenable the timers.
4107-
(with-timeout-unsuspend stimers)
41084099
result)))
41094100

41104101
(defun tramp-check-for-regexp (proc regexp)
@@ -4185,20 +4176,12 @@ The STRING is expected to use Unix line-endings, but the lines sent to
41854176
the remote host use line-endings as defined in the variable
41864177
`tramp-rsh-end-of-line'. The communication buffer is erased before sending."
41874178
(let* ((p (tramp-get-connection-process vec))
4188-
(chunksize (tramp-get-connection-property p "chunksize" nil))
4189-
;; We do not want to run timers.
4190-
(tl timer-list)
4191-
(stimers (with-timeout-suspend))
4192-
timer-list timer-idle-list)
4179+
(chunksize (tramp-get-connection-property p "chunksize" nil)))
41934180
(unless p
41944181
(tramp-error
41954182
vec 'file-error "Can't send string to remote host -- not logged in"))
41964183
(tramp-set-connection-property p "last-cmd-time" (current-time))
41974184
(tramp-message vec 10 "%s" string)
4198-
;; Enable our progress reporter.
4199-
(dolist (timer tl)
4200-
(if (eq (timer--function timer) #'tramp-progress-reporter-update)
4201-
(push timer timer-list)))
42024185
(with-current-buffer (tramp-get-connection-buffer vec)
42034186
;; Clean up the buffer. We cannot call `erase-buffer' because
42044187
;; narrowing might be in effect.
@@ -4222,9 +4205,7 @@ the remote host use line-endings as defined in the variable
42224205
(process-send-string
42234206
p (substring string pos (min (+ pos chunksize) end)))
42244207
(setq pos (+ pos chunksize))))
4225-
(process-send-string p string)))
4226-
;; Reenable the timers.
4227-
(with-timeout-unsuspend stimers))))
4208+
(process-send-string p string))))))
42284209

42294210
(defun tramp-process-sentinel (proc event)
42304211
"Flush file caches and remove shell prompt."

0 commit comments

Comments
 (0)