emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master eb1698c 2/2: Fix an error in tramp-vc-file-name-han


From: Michael Albinus
Subject: [Emacs-diffs] master eb1698c 2/2: Fix an error in tramp-vc-file-name-handler
Date: Thu, 9 May 2019 08:24:32 -0400 (EDT)

branch: master
commit eb1698c54ab2e907d4912db46b8a3da9490d0482
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 lisp/net/tramp-adb.el |  4 +---
 lisp/net/tramp-sh.el  | 47 ++++++++++++++++++++++++-----------------------
 lisp/net/tramp-smb.el | 18 ++++--------------
 lisp/net/tramp.el     | 27 ++++-----------------------
 4 files changed, 33 insertions(+), 63 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index bd66ab4..008a5ce 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -975,9 +975,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                (or (null program) tramp-process-connection-type))
               (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
               (name1 name)
-              (i 0)
-              ;; We do not want to run timers.
-              timer-list timer-idle-list)
+              (i 0))
 
          (while (get-process name1)
            ;; NAME must be unique as process name.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index c4c4398..b9df403 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2417,9 +2417,7 @@ The method used must be an out-of-band method."
              ;; The default directory must be remote.
              (let ((default-directory
                      (file-name-directory (if t1 filename newname)))
-                   (process-environment (copy-sequence process-environment))
-                   ;; We do not want to run timers.
-                   timer-list timer-idle-list)
+                   (process-environment (copy-sequence process-environment)))
                ;; Set the transfer process properties.
                (tramp-set-connection-property
                 v "process-name" (buffer-name (current-buffer)))
@@ -2878,8 +2876,6 @@ the result will be a local, non-Tramp, file name."
               ;; has been started several times in `eshell' and
               ;; friends.
               tramp-current-connection
-              ;; We do not want to run timers.
-              timer-list timer-idle-list
               p)
 
          (while (get-process name1)
@@ -3550,24 +3546,29 @@ Fall back to normal file name handler if no Tramp 
handler exists."
           (tramp-replace-environment-variables
            (apply #'tramp-file-name-for-operation operation args)))
          (fn (assoc operation tramp-sh-file-name-handler-alist)))
-      (with-parsed-tramp-file-name filename nil
-       (cond
-        ;; That's what we want: file names, for which checks are
-        ;; applied.  We assume that VC uses only `file-exists-p' and
-        ;; `file-readable-p' checks; otherwise we must extend the
-        ;; list.  We do not perform any action, but return nil, in
-        ;; order to keep `vc-registered' running.
-        ((and fn (memq operation '(file-exists-p file-readable-p)))
-         (add-to-list 'tramp-vc-registered-file-names localname 'append)
-         nil)
-        ;; `process-file' and `start-file-process' shall be ignored.
-        ((and fn (eq operation 'process-file) 0))
-        ((and fn (eq operation 'start-file-process) nil))
-        ;; Tramp file name handlers like `expand-file-name'.  They
-        ;; must still work.
-        (fn (save-match-data (apply (cdr fn) args)))
-        ;; Default file name handlers, we don't care.
-        (t (tramp-run-real-handler operation args)))))))
+      (if (tramp-tramp-file-p filename)
+         (with-parsed-tramp-file-name filename nil
+           (cond
+            ;; That's what we want: file names, for which checks are
+            ;; applied.  We assume that VC uses only `file-exists-p'
+            ;; and `file-readable-p' checks; otherwise we must extend
+            ;; the list.  We do not perform any action, but return
+            ;; nil, in order to keep `vc-registered' running.
+            ((and fn (memq operation '(file-exists-p file-readable-p)))
+             (add-to-list 'tramp-vc-registered-file-names localname 'append)
+             nil)
+            ;; `process-file' and `start-file-process' shall be ignored.
+            ((and fn (eq operation 'process-file) 0))
+            ((and fn (eq operation 'start-file-process) nil))
+            ;; Tramp file name handlers like `expand-file-name'.  They
+            ;; must still work.
+            (fn (save-match-data (apply (cdr fn) args)))
+            ;; Default file name handlers, we don't care.
+            (t (tramp-run-real-handler operation args))))
+
+       ;; When `tramp-mode' is not enabled, or the file name is
+       ;; quoted, we don't do anything.
+       (tramp-run-real-handler operation args)))))
 
 (defun tramp-sh-handle-file-notify-add-watch (file-name flags _callback)
   "Like `file-notify-add-watch' for Tramp files."
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 6647630..9d15c05 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -452,9 +452,7 @@ pass to the OPERATION."
                               (expand-file-name
                                tramp-temp-name-prefix
                                (tramp-compat-temporary-file-directory))))
-                  (args      (list (concat "//" host "/" share) "-E"))
-                  ;; We do not want to run timers.
-                  timer-list timer-idle-list)
+                  (args      (list (concat "//" host "/" share) "-E")))
 
              (if (not (zerop (length user)))
                  (setq args (append args (list "-U" user)))
@@ -742,9 +740,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (let* ((share     (tramp-smb-get-share v))
                 (localname (replace-regexp-in-string
                             "\\\\" "/" (tramp-smb-get-localname v)))
-                (args      (list (concat "//" host "/" share) "-E"))
-                ;; We do not want to run timers.
-                timer-list timer-idle-list)
+                (args      (list (concat "//" host "/" share) "-E")))
 
            (if (not (zerop (length user)))
                (setq args (append args (list "-U" user)))
@@ -1218,8 +1214,6 @@ component is used as the target of the symlink."
     (let* ((name (file-name-nondirectory program))
           (name1 name)
           (i 0)
-          ;; We do not want to run timers.
-          timer-list timer-idle-list
           input tmpinput outbuf command ret)
 
       ;; Determine input.
@@ -1395,9 +1389,7 @@ component is used as the target of the symlink."
                           "\\\\" "/" (tramp-smb-get-localname v)))
               (args      (list (concat "//" host "/" share) "-E" "-S"
                                (replace-regexp-in-string
-                                "\n" "," acl-string)))
-              ;; We do not want to run timers.
-              timer-list timer-idle-list)
+                                "\n" "," acl-string))))
 
          (if (not (zerop (length user)))
              (setq args (append args (list "-U" user)))
@@ -1477,9 +1469,7 @@ component is used as the target of the symlink."
           (command (mapconcat #'identity (cons program args) " "))
           (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
           (name1 name)
-          (i 0)
-          ;; We do not want to run timers.
-          timer-list timer-idle-list)
+          (i 0))
       (unwind-protect
          (save-excursion
            (save-restriction
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 1f83756..0a3129f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3640,7 +3640,8 @@ support symbolic links."
 
     (if (and (not current-buffer-p) (integerp asynchronous))
        (let ((tramp-remote-process-environment
-              ;; `async-shell-command-width' has been introduced with Emacs 
27.1.
+              ;; `async-shell-command-width' has been introduced with
+              ;; Emacs 27.1.
               (if (natnump (bound-and-true-p async-shell-command-width))
                   (cons (format "COLUMNS=%d"
                                 (bound-and-true-p async-shell-command-width))
@@ -4087,15 +4088,7 @@ for process communication also."
   (with-current-buffer (process-buffer proc)
     (let ((inhibit-read-only t)
          last-coding-system-used
-         ;; We do not want to run timers.
-         (tl timer-list)
-          (stimers (with-timeout-suspend))
-         timer-list timer-idle-list
          result)
-      ;; Enable our progress reporter.
-      (dolist (timer tl)
-       (if (eq (timer--function timer) #'tramp-progress-reporter-update)
-            (push timer timer-list)))
       ;; JUST-THIS-ONE is set due to Bug#12145.
       (tramp-message
        proc 10 "%s %s %s %s\n%s"
@@ -4103,8 +4096,6 @@ for process communication also."
        (with-local-quit
         (setq result (accept-process-output proc timeout nil t)))
        (buffer-string))
-      ;; Reenable the timers.
-      (with-timeout-unsuspend stimers)
       result)))
 
 (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
 the remote host use line-endings as defined in the variable
 `tramp-rsh-end-of-line'.  The communication buffer is erased before sending."
   (let* ((p (tramp-get-connection-process vec))
-        (chunksize (tramp-get-connection-property p "chunksize" nil))
-        ;; We do not want to run timers.
-        (tl timer-list)
-         (stimers (with-timeout-suspend))
-        timer-list timer-idle-list)
+        (chunksize (tramp-get-connection-property p "chunksize" nil)))
     (unless p
       (tramp-error
        vec 'file-error "Can't send string to remote host -- not logged in"))
     (tramp-set-connection-property p "last-cmd-time" (current-time))
     (tramp-message vec 10 "%s" string)
-    ;; Enable our progress reporter.
-    (dolist (timer tl)
-      (if (eq (timer--function timer) #'tramp-progress-reporter-update)
-          (push timer timer-list)))
     (with-current-buffer (tramp-get-connection-buffer vec)
       ;; Clean up the buffer.  We cannot call `erase-buffer' because
       ;; narrowing might be in effect.
@@ -4222,9 +4205,7 @@ the remote host use line-endings as defined in the 
variable
                (process-send-string
                 p (substring string pos (min (+ pos chunksize) end)))
                (setq pos (+ pos chunksize))))
-         (process-send-string p string)))
-      ;; Reenable the timers.
-      (with-timeout-unsuspend stimers))))
+         (process-send-string p string))))))
 
 (defun tramp-process-sentinel (proc event)
   "Flush file caches and remove shell prompt."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]