With some debugging I've found out that tramp has the correct path if you:
- have tramp-own-remote-path in tramp-remote-path - don't pass the `-l` tramp-login-argument up until line 5538 of tramp-sh.el of tramp 2.7.0-pre Here's a snippet for context of that part of `tramp-get-remote-path`: ``` ;; Remove double entries. (setq elt1 remote-path) (while (consp elt1) (while (and (car elt1) (setq elt2 (member (car elt1) (cdr elt1)))) (setcar elt2 nil)) (setq elt1 (cdr elt1))) ``` It looks like this when tracing `tramp-send-command-and-read` and `tramp-get-remote-path`: ``` 1 -> (tramp-send-command-and-read (tramp-file-name "docker" nil nil "nifty_davinci" nil "" nil) "echo \\\"`uname -sr`\\\"") 1 <- tramp-send-command-and-read: "Linux 6.1.18" ====================================================================== 1 -> (tramp-get-remote-path (tramp-file-name "docker" nil nil "nifty_davinci" nil "" nil)) | 2 -> (tramp-send-command-and-read (tramp-file-name "docker" nil nil "nifty_davinci" nil "" nil) "/bin/sh -i -c 'echo 3530864d92d71ab02b08b4a1f9168a38 \\\"$PATH\\\"'" noerror "3530864d92d71ab02b08b4a1f9168a38") | 2 <- tramp-send-command-and-read: "/root/.cabal/bin:/root/.local/bin:/opt/ghc/9.4.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 1 <- tramp-get-remote-path: ("/opt/ghc/9.4.2/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin" "/sbin" "/bin") ====================================================================== ```