]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix some Tramp oddities
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 21 May 2024 16:13:40 +0000 (18:13 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 May 2024 08:29:43 +0000 (10:29 +0200)
* lisp/net/tramp-container.el: Move connection-local settings
where they belong to.

* lisp/net/tramp-sshfs.el (tramp-connection-properties): Do not
set connection property "direct-async-process".
(tramp-direct-async-process): Set connection-local value.

* test/lisp/net/tramp-tests.el (comp-warn-primitives): Declare.
(tramp-test18-file-attributes): Use it.

(cherry picked from commit 9aeb4872d473695b75a27184b7e90868c15242c9)

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

index 3d15d71d7095e74422ce066dea27d1beddc9d28e..2886e25d16bd2c308cacbc63d2c4ce5ae4a054f1 100644 (file)
@@ -554,7 +554,25 @@ see its function help for a description of the format."
 
  (tramp-set-completion-function
   tramp-kubernetes-method
-  `((tramp-kubernetes--completion-function ,tramp-kubernetes-method))))
+  `((tramp-kubernetes--completion-function ,tramp-kubernetes-method)))
+
+ (defconst tramp-kubernetes-connection-local-default-variables
+   '((tramp-config-check . tramp-kubernetes--current-context-data)
+     ;; This variable will be eval'ed in `tramp-expand-args'.
+     (tramp-extra-expand-args
+      . (?a (tramp-kubernetes--container (car tramp-current-connection))
+           ?h (tramp-kubernetes--pod (car tramp-current-connection))
+           ?x (tramp-kubernetes--context-namespace
+               (car tramp-current-connection)))))
+   "Default connection-local variables for remote kubernetes connections.")
+
+ (connection-local-set-profile-variables
+  'tramp-kubernetes-connection-local-default-profile
+  tramp-kubernetes-connection-local-default-variables)
+
+ (connection-local-set-profiles
+  `(:application tramp :protocol ,tramp-kubernetes-method)
+  'tramp-kubernetes-connection-local-default-profile))
 
 ;;;###tramp-autoload
 (defun tramp-enable-toolbox-method ()
@@ -595,7 +613,19 @@ see its function help for a description of the format."
 
   (tramp-set-completion-function
    tramp-flatpak-method
-   `((tramp-flatpak--completion-function ,tramp-flatpak-method))))
+   `((tramp-flatpak--completion-function ,tramp-flatpak-method)))
+
+  (defconst tramp-flatpak-connection-local-default-variables
+    `((tramp-remote-path  . ,(cons "/app/bin" tramp-remote-path)))
+    "Default connection-local variables for remote flatpak connections.")
+
+  (connection-local-set-profile-variables
+   'tramp-flatpak-connection-local-default-profile
+   tramp-flatpak-connection-local-default-variables)
+
+  (connection-local-set-profiles
+   `(:application tramp :protocol ,tramp-flatpak-method)
+   'tramp-flatpak-connection-local-default-profile))
 
 ;;;###tramp-autoload
 (defun tramp-enable-apptainer-method ()
@@ -638,38 +668,6 @@ see its function help for a description of the format."
    tramp-nspawn-method
    `((tramp-nspawn--completion-function ,tramp-nspawn-method))))
 
-;; Default connection-local variables for Tramp.
-
-(defconst tramp-kubernetes-connection-local-default-variables
-  '((tramp-config-check . tramp-kubernetes--current-context-data)
-    ;; This variable will be eval'ed in `tramp-expand-args'.
-    (tramp-extra-expand-args
-     . (?a (tramp-kubernetes--container (car tramp-current-connection))
-       ?h (tramp-kubernetes--pod (car tramp-current-connection))
-       ?x (tramp-kubernetes--context-namespace
-           (car tramp-current-connection)))))
-  "Default connection-local variables for remote kubernetes connections.")
-
-(connection-local-set-profile-variables
- 'tramp-kubernetes-connection-local-default-profile
- tramp-kubernetes-connection-local-default-variables)
-
-(connection-local-set-profiles
- `(:application tramp :protocol ,tramp-kubernetes-method)
- 'tramp-kubernetes-connection-local-default-profile)
-
-(defconst tramp-flatpak-connection-local-default-variables
-  `((tramp-remote-path  . ,(cons "/app/bin" tramp-remote-path)))
-  "Default connection-local variables for remote flatpak connections.")
-
-(connection-local-set-profile-variables
- 'tramp-flatpak-connection-local-default-profile
- tramp-flatpak-connection-local-default-variables)
-
-(connection-local-set-profiles
- `(:application tramp :protocol ,tramp-flatpak-method)
- 'tramp-flatpak-connection-local-default-profile)
-
 (add-hook 'tramp-unload-hook
          (lambda ()
            (unload-feature 'tramp-container 'force)))
index d0d56b8967e2f4131485c326ce085c1fad4dd7fc..218cf30dea5154e19a6758c2df91235bc536a220 100644 (file)
@@ -67,9 +67,6 @@
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))))
 
- (add-to-list 'tramp-connection-properties
-             `(,(format "/%s:" tramp-sshfs-method) "direct-async-process" t))
-
  (tramp-set-completion-function
   tramp-sshfs-method tramp-completion-function-alist-ssh))
 
@@ -445,6 +442,16 @@ connection if a previous connection has died for some reason."
     (with-tramp-connection-property
        vec "gid-string" (tramp-get-local-gid 'string))))
 
+;; Default connection-local variables for Tramp.
+
+(connection-local-set-profile-variables
+ 'tramp-sshfs-connection-local-default-profile
+ '((tramp-direct-async-process t)))
+
+(connection-local-set-profiles
+ `(:application tramp :protocol ,tramp-sshfs-method)
+ 'tramp-sshfs-connection-local-default-profile)
+
 ;; `shell-mode' tries to open remote files like "/sshfs:user@host:~/.history".
 ;; This fails, because the tilde cannot be expanded.  Tell
 ;; `tramp-handle-expand-file-name' to tolerate this.
index 63c1428863dcda6960e9232f48032409852dd881..6932bbdc4fecfa05f38a03bf2855cb8bb7a05589 100644 (file)
@@ -64,6 +64,7 @@
 (declare-function tramp-method-out-of-band-p "tramp-sh")
 (declare-function tramp-smb-get-localname "tramp-smb")
 (defvar ange-ftp-make-backup-files)
+(defvar comp-warn-primitives)
 (defvar tramp-connection-properties)
 (defvar tramp-copy-size-limit)
 (defvar tramp-fuse-remove-hidden-files)
@@ -3689,7 +3690,8 @@ This tests also `access-file', `file-readable-p',
            ;; `access-file' returns nil in case of success.
            (should-not (access-file tmp-name1 "error"))
            ;; `access-file' could use a timeout.
-           (let ((remote-file-name-access-timeout 1))
+           (let ((remote-file-name-access-timeout 1)
+                 comp-warn-primitives)
              (cl-letf (((symbol-function #'file-exists-p)
                         (lambda (_filename) (sleep-for 5))))
                (should-error