diff options
| author | Michael Albinus | 2017-12-16 10:47:06 +0100 |
|---|---|---|
| committer | Michael Albinus | 2017-12-16 10:47:06 +0100 |
| commit | f63d9f86b5688ac84ec6e7eecdbb6cac103dbcf2 (patch) | |
| tree | 552540925fa6260413ac1d067b9bbc2f65e6fe00 | |
| parent | 506270f9c80bf9bd7dad35a2f0aa6f477da6490b (diff) | |
| download | emacs-f63d9f86b5688ac84ec6e7eecdbb6cac103dbcf2.tar.gz emacs-f63d9f86b5688ac84ec6e7eecdbb6cac103dbcf2.zip | |
Suppress timers in Tramp operations
* lisp/net/tramp.el (tramp-accept-process-output):
* lisp/net/tramp-adb.el (tramp-adb-handle-start-file-process):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-start-file-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): Suppress timers.
* test/lisp/net/tramp-tests.el (tramp-test41-asynchronous-requests):
Use $REMOTE_PARALLEL_PROCESSES. Flush cache prior file operations.
Add instrumentation messages.
| -rw-r--r-- | lisp/net/tramp-adb.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 18 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 4 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 23 |
5 files changed, 47 insertions, 10 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index d06031f1a67..c614acfa4db 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -1037,7 +1037,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1037 | (or (null program) tramp-process-connection-type)) | 1037 | (or (null program) tramp-process-connection-type)) |
| 1038 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) | 1038 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) |
| 1039 | (name1 name) | 1039 | (name1 name) |
| 1040 | (i 0)) | 1040 | (i 0) |
| 1041 | ;; We do not want to run timers. | ||
| 1042 | timer-list timer-idle-list) | ||
| 1041 | 1043 | ||
| 1042 | (while (get-process name1) | 1044 | (while (get-process name1) |
| 1043 | ;; NAME must be unique as process name. | 1045 | ;; NAME must be unique as process name. |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 361e4c3e300..96a0d849072 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2473,7 +2473,9 @@ The method used must be an out-of-band method." | |||
| 2473 | ;; The default directory must be remote. | 2473 | ;; The default directory must be remote. |
| 2474 | (let ((default-directory | 2474 | (let ((default-directory |
| 2475 | (file-name-directory (if t1 filename newname))) | 2475 | (file-name-directory (if t1 filename newname))) |
| 2476 | (process-environment (copy-sequence process-environment))) | 2476 | (process-environment (copy-sequence process-environment)) |
| 2477 | ;; We do not want to run timers. | ||
| 2478 | timer-list timer-idle-list) | ||
| 2477 | ;; Set the transfer process properties. | 2479 | ;; Set the transfer process properties. |
| 2478 | (tramp-set-connection-property | 2480 | (tramp-set-connection-property |
| 2479 | v "process-name" (buffer-name (current-buffer))) | 2481 | v "process-name" (buffer-name (current-buffer))) |
| @@ -2894,7 +2896,9 @@ the result will be a local, non-Tramp, file name." | |||
| 2894 | ;; We do not want to raise an error when | 2896 | ;; We do not want to raise an error when |
| 2895 | ;; `start-file-process' has been started several times in | 2897 | ;; `start-file-process' has been started several times in |
| 2896 | ;; `eshell' and friends. | 2898 | ;; `eshell' and friends. |
| 2897 | (tramp-current-connection nil) | 2899 | tramp-current-connection |
| 2900 | ;; We do not want to run timers. | ||
| 2901 | timer-list timer-idle-list | ||
| 2898 | p) | 2902 | p) |
| 2899 | 2903 | ||
| 2900 | (while (get-process name1) | 2904 | (while (get-process name1) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index ec689aea15f..fee14df991e 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -457,7 +457,9 @@ pass to the OPERATION." | |||
| 457 | (expand-file-name | 457 | (expand-file-name |
| 458 | tramp-temp-name-prefix | 458 | tramp-temp-name-prefix |
| 459 | (tramp-compat-temporary-file-directory)))) | 459 | (tramp-compat-temporary-file-directory)))) |
| 460 | (args (list (concat "//" host "/" share) "-E"))) | 460 | (args (list (concat "//" host "/" share) "-E")) |
| 461 | ;; We do not want to run timers. | ||
| 462 | timer-list timer-idle-list) | ||
| 461 | 463 | ||
| 462 | (if (not (zerop (length user))) | 464 | (if (not (zerop (length user))) |
| 463 | (setq args (append args (list "-U" user))) | 465 | (setq args (append args (list "-U" user))) |
| @@ -739,7 +741,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 739 | (let* ((share (tramp-smb-get-share v)) | 741 | (let* ((share (tramp-smb-get-share v)) |
| 740 | (localname (replace-regexp-in-string | 742 | (localname (replace-regexp-in-string |
| 741 | "\\\\" "/" (tramp-smb-get-localname v))) | 743 | "\\\\" "/" (tramp-smb-get-localname v))) |
| 742 | (args (list (concat "//" host "/" share) "-E"))) | 744 | (args (list (concat "//" host "/" share) "-E")) |
| 745 | ;; We do not want to run timers. | ||
| 746 | timer-list timer-idle-list) | ||
| 743 | 747 | ||
| 744 | (if (not (zerop (length user))) | 748 | (if (not (zerop (length user))) |
| 745 | (setq args (append args (list "-U" user))) | 749 | (setq args (append args (list "-U" user))) |
| @@ -1215,6 +1219,8 @@ component is used as the target of the symlink." | |||
| 1215 | (let* ((name (file-name-nondirectory program)) | 1219 | (let* ((name (file-name-nondirectory program)) |
| 1216 | (name1 name) | 1220 | (name1 name) |
| 1217 | (i 0) | 1221 | (i 0) |
| 1222 | ;; We do not want to run timers. | ||
| 1223 | timer-list timer-idle-list | ||
| 1218 | input tmpinput outbuf command ret) | 1224 | input tmpinput outbuf command ret) |
| 1219 | 1225 | ||
| 1220 | ;; Determine input. | 1226 | ;; Determine input. |
| @@ -1391,7 +1397,9 @@ component is used as the target of the symlink." | |||
| 1391 | "\\\\" "/" (tramp-smb-get-localname v))) | 1397 | "\\\\" "/" (tramp-smb-get-localname v))) |
| 1392 | (args (list (concat "//" host "/" share) "-E" "-S" | 1398 | (args (list (concat "//" host "/" share) "-E" "-S" |
| 1393 | (replace-regexp-in-string | 1399 | (replace-regexp-in-string |
| 1394 | "\n" "," acl-string)))) | 1400 | "\n" "," acl-string))) |
| 1401 | ;; We do not want to run timers. | ||
| 1402 | timer-list timer-idle-list) | ||
| 1395 | 1403 | ||
| 1396 | (if (not (zerop (length user))) | 1404 | (if (not (zerop (length user))) |
| 1397 | (setq args (append args (list "-U" user))) | 1405 | (setq args (append args (list "-U" user))) |
| @@ -1471,7 +1479,9 @@ component is used as the target of the symlink." | |||
| 1471 | (command (mapconcat 'identity (cons program args) " ")) | 1479 | (command (mapconcat 'identity (cons program args) " ")) |
| 1472 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) | 1480 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) |
| 1473 | (name1 name) | 1481 | (name1 name) |
| 1474 | (i 0)) | 1482 | (i 0) |
| 1483 | ;; We do not want to run timers. | ||
| 1484 | timer-list timer-idle-list) | ||
| 1475 | (unwind-protect | 1485 | (unwind-protect |
| 1476 | (save-excursion | 1486 | (save-excursion |
| 1477 | (save-restriction | 1487 | (save-restriction |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3129984afc6..01a3e44c73e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3833,7 +3833,9 @@ connection buffer." | |||
| 3833 | This is needed in order to hide `last-coding-system-used', which is set | 3833 | This is needed in order to hide `last-coding-system-used', which is set |
| 3834 | for process communication also." | 3834 | for process communication also." |
| 3835 | (with-current-buffer (process-buffer proc) | 3835 | (with-current-buffer (process-buffer proc) |
| 3836 | (let (buffer-read-only last-coding-system-used) | 3836 | (let (buffer-read-only last-coding-system-used |
| 3837 | ;; We do not want to run timers. | ||
| 3838 | timer-list timer-idle-list) | ||
| 3837 | ;; Under Windows XP, `accept-process-output' doesn't return | 3839 | ;; Under Windows XP, `accept-process-output' doesn't return |
| 3838 | ;; sometimes. So we add an additional timeout. JUST-THIS-ONE | 3840 | ;; sometimes. So we add an additional timeout. JUST-THIS-ONE |
| 3839 | ;; is set due to Bug#12145. It is an integer, in order to avoid | 3841 | ;; is set due to Bug#12145. It is an integer, in order to avoid |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 5fb3162769b..1bcd3a0f98b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -33,6 +33,10 @@ | |||
| 33 | ;; remote host, set this environment variable to "/dev/null" or | 33 | ;; remote host, set this environment variable to "/dev/null" or |
| 34 | ;; whatever is appropriate on your system. | 34 | ;; whatever is appropriate on your system. |
| 35 | 35 | ||
| 36 | ;; For slow remote connections, `tramp-test41-asynchronous-requests' | ||
| 37 | ;; might be too heavy. Setting $REMOTE_PARALLEL_PROCESSES to a proper | ||
| 38 | ;; value less than 10 could help. | ||
| 39 | |||
| 36 | ;; A whole test run can be performed calling the command `tramp-test-all'. | 40 | ;; A whole test run can be performed calling the command `tramp-test-all'. |
| 37 | 41 | ||
| 38 | ;;; Code: | 42 | ;;; Code: |
| @@ -4504,8 +4508,13 @@ process sentinels. They shall not disturb each other." | |||
| 4504 | (inhibit-message t) | 4508 | (inhibit-message t) |
| 4505 | ;; Do not run delayed timers. | 4509 | ;; Do not run delayed timers. |
| 4506 | (timer-max-repeats 0) | 4510 | (timer-max-repeats 0) |
| 4507 | ;; Number of asynchronous processes for test. | 4511 | ;; Number of asynchronous processes for test. Tests on |
| 4508 | (number-proc 10) | 4512 | ;; some machines handle less parallel processes. |
| 4513 | (number-proc | ||
| 4514 | (or | ||
| 4515 | (ignore-errors | ||
| 4516 | (string-to-number (getenv "REMOTE_PARALLEL_PROCESSES"))) | ||
| 4517 | 10)) | ||
| 4509 | ;; On hydra, timings are bad. | 4518 | ;; On hydra, timings are bad. |
| 4510 | (timer-repeat | 4519 | (timer-repeat |
| 4511 | (cond | 4520 | (cond |
| @@ -4571,14 +4580,20 @@ process sentinels. They shall not disturb each other." | |||
| 4571 | (set-process-filter | 4580 | (set-process-filter |
| 4572 | proc | 4581 | proc |
| 4573 | (lambda (proc string) | 4582 | (lambda (proc string) |
| 4583 | (tramp--test-message | ||
| 4584 | "Process filter %s %s %s" proc string (current-time-string)) | ||
| 4574 | (with-current-buffer (process-buffer proc) | 4585 | (with-current-buffer (process-buffer proc) |
| 4575 | (insert string)) | 4586 | (insert string)) |
| 4576 | (unless (zerop (length string)) | 4587 | (unless (zerop (length string)) |
| 4588 | (dired-uncache (process-get proc 'foo)) | ||
| 4577 | (should (file-attributes (process-get proc 'foo)))))) | 4589 | (should (file-attributes (process-get proc 'foo)))))) |
| 4578 | ;; Add process sentinel. | 4590 | ;; Add process sentinel. |
| 4579 | (set-process-sentinel | 4591 | (set-process-sentinel |
| 4580 | proc | 4592 | proc |
| 4581 | (lambda (proc _state) | 4593 | (lambda (proc _state) |
| 4594 | (tramp--test-message | ||
| 4595 | "Process sentinel %s %s" proc (current-time-string)) | ||
| 4596 | (dired-uncache (process-get proc 'foo)) | ||
| 4582 | (should-not (file-attributes (process-get proc 'foo))))))) | 4597 | (should-not (file-attributes (process-get proc 'foo))))))) |
| 4583 | 4598 | ||
| 4584 | ;; Send a string. Use a random order of the buffers. Mix | 4599 | ;; Send a string. Use a random order of the buffers. Mix |
| @@ -4594,6 +4609,7 @@ process sentinels. They shall not disturb each other." | |||
| 4594 | (tramp--test-message | 4609 | (tramp--test-message |
| 4595 | "Start action %d %s %s" count buf (current-time-string)) | 4610 | "Start action %d %s %s" count buf (current-time-string)) |
| 4596 | ;; Regular operation prior process action. | 4611 | ;; Regular operation prior process action. |
| 4612 | (dired-uncache file) | ||
| 4597 | (if (= count 0) | 4613 | (if (= count 0) |
| 4598 | (should-not (file-attributes file)) | 4614 | (should-not (file-attributes file)) |
| 4599 | (should (file-attributes file))) | 4615 | (should (file-attributes file))) |
| @@ -4602,7 +4618,10 @@ process sentinels. They shall not disturb each other." | |||
| 4602 | (accept-process-output proc 0.1 nil 0) | 4618 | (accept-process-output proc 0.1 nil 0) |
| 4603 | ;; Give the watchdog a chance. | 4619 | ;; Give the watchdog a chance. |
| 4604 | (read-event nil nil 0.01) | 4620 | (read-event nil nil 0.01) |
| 4621 | (tramp--test-message | ||
| 4622 | "Continue action %d %s %s" count buf (current-time-string)) | ||
| 4605 | ;; Regular operation post process action. | 4623 | ;; Regular operation post process action. |
| 4624 | (dired-uncache file) | ||
| 4606 | (if (= count 2) | 4625 | (if (= count 2) |
| 4607 | (should-not (file-attributes file)) | 4626 | (should-not (file-attributes file)) |
| 4608 | (should (file-attributes file))) | 4627 | (should (file-attributes file))) |