diff options
| author | Michael Albinus | 2025-08-16 12:26:19 +0200 |
|---|---|---|
| committer | Michael Albinus | 2025-08-16 12:26:19 +0200 |
| commit | 4a3b6daf76c385fc58759d57aeb4d34e8acc31e5 (patch) | |
| tree | ac5376da74a115bbb0923cacbed979d9775694d1 | |
| parent | f8a206937c9f548bd810153bf29f4f4a32d84c95 (diff) | |
| download | emacs-4a3b6daf76c385fc58759d57aeb4d34e8acc31e5.tar.gz emacs-4a3b6daf76c385fc58759d57aeb4d34e8acc31e5.zip | |
Sync with Tramp 2.7.4-pre
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Adapt Tramp versions.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Use read syntax #' for `tramp-timeout-session',
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
Set "connected" property in time.
* lisp/net/tramp-sh.el (tramp-timeout-session):
Add ;;;###tramp-autoload cookie.
* lisp/net/tramp.el (tramp-barf-if-file-missing): Do not raise an
error when not connected. (Bug#78572)
(tramp-file-name-handler): Do not force the backtrace.
(tramp-connectable-p): Check also, whether initial handshake is finished.
(tramp-skeleton-directory-files)
(tramp-skeleton-directory-files-and-attributes)
(tramp-skeleton-set-file-modes-times-uid-gid): Rearrange sending
`file-missing' error.
(tramp-handle-access-file, tramp-handle-unlock-file):
Use `tramp-connectable-p'.
(tramp-skeleton-file-name-all-completions): Filter out "" hits.
(Bug#79173)
* test/lisp/net/tramp-tests.el (project-mode-line-format)
(project-mode-line): Declare.
(tramp-test48-session-timeout): New test.
(tramp-test49-auto-load, tramp-test49-delay-load)
(tramp-test49-recursive-load, tramp-test49-remote-load-path)
(tramp-test50-without-remote-files, tramp-test51-unload): Rename.
| -rw-r--r-- | doc/misc/trampver.texi | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-cmds.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-rclone.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 187 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 6 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 59 |
8 files changed, 159 insertions, 115 deletions
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index aa76672ea59..8fe3b9bb0a8 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | @c In the Tramp GIT, the version number and the bug report address | 8 | @c In the Tramp GIT, the version number and the bug report address |
| 9 | @c are auto-frobbed from configure.ac. | 9 | @c are auto-frobbed from configure.ac. |
| 10 | @set trampver 2.7.3.30.2 | 10 | @set trampver 2.7.4-pre |
| 11 | @set trampurl https://www.gnu.org/software/tramp/ | 11 | @set trampurl https://www.gnu.org/software/tramp/ |
| 12 | @set tramp-bug-report-address tramp-devel@@gnu.org | 12 | @set tramp-bug-report-address tramp-devel@@gnu.org |
| 13 | @set emacsver 27.1 | 13 | @set emacsver 27.1 |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index f03fa5cf404..18f5d12277e 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -122,7 +122,7 @@ When called interactively, a Tramp connection has to be selected." | |||
| 122 | 122 | ||
| 123 | ;; Cancel timer. | 123 | ;; Cancel timer. |
| 124 | (dolist (timer timer-list) | 124 | (dolist (timer timer-list) |
| 125 | (when (and (eq (timer--function timer) 'tramp-timeout-session) | 125 | (when (and (eq (timer--function timer) #'tramp-timeout-session) |
| 126 | (tramp-file-name-equal-p vec (car (timer--args timer)))) | 126 | (tramp-file-name-equal-p vec (car (timer--args timer)))) |
| 127 | (cancel-timer timer))) | 127 | (cancel-timer timer))) |
| 128 | 128 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 9530aa3733a..efbf9935573 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -2345,11 +2345,11 @@ connection if a previous connection has died for some reason." | |||
| 2345 | ;; Save the password. | 2345 | ;; Save the password. |
| 2346 | (ignore-errors | 2346 | (ignore-errors |
| 2347 | (and (functionp tramp-password-save-function) | 2347 | (and (functionp tramp-password-save-function) |
| 2348 | (funcall tramp-password-save-function))) | 2348 | (funcall tramp-password-save-function)))))) |
| 2349 | 2349 | ||
| 2350 | ;; Mark it as connected. | 2350 | ;; Mark it as connected. |
| 2351 | (tramp-set-connection-property | 2351 | (tramp-set-connection-property |
| 2352 | (tramp-get-connection-process vec) "connected" t)))))) | 2352 | (tramp-get-connection-process vec) "connected" t))) |
| 2353 | 2353 | ||
| 2354 | (defun tramp-gvfs-gio-tool-p (vec) | 2354 | (defun tramp-gvfs-gio-tool-p (vec) |
| 2355 | "Check, whether the gio tool is available." | 2355 | "Check, whether the gio tool is available." |
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 07dd80deb9a..17ae36f94e8 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el | |||
| @@ -411,11 +411,11 @@ connection if a previous connection has died for some reason." | |||
| 411 | (tramp-get-method-parameter vec 'tramp-mount-args)) | 411 | (tramp-get-method-parameter vec 'tramp-mount-args)) |
| 412 | (while (not (file-exists-p (tramp-make-tramp-file-name vec 'noloc))) | 412 | (while (not (file-exists-p (tramp-make-tramp-file-name vec 'noloc))) |
| 413 | (tramp-cleanup-connection vec 'keep-debug 'keep-password)) | 413 | (tramp-cleanup-connection vec 'keep-debug 'keep-password)) |
| 414 | (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec))) | ||
| 414 | 415 | ||
| 415 | ;; Mark it as connected. | 416 | ;; Mark it as connected. |
| 416 | (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) | 417 | (tramp-set-connection-property |
| 417 | (tramp-set-connection-property | 418 | (tramp-get-connection-process vec) "connected" t))) |
| 418 | (tramp-get-connection-process vec) "connected" t)))) | ||
| 419 | 419 | ||
| 420 | ;; In `tramp-check-cached-permissions', the connection properties | 420 | ;; In `tramp-check-cached-permissions', the connection properties |
| 421 | ;; "{uid,gid}-{integer,string}" are used. We set them to proper values. | 421 | ;; "{uid,gid}-{integer,string}" are used. We set them to proper values. |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index cae6d52f14c..287b46fc72e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -5128,6 +5128,7 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 5128 | 5128 | ||
| 5129 | (t "-3"))) | 5129 | (t "-3"))) |
| 5130 | 5130 | ||
| 5131 | ;;;###tramp-autoload | ||
| 5131 | (defun tramp-timeout-session (vec) | 5132 | (defun tramp-timeout-session (vec) |
| 5132 | "Close the connection VEC after a session timeout. | 5133 | "Close the connection VEC after a session timeout. |
| 5133 | If there is just some editing, retry it after 5 seconds." | 5134 | If there is just some editing, retry it after 5 seconds." |
| @@ -5147,6 +5148,7 @@ If there is just some editing, retry it after 5 seconds." | |||
| 5147 | Does not do anything if a connection is already open, but re-opens the | 5148 | Does not do anything if a connection is already open, but re-opens the |
| 5148 | connection if a previous connection has died for some reason." | 5149 | connection if a previous connection has died for some reason." |
| 5149 | ;; During completion, don't reopen a new connection. | 5150 | ;; During completion, don't reopen a new connection. |
| 5151 | ;; Same for slide-in timer or process-{filter,sentinel}. | ||
| 5150 | (unless (tramp-connectable-p vec) | 5152 | (unless (tramp-connectable-p vec) |
| 5151 | (throw 'non-essential 'non-essential)) | 5153 | (throw 'non-essential 'non-essential)) |
| 5152 | 5154 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e0e080021c7..c72ccc1738f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2098,10 +2098,11 @@ does not exist, otherwise propagate the error." | |||
| 2098 | (declare (indent 2) (debug (symbolp form body))) | 2098 | (declare (indent 2) (debug (symbolp form body))) |
| 2099 | (let ((err (make-symbol "err"))) | 2099 | (let ((err (make-symbol "err"))) |
| 2100 | `(condition-case ,err | 2100 | `(condition-case ,err |
| 2101 | (progn ,@body) | 2101 | (let (signal-hook-function) ,@body) |
| 2102 | (error | 2102 | (error |
| 2103 | (if (not (or (file-exists-p ,filename) (file-symlink-p ,filename))) | 2103 | (if (not (or (file-exists-p ,filename) (file-symlink-p ,filename))) |
| 2104 | (tramp-error ,vec 'file-missing ,filename) | 2104 | (when (tramp-connectable-p ,vec) |
| 2105 | (tramp-error ,vec 'file-missing ,filename)) | ||
| 2105 | (signal (car ,err) (cdr ,err))))))) | 2106 | (signal (car ,err) (cdr ,err))))))) |
| 2106 | 2107 | ||
| 2107 | ;; This function provides traces in case of errors not triggered by | 2108 | ;; This function provides traces in case of errors not triggered by |
| @@ -2542,7 +2543,7 @@ Fall back to normal file name handler if no Tramp file name handler exists." | |||
| 2542 | (tramp-message | 2543 | (tramp-message |
| 2543 | v 5 "Non-essential received in operation %s" | 2544 | v 5 "Non-essential received in operation %s" |
| 2544 | (cons operation args)) | 2545 | (cons operation args)) |
| 2545 | (let ((tramp-verbose 10)) (tramp-backtrace v)) | 2546 | (tramp-backtrace v) |
| 2546 | (tramp-run-real-handler operation args)) | 2547 | (tramp-run-real-handler operation args)) |
| 2547 | ((eq result 'suppress) | 2548 | ((eq result 'suppress) |
| 2548 | (let ((inhibit-message t)) | 2549 | (let ((inhibit-message t)) |
| @@ -2759,13 +2760,15 @@ They are completed by `M-x TAB' only if the current buffer is remote." | |||
| 2759 | "Check if it is possible to connect the remote host without side-effects. | 2760 | "Check if it is possible to connect the remote host without side-effects. |
| 2760 | This is true, if either the remote host is already connected, or if we are | 2761 | This is true, if either the remote host is already connected, or if we are |
| 2761 | not in completion mode." | 2762 | not in completion mode." |
| 2762 | (let ((tramp-verbose 0) | 2763 | (or (not non-essential) |
| 2763 | (vec (tramp-ensure-dissected-file-name vec-or-filename))) | 2764 | ;; We check this for the process related to `tramp-buffer-name'; |
| 2764 | (or ;; We check this for the process related to | 2765 | ;; otherwise `make-process' wouldn't run ever when |
| 2765 | ;; `tramp-buffer-name'; otherwise `make-process' wouldn't run | 2766 | ;; `non-essential' is non-nil. |
| 2766 | ;; ever when `non-essential' is non-nil. | 2767 | (and-let* ((tramp-verbose 0) |
| 2767 | (process-live-p (tramp-get-process vec)) | 2768 | (vec (tramp-ensure-dissected-file-name vec-or-filename)) |
| 2768 | (not non-essential)))) | 2769 | (p (tramp-get-process vec)) |
| 2770 | ((process-live-p p)) | ||
| 2771 | ((tramp-get-connection-property p "connected")))))) | ||
| 2769 | 2772 | ||
| 2770 | (defun tramp-completion-handle-expand-file-name (filename &optional directory) | 2773 | (defun tramp-completion-handle-expand-file-name (filename &optional directory) |
| 2771 | "Like `expand-file-name' for partial Tramp files." | 2774 | "Like `expand-file-name' for partial Tramp files." |
| @@ -2863,7 +2866,7 @@ not in completion mode." | |||
| 2863 | BODY is the backend specific code." | 2866 | BODY is the backend specific code." |
| 2864 | (declare (indent 2) (debug t)) | 2867 | (declare (indent 2) (debug t)) |
| 2865 | `(ignore-error file-missing | 2868 | `(ignore-error file-missing |
| 2866 | (delete-dups (delq nil | 2869 | (delete-dups (delq nil (delete "" |
| 2867 | (let* ((case-fold-search read-file-name-completion-ignore-case) | 2870 | (let* ((case-fold-search read-file-name-completion-ignore-case) |
| 2868 | (result (progn ,@body))) | 2871 | (result (progn ,@body))) |
| 2869 | ;; Some storage systems do not return "." and "..". | 2872 | ;; Some storage systems do not return "." and "..". |
| @@ -2880,7 +2883,7 @@ BODY is the backend specific code." | |||
| 2880 | (dolist (elt completion-regexp-list x) | 2883 | (dolist (elt completion-regexp-list x) |
| 2881 | (unless (string-match-p elt x) (throw 'match nil)))))) | 2884 | (unless (string-match-p elt x) (throw 'match nil)))))) |
| 2882 | result) | 2885 | result) |
| 2883 | result)))))) | 2886 | result))))))) |
| 2884 | 2887 | ||
| 2885 | (defvar tramp--last-hop-directory nil | 2888 | (defvar tramp--last-hop-directory nil |
| 2886 | "Tracks the directory from which to run login programs.") | 2889 | "Tracks the directory from which to run login programs.") |
| @@ -3434,79 +3437,69 @@ BODY is the backend specific code." | |||
| 3434 | "Skeleton for `tramp-*-handle-directory-files'. | 3437 | "Skeleton for `tramp-*-handle-directory-files'. |
| 3435 | BODY is the backend specific code." | 3438 | BODY is the backend specific code." |
| 3436 | (declare (indent 5) (debug t)) | 3439 | (declare (indent 5) (debug t)) |
| 3437 | `(or | 3440 | `(with-parsed-tramp-file-name (expand-file-name ,directory) nil |
| 3438 | (with-parsed-tramp-file-name (expand-file-name ,directory) nil | 3441 | (tramp-barf-if-file-missing v ,directory |
| 3439 | (tramp-barf-if-file-missing v ,directory | 3442 | (if (not (file-directory-p ,directory)) |
| 3440 | (when (file-directory-p ,directory) | 3443 | ;; Trigger the `file-missing' error. |
| 3441 | (setf ,directory | 3444 | (signal 'error nil) |
| 3442 | (file-name-as-directory (expand-file-name ,directory))) | 3445 | (setf ,directory |
| 3443 | (let ((temp | 3446 | (file-name-as-directory (expand-file-name ,directory))) |
| 3444 | (with-tramp-file-property v localname "directory-files" ,@body)) | 3447 | (let ((temp |
| 3445 | result item) | 3448 | (with-tramp-file-property v localname "directory-files" ,@body)) |
| 3446 | (while temp | 3449 | result item) |
| 3447 | (setq item (directory-file-name (pop temp))) | 3450 | (while temp |
| 3448 | (when (or (null ,match) (string-match-p ,match item)) | 3451 | (setq item (directory-file-name (pop temp))) |
| 3449 | (push (if ,full (concat ,directory item) item) | 3452 | (when (or (null ,match) (string-match-p ,match item)) |
| 3450 | result))) | 3453 | (push (if ,full (concat ,directory item) item) |
| 3451 | (unless ,nosort | 3454 | result))) |
| 3452 | (setq result (sort result #'string<))) | 3455 | (unless ,nosort |
| 3453 | (when (and (natnump ,count) (> ,count 0)) | 3456 | (setq result (sort result #'string<))) |
| 3454 | (setq result (tramp-compat-ntake ,count result))) | 3457 | (when (and (natnump ,count) (> ,count 0)) |
| 3455 | result)))) | 3458 | (setq result (tramp-compat-ntake ,count result))) |
| 3456 | 3459 | result))))) | |
| 3457 | ;; Error handling. | ||
| 3458 | (if (not (file-exists-p ,directory)) | ||
| 3459 | (tramp-error | ||
| 3460 | (tramp-dissect-file-name ,directory) 'file-missing ,directory) | ||
| 3461 | nil))) | ||
| 3462 | 3460 | ||
| 3463 | (defmacro tramp-skeleton-directory-files-and-attributes | 3461 | (defmacro tramp-skeleton-directory-files-and-attributes |
| 3464 | (directory &optional full match nosort id-format count &rest body) | 3462 | (directory &optional full match nosort id-format count &rest body) |
| 3465 | "Skeleton for `tramp-*-handle-directory-files-and-attributes'. | 3463 | "Skeleton for `tramp-*-handle-directory-files-and-attributes'. |
| 3466 | BODY is the backend specific code." | 3464 | BODY is the backend specific code." |
| 3467 | (declare (indent 6) (debug t)) | 3465 | (declare (indent 6) (debug t)) |
| 3468 | `(or | 3466 | `(with-parsed-tramp-file-name (expand-file-name ,directory) nil |
| 3469 | (with-parsed-tramp-file-name (expand-file-name ,directory) nil | 3467 | (tramp-barf-if-file-missing v ,directory |
| 3470 | (tramp-barf-if-file-missing v ,directory | 3468 | (if (not (file-directory-p ,directory)) |
| 3471 | (when (file-directory-p ,directory) | 3469 | ;; Trigger the `file-missing' error. |
| 3472 | (let ((temp | 3470 | (signal 'error nil) |
| 3473 | (copy-tree | 3471 | (let ((temp |
| 3474 | (mapcar | 3472 | (copy-tree |
| 3475 | (lambda (x) | 3473 | (mapcar |
| 3476 | (cons | 3474 | (lambda (x) |
| 3477 | (car x) | 3475 | (cons |
| 3478 | (tramp-convert-file-attributes | 3476 | (car x) |
| 3479 | v (expand-file-name (car x) localname) | 3477 | (tramp-convert-file-attributes |
| 3480 | ,id-format (cdr x)))) | 3478 | v (expand-file-name (car x) localname) |
| 3481 | (with-tramp-file-property | 3479 | ,id-format (cdr x)))) |
| 3482 | v localname "directory-files-and-attributes" | 3480 | (with-tramp-file-property |
| 3483 | ,@body)))) | 3481 | v localname "directory-files-and-attributes" |
| 3484 | result item) | 3482 | ,@body)))) |
| 3485 | 3483 | result item) | |
| 3486 | (while temp | 3484 | |
| 3487 | (setq item (pop temp)) | 3485 | (while temp |
| 3488 | (when (or (null ,match) (string-match-p ,match (car item))) | 3486 | (setq item (pop temp)) |
| 3489 | (when ,full | 3487 | (when (or (null ,match) (string-match-p ,match (car item))) |
| 3490 | (setcar item (expand-file-name (car item) ,directory))) | 3488 | (when ,full |
| 3491 | (push item result))) | 3489 | (setcar item (expand-file-name (car item) ,directory))) |
| 3492 | 3490 | (push item result))) | |
| 3493 | (unless ,nosort | 3491 | |
| 3494 | (setq result | 3492 | (unless ,nosort |
| 3495 | (sort result (lambda (x y) (string< (car x) (car y)))))) | 3493 | (setq result |
| 3496 | 3494 | (sort result (lambda (x y) (string< (car x) (car y)))))) | |
| 3497 | (when (and (natnump ,count) (> ,count 0)) | 3495 | |
| 3498 | (setq result (tramp-compat-ntake ,count result))) | 3496 | (when (and (natnump ,count) (> ,count 0)) |
| 3499 | 3497 | (setq result (tramp-compat-ntake ,count result))) | |
| 3500 | (or result | 3498 | |
| 3501 | ;; The scripts could fail, for example with huge file size. | 3499 | (or result |
| 3502 | (tramp-handle-directory-files-and-attributes | 3500 | ;; The scripts could fail, for example with huge file size. |
| 3503 | ,directory ,full ,match ,nosort ,id-format ,count)))))) | 3501 | (tramp-handle-directory-files-and-attributes |
| 3504 | 3502 | ,directory ,full ,match ,nosort ,id-format ,count))))))) | |
| 3505 | ;; Error handling. | ||
| 3506 | (if (not (file-exists-p ,directory)) | ||
| 3507 | (tramp-error | ||
| 3508 | (tramp-dissect-file-name ,directory) 'file-missing ,directory) | ||
| 3509 | nil))) | ||
| 3510 | 3503 | ||
| 3511 | (defcustom tramp-use-file-attributes t | 3504 | (defcustom tramp-use-file-attributes t |
| 3512 | "Whether to use \"file-attributes\" connection property for check. | 3505 | "Whether to use \"file-attributes\" connection property for check. |
| @@ -3810,20 +3803,23 @@ BODY is the backend specific code." | |||
| 3810 | BODY is the backend specific code." | 3803 | BODY is the backend specific code." |
| 3811 | (declare (indent 1) (debug t)) | 3804 | (declare (indent 1) (debug t)) |
| 3812 | `(with-parsed-tramp-file-name (expand-file-name ,filename) nil | 3805 | `(with-parsed-tramp-file-name (expand-file-name ,filename) nil |
| 3813 | (when (not (file-exists-p ,filename)) | 3806 | (tramp-barf-if-file-missing v ,filename |
| 3814 | (tramp-error v 'file-missing ,filename)) | 3807 | (if (not (file-exists-p ,filename)) |
| 3815 | (with-tramp-saved-file-properties | 3808 | ;; Trigger the `file-missing' error. |
| 3816 | v localname | 3809 | (signal 'error nil) |
| 3817 | ;; We cannot add "file-attributes", "file-executable-p", | 3810 | (with-tramp-saved-file-properties |
| 3818 | ;; "file-ownership-preserved-p", "file-readable-p", | 3811 | v localname |
| 3819 | ;; "file-writable-p". | 3812 | ;; We cannot add "file-attributes", "file-executable-p", |
| 3820 | '("file-directory-p" "file-exists-p" "file-symlink-p" "file-truename") | 3813 | ;; "file-ownership-preserved-p", "file-readable-p", |
| 3821 | (tramp-flush-file-properties v localname)) | 3814 | ;; "file-writable-p". |
| 3822 | (condition-case err | 3815 | '("file-directory-p" "file-exists-p" |
| 3823 | (progn ,@body) | 3816 | "file-symlink-p" "file-truename") |
| 3824 | (error (if tramp-inhibit-errors-if-setting-file-attributes-fail | 3817 | (tramp-flush-file-properties v localname)) |
| 3825 | (display-warning 'tramp (error-message-string err)) | 3818 | (condition-case err |
| 3826 | (signal (car err) (cdr err))))))) | 3819 | (progn ,@body) |
| 3820 | (error (if tramp-inhibit-errors-if-setting-file-attributes-fail | ||
| 3821 | (display-warning 'tramp (error-message-string err)) | ||
| 3822 | (signal (car err) (cdr err))))))))) | ||
| 3827 | 3823 | ||
| 3828 | (defmacro tramp-skeleton-write-region | 3824 | (defmacro tramp-skeleton-write-region |
| 3829 | (start end filename append visit lockname mustbenew &rest body) | 3825 | (start end filename append visit lockname mustbenew &rest body) |
| @@ -4013,9 +4009,7 @@ Let-bind it when necessary.") | |||
| 4013 | (tramp-dont-suspend-timers t)) | 4009 | (tramp-dont-suspend-timers t)) |
| 4014 | (with-tramp-timeout | 4010 | (with-tramp-timeout |
| 4015 | (timeout | 4011 | (timeout |
| 4016 | (unless (and-let* ((p (tramp-get-connection-process v)) | 4012 | (unless (and (not non-essential) (tramp-connectable-p v)) |
| 4017 | ((process-live-p p)) | ||
| 4018 | ((tramp-get-connection-property p "connected")))) | ||
| 4019 | (tramp-cleanup-connection v 'keep-debug 'keep-password)) | 4013 | (tramp-cleanup-connection v 'keep-debug 'keep-password)) |
| 4020 | (tramp-error | 4014 | (tramp-error |
| 4021 | v 'file-error | 4015 | v 'file-error |
| @@ -4901,6 +4895,7 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") | |||
| 4901 | ;; functions like `kill-buffer' would try to reestablish the | 4895 | ;; functions like `kill-buffer' would try to reestablish the |
| 4902 | ;; connection. See Bug#61663. | 4896 | ;; connection. See Bug#61663. |
| 4903 | (if-let* ((v (tramp-dissect-file-name file)) | 4897 | (if-let* ((v (tramp-dissect-file-name file)) |
| 4898 | ((tramp-connectable-p v)) | ||
| 4904 | ((process-live-p (tramp-get-process v))) | 4899 | ((process-live-p (tramp-get-process v))) |
| 4905 | (lockname (tramp-compat-make-lock-file-name file))) | 4900 | (lockname (tramp-compat-make-lock-file-name file))) |
| 4906 | (delete-file lockname) | 4901 | (delete-file lockname) |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 2b2fdf94a49..af6d52c4ae6 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Maintainer: Michael Albinus <michael.albinus@gmx.de> | 7 | ;; Maintainer: Michael Albinus <michael.albinus@gmx.de> |
| 8 | ;; Keywords: comm, processes | 8 | ;; Keywords: comm, processes |
| 9 | ;; Package: tramp | 9 | ;; Package: tramp |
| 10 | ;; Version: 2.7.3.30.2 | 10 | ;; Version: 2.7.4-pre |
| 11 | ;; Package-Requires: ((emacs "27.1")) | 11 | ;; Package-Requires: ((emacs "27.1")) |
| 12 | ;; Package-Type: multi | 12 | ;; Package-Type: multi |
| 13 | ;; URL: https://www.gnu.org/software/tramp/ | 13 | ;; URL: https://www.gnu.org/software/tramp/ |
| @@ -40,7 +40,7 @@ | |||
| 40 | ;; ./configure" to change them. | 40 | ;; ./configure" to change them. |
| 41 | 41 | ||
| 42 | ;;;###tramp-autoload | 42 | ;;;###tramp-autoload |
| 43 | (defconst tramp-version "2.7.3.30.2" | 43 | (defconst tramp-version "2.7.4-pre" |
| 44 | "This version of Tramp.") | 44 | "This version of Tramp.") |
| 45 | 45 | ||
| 46 | ;;;###tramp-autoload | 46 | ;;;###tramp-autoload |
| @@ -76,7 +76,7 @@ | |||
| 76 | ;; Check for Emacs version. | 76 | ;; Check for Emacs version. |
| 77 | (let ((x (if (not (string-version-lessp emacs-version "27.1")) | 77 | (let ((x (if (not (string-version-lessp emacs-version "27.1")) |
| 78 | "ok" | 78 | "ok" |
| 79 | (format "Tramp 2.7.3.30.2 is not fit for %s" | 79 | (format "Tramp 2.7.4-pre is not fit for %s" |
| 80 | (replace-regexp-in-string "\n" "" (emacs-version)))))) | 80 | (replace-regexp-in-string "\n" "" (emacs-version)))))) |
| 81 | (unless (string-equal "ok" x) (error "%s" x))) | 81 | (unless (string-equal "ok" x) (error "%s" x))) |
| 82 | 82 | ||
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 4fe3fca0df8..3013a63e041 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | (require 'vc-git) | 54 | (require 'vc-git) |
| 55 | (require 'vc-hg) | 55 | (require 'vc-hg) |
| 56 | 56 | ||
| 57 | (declare-function project-mode-line-format "project") | ||
| 57 | (declare-function tramp-check-remote-uname "tramp-sh") | 58 | (declare-function tramp-check-remote-uname "tramp-sh") |
| 58 | (declare-function tramp-find-executable "tramp-sh") | 59 | (declare-function tramp-find-executable "tramp-sh") |
| 59 | (declare-function tramp-get-remote-chmod-h "tramp-sh") | 60 | (declare-function tramp-get-remote-chmod-h "tramp-sh") |
| @@ -82,6 +83,7 @@ | |||
| 82 | (defvar dired-copy-dereference) | 83 | (defvar dired-copy-dereference) |
| 83 | 84 | ||
| 84 | ;; Declared in Emacs 30. | 85 | ;; Declared in Emacs 30. |
| 86 | (defvar project-mode-line) | ||
| 85 | (defvar remote-file-name-access-timeout) | 87 | (defvar remote-file-name-access-timeout) |
| 86 | (defvar remote-file-name-inhibit-delete-by-moving-to-trash) | 88 | (defvar remote-file-name-inhibit-delete-by-moving-to-trash) |
| 87 | 89 | ||
| @@ -8349,8 +8351,53 @@ process sentinels. They shall not disturb each other." | |||
| 8349 | tramp-use-fingerprint) | 8351 | tramp-use-fingerprint) |
| 8350 | (should (file-exists-p ert-remote-temporary-file-directory))))) | 8352 | (should (file-exists-p ert-remote-temporary-file-directory))))) |
| 8351 | 8353 | ||
| 8354 | ;; This test is inspired by Bug#78572. | ||
| 8355 | (ert-deftest tramp-test48-session-timeout () | ||
| 8356 | "Check that Tramp handles a session timeout properly." | ||
| 8357 | (skip-unless (tramp--test-enabled)) | ||
| 8358 | (skip-unless | ||
| 8359 | (tramp-get-method-parameter tramp-test-vec 'tramp-session-timeout)) | ||
| 8360 | |||
| 8361 | ;; We want to see the timeout message. | ||
| 8362 | (tramp--test-instrument-test-case 3 | ||
| 8363 | (let ((remote-file-name-inhibit-cache t) | ||
| 8364 | (tmp-name (tramp--test-make-temp-name))) | ||
| 8365 | (unwind-protect | ||
| 8366 | (progn | ||
| 8367 | (should-not (file-exists-p tmp-name)) | ||
| 8368 | (write-region "foo" nil tmp-name) | ||
| 8369 | (should (file-exists-p tmp-name)) | ||
| 8370 | |||
| 8371 | (tramp-timeout-session tramp-test-vec) | ||
| 8372 | (should (file-exists-p tmp-name)) | ||
| 8373 | (should (directory-files (file-name-directory tmp-name))) | ||
| 8374 | |||
| 8375 | ;; `project-mode-line' was introduced in Emacs 30.1. | ||
| 8376 | (when (boundp 'project-mode-line) | ||
| 8377 | (require 'project) | ||
| 8378 | (ert-with-message-capture captured-messages | ||
| 8379 | (let ((project-mode-line t)) | ||
| 8380 | (with-temp-buffer | ||
| 8381 | (set-visited-file-name tmp-name) | ||
| 8382 | (insert "foo") | ||
| 8383 | (should (buffer-modified-p)) | ||
| 8384 | (tramp-timeout-session tramp-test-vec) | ||
| 8385 | ;; This calls `file-directory-p' and | ||
| 8386 | ;; `directory-files'. Shouldn't raise an error when | ||
| 8387 | ;; not connected. | ||
| 8388 | (project-mode-line-format) | ||
| 8389 | ;; Steal the file lock. | ||
| 8390 | (cl-letf (((symbol-function #'ask-user-about-lock) | ||
| 8391 | #'tramp-compat-always)) | ||
| 8392 | (save-buffer))) | ||
| 8393 | (should-not | ||
| 8394 | (string-match-p "File is missing:" captured-messages)))))) | ||
| 8395 | |||
| 8396 | ;; Cleanup. | ||
| 8397 | (ignore-errors (delete-file tmp-name)))))) | ||
| 8398 | |||
| 8352 | ;; This test is inspired by Bug#29163. | 8399 | ;; This test is inspired by Bug#29163. |
| 8353 | (ert-deftest tramp-test48-auto-load () | 8400 | (ert-deftest tramp-test49-auto-load () |
| 8354 | "Check that Tramp autoloads properly." | 8401 | "Check that Tramp autoloads properly." |
| 8355 | ;; If we use another syntax but `default', Tramp is already loaded | 8402 | ;; If we use another syntax but `default', Tramp is already loaded |
| 8356 | ;; due to the `tramp-change-syntax' call. | 8403 | ;; due to the `tramp-change-syntax' call. |
| @@ -8375,7 +8422,7 @@ process sentinels. They shall not disturb each other." | |||
| 8375 | (mapconcat #'shell-quote-argument load-path " -L ") | 8422 | (mapconcat #'shell-quote-argument load-path " -L ") |
| 8376 | (shell-quote-argument code))))))) | 8423 | (shell-quote-argument code))))))) |
| 8377 | 8424 | ||
| 8378 | (ert-deftest tramp-test48-delay-load () | 8425 | (ert-deftest tramp-test49-delay-load () |
| 8379 | "Check that Tramp is loaded lazily, only when needed." | 8426 | "Check that Tramp is loaded lazily, only when needed." |
| 8380 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | 8427 | ;; Tramp is neither loaded at Emacs startup, nor when completing a |
| 8381 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file | 8428 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file |
| @@ -8405,7 +8452,7 @@ process sentinels. They shall not disturb each other." | |||
| 8405 | (mapconcat #'shell-quote-argument load-path " -L ") | 8452 | (mapconcat #'shell-quote-argument load-path " -L ") |
| 8406 | (shell-quote-argument (format code tm))))))))) | 8453 | (shell-quote-argument (format code tm))))))))) |
| 8407 | 8454 | ||
| 8408 | (ert-deftest tramp-test48-recursive-load () | 8455 | (ert-deftest tramp-test49-recursive-load () |
| 8409 | "Check that Tramp does not fail due to recursive load." | 8456 | "Check that Tramp does not fail due to recursive load." |
| 8410 | (skip-unless (tramp--test-enabled)) | 8457 | (skip-unless (tramp--test-enabled)) |
| 8411 | 8458 | ||
| @@ -8429,7 +8476,7 @@ process sentinels. They shall not disturb each other." | |||
| 8429 | (mapconcat #'shell-quote-argument load-path " -L ") | 8476 | (mapconcat #'shell-quote-argument load-path " -L ") |
| 8430 | (shell-quote-argument code)))))))) | 8477 | (shell-quote-argument code)))))))) |
| 8431 | 8478 | ||
| 8432 | (ert-deftest tramp-test48-remote-load-path () | 8479 | (ert-deftest tramp-test49-remote-load-path () |
| 8433 | "Check that Tramp autoloads its packages with remote `load-path'." | 8480 | "Check that Tramp autoloads its packages with remote `load-path'." |
| 8434 | ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. | 8481 | ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. |
| 8435 | ;; It shall still work, when a remote file name is in the | 8482 | ;; It shall still work, when a remote file name is in the |
| @@ -8454,7 +8501,7 @@ process sentinels. They shall not disturb each other." | |||
| 8454 | (mapconcat #'shell-quote-argument load-path " -L ") | 8501 | (mapconcat #'shell-quote-argument load-path " -L ") |
| 8455 | (shell-quote-argument code))))))) | 8502 | (shell-quote-argument code))))))) |
| 8456 | 8503 | ||
| 8457 | (ert-deftest tramp-test49-without-remote-files () | 8504 | (ert-deftest tramp-test50-without-remote-files () |
| 8458 | "Check that Tramp can be suppressed." | 8505 | "Check that Tramp can be suppressed." |
| 8459 | (skip-unless (tramp--test-enabled)) | 8506 | (skip-unless (tramp--test-enabled)) |
| 8460 | 8507 | ||
| @@ -8469,7 +8516,7 @@ process sentinels. They shall not disturb each other." | |||
| 8469 | (setq tramp-mode t) | 8516 | (setq tramp-mode t) |
| 8470 | (should (file-remote-p ert-remote-temporary-file-directory))) | 8517 | (should (file-remote-p ert-remote-temporary-file-directory))) |
| 8471 | 8518 | ||
| 8472 | (ert-deftest tramp-test50-unload () | 8519 | (ert-deftest tramp-test51-unload () |
| 8473 | "Check that Tramp and its subpackages unload completely. | 8520 | "Check that Tramp and its subpackages unload completely. |
| 8474 | Since it unloads Tramp, it shall be the last test to run." | 8521 | Since it unloads Tramp, it shall be the last test to run." |
| 8475 | :tags '(:expensive-test) | 8522 | :tags '(:expensive-test) |