]> git.eshelyaron.com Git - emacs.git/commitdiff
Suppress timers in Tramp
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 5 Jul 2017 15:03:42 +0000 (17:03 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 5 Jul 2017 15:03:42 +0000 (17:03 +0200)
* lisp/net/tramp.el (tramp-file-name-handler): Don't trigger timers.

* test/lisp/net/tramp-tests.el
(tramp-test36-asynchronous-requests): Trigger timers.
(tramp-test37-recursive-load, tramp-test38-remote-load-path):
Set `default-directory' to a trustworthy value.

lisp/net/tramp.el
test/lisp/net/tramp-tests.el

index 9c327c410a7a44bf2fa1f71511671bfdc30f838c..945f81188c805e8a0b257e230b3b55405b10b0d3 100644 (file)
@@ -2128,9 +2128,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
                                  (unwind-protect
                                      (let ((tramp-locker t))
                                        (apply foreign operation args))
-                                   ;; Give timers a chance.
-                                   (unless (setq tramp-locked tl)
-                                     (sit-for 0.001 'nodisp)))))))
+                                   (setq tramp-locked tl))))))
                      (cond
                       ((eq result 'non-essential)
                        (tramp-message
index 31cf7f9ba1cf58f6ebc9d036c10798630413a39e..6c02daa6547a9a36072d2d6272523174a855a149 100644 (file)
@@ -3739,6 +3739,8 @@ process sentinels.  They shall not disturb each other."
 
             ;; Open asynchronous processes.  Set process filter and sentinel.
             (dolist (buf buffers)
+             ;; Activate timer.
+             (sit-for 0.01 'nodisp)
               (let ((proc
                      (start-file-process-shell-command
                       (buffer-name buf) buf
@@ -3768,6 +3770,8 @@ process sentinels.  They shall not disturb each other."
             ;; with regular operation.
             (let ((buffers (copy-sequence buffers)))
               (while buffers
+               ;; Activate timer.
+               (sit-for 0.01 'nodisp)
                 (let* ((buf (nth (random (length buffers)) buffers))
                        (proc (get-buffer-process buf))
                        (file (process-get proc 'foo))
@@ -3808,31 +3812,34 @@ process sentinels.  They shall not disturb each other."
   "Check that Tramp does not fail due to recursive load."
   (skip-unless (tramp--test-enabled))
 
-  (dolist (code
-          (list
-           (format "(expand-file-name %S)" tramp-test-temporary-file-directory)
-           (format
-            "(let ((default-directory %S)) (expand-file-name %S))"
-            tramp-test-temporary-file-directory
-            temporary-file-directory)))
-    (should-not
-     (string-match
-      "Recursive load"
-      (shell-command-to-string
-       (format
-       "%s -batch -Q -L %s --eval %s"
-       (expand-file-name invocation-name invocation-directory)
-       (mapconcat 'shell-quote-argument load-path " -L ")
-       (shell-quote-argument code)))))))
+  (let ((default-directory (expand-file-name temporary-file-directory)))
+    (dolist (code
+            (list
+             (format
+              "(expand-file-name %S)" tramp-test-temporary-file-directory)
+             (format
+              "(let ((default-directory %S)) (expand-file-name %S))"
+              tramp-test-temporary-file-directory
+              temporary-file-directory)))
+      (should-not
+       (string-match
+       "Recursive load"
+       (shell-command-to-string
+        (format
+         "%s -batch -Q -L %s --eval %s"
+         (expand-file-name invocation-name invocation-directory)
+         (mapconcat 'shell-quote-argument load-path " -L ")
+         (shell-quote-argument code))))))))
 
 (ert-deftest tramp-test38-remote-load-path ()
   "Check that Tramp autoloads its packages with remote `load-path'."
   ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
   ;; It shall still work, when a remote file name is in the
   ;; `load-path'.
-  (let ((code
-        "(let ((force-load-messages t)\
-               (load-path (cons \"/foo:bar:\" load-path)))\
+  (let ((default-directory (expand-file-name temporary-file-directory))
+       (code
+        "(let ((force-load-messages t) \
+               (load-path (cons \"/foo:bar:\" load-path))) \
            (tramp-cleanup-all-connections))"))
     (should
      (string-match