* tramp-sshfs doesn't seem to respect tramp-remote-path
@ 2024-07-30 13:22 Luiz Romário Santana Rios
2024-07-30 16:47 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Luiz Romário Santana Rios @ 2024-07-30 13:22 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
(Please cc me when replying, as I'm not subscribed to the list)
I've been trying out tramp-sshfs and it works fine, but for some reason
it doesn't seem to respect tramp-remote-path. My remote machine has a
very old git version so I needed to install a newer git elsewhere and
make the path point there for magit to work. Under tramp-ssh this works
fine, but it doesn't under tramp-sshfs (magit complains about the git
version).
Opening up eshell I noticed the following:
- git --version -> git version 1.8.3.1
- which git -> /sshfs:luizromario@remote-machine:/usr/bin/git
- echo $PATH -> /usr/bin
Is this a bug? Am I doing something wrong?
Thanks in advance
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-07-30 13:22 tramp-sshfs doesn't seem to respect tramp-remote-path Luiz Romário Santana Rios
@ 2024-07-30 16:47 ` Michael Albinus
2024-07-30 21:28 ` Luiz Romário Santana Rios
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2024-07-30 16:47 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Luiz Romário Santana Rios <luizromario@tecgraf.puc-rio.br> writes:
> Hello,
Hi,
> I've been trying out tramp-sshfs and it works fine, but for some
> reason it doesn't seem to respect tramp-remote-path. My remote machine
> has a very old git version so I needed to install a newer git
> elsewhere and make the path point there for magit to work. Under
> tramp-ssh this works fine, but it doesn't under tramp-sshfs (magit
> complains about the git version).
>
> Opening up eshell I noticed the following:
>
> - git --version -> git version 1.8.3.1
>
> - which git -> /sshfs:luizromario@remote-machine:/usr/bin/git
>
> - echo $PATH -> /usr/bin
>
> Is this a bug? Am I doing something wrong?
tramp-remote-path is used only for external processes of Tramp methods,
which are handled by tramp-sh-file-name-handler. That is, all methods
defined in tramp-sh.el and tramp-container.el.
> Thanks in advance
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-07-30 16:47 ` Michael Albinus
@ 2024-07-30 21:28 ` Luiz Romário Santana Rios
2024-07-31 11:47 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Luiz Romário Santana Rios @ 2024-07-30 21:28 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
Em 30/07/2024 13:47, Michael Albinus escreveu:
> tramp-remote-path is used only for external processes of Tramp methods,
> which are handled by tramp-sh-file-name-handler. That is, all methods
> defined in tramp-sh.el and tramp-container.el.
I think there's something wrong, then:
/sshfs:luizromario@remote-machine:/home/c/luizromario $ (exec-path)
("/usr/bin" "/home/c/luizromario/")
/sshfs:luizromario@remote-machine:/home/c/luizromario $
(tramp-sh-handle-exec-path)
("/home/c/luizromario/emacs/bin" "/home/c/luizromario/.local/bin" "/bin"
"/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin"
"/home/c/luizromario/")
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-07-30 21:28 ` Luiz Romário Santana Rios
@ 2024-07-31 11:47 ` Michael Albinus
2024-07-31 15:18 ` Luiz Romário Santana Rios
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2024-07-31 11:47 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Luiz Romário Santana Rios <luizromario@tecgraf.puc-rio.br> writes:
Hi,
> tramp-remote-path is used only for external processes of Tramp
> methods,
> which are handled by tramp-sh-file-name-handler. That is, all methods
> defined in tramp-sh.el and tramp-container.el.
>
> I think there's something wrong, then:
>
> /sshfs:luizromario@remote-machine:/home/c/luizromario $ (exec-path)
> ("/usr/bin" "/home/c/luizromario/")
> /sshfs:luizromario@remote-machine:/home/c/luizromario $
> (tramp-sh-handle-exec-path)
> ("/home/c/luizromario/emacs/bin" "/home/c/luizromario/.local/bin"
> "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin"
> "/usr/local/sbin" "/home/c/luizromario/")
tramp-sh-handle-exec-path is not used for the sshfs methods See
tramp-sshfs-file-name-handler-alist:
--8<---------------cut here---------------start------------->8---
(exec-path . tramp-sshfs-handle-exec-path)
--8<---------------cut here---------------end--------------->8---
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-07-31 11:47 ` Michael Albinus
@ 2024-07-31 15:18 ` Luiz Romário Santana Rios
2024-07-31 16:43 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Luiz Romário Santana Rios @ 2024-07-31 15:18 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
Em 31/07/2024 08:47, Michael Albinus escreveu:
> tramp-sh-handle-exec-path is not used for the sshfs methods See
> tramp-sshfs-file-name-handler-alist:
>
> --8<---------------cut here---------------start------------->8---
> (exec-path . tramp-sshfs-handle-exec-path)
> --8<---------------cut here---------------end--------------->8---
>
> Best regards, Michael.
Thanks for the answer.
How do I change the exec path for sshfs, then? Changing
tramp-remote-path was enough for tramp-ssh.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-07-31 15:18 ` Luiz Romário Santana Rios
@ 2024-07-31 16:43 ` Michael Albinus
2024-08-08 13:13 ` Luiz Romário Santana Rios
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2024-07-31 16:43 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Luiz Romário Santana Rios <luizromario@tecgraf.puc-rio.br> writes:
Hi,
> How do I change the exec path for sshfs, then? Changing
> tramp-remote-path was enough for tramp-ssh.
Not possible yet. You could write a wishlist request, via 'M-x report-emacs-bug'.
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-07-31 16:43 ` Michael Albinus
@ 2024-08-08 13:13 ` Luiz Romário Santana Rios
2024-08-08 13:30 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Luiz Romário Santana Rios @ 2024-08-08 13:13 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
Em 31/07/2024 13:43, Michael Albinus escreveu:
> Not possible yet. You could write a wishlist request, via 'M-x report-emacs-bug'.
>
> Best regards, Michael.
Thanks for the answer. I looked into this a little bit further and,
looking into the code for `tramp-sshfs-handle-exec-path`:
(defun tramp-sshfs-handle-exec-path ()
"Like `exec-path' for Tramp files."
(append
(with-parsed-tramp-file-name default-directory nil
(with-tramp-connection-property (tramp-get-process v) "remote-path"
(with-temp-buffer
(let (process-file-side-effects)
(process-file "getconf" nil t nil "PATH"))
;; ...
it seems to query the "remote-path" property. Only if the query fails,
does it get the default "PATH" variable from getconf (which is exactly
the "/bin:/usr/bin" I've been getting). Why does the query to
"remote-path" fail?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-08-08 13:13 ` Luiz Romário Santana Rios
@ 2024-08-08 13:30 ` Michael Albinus
2024-08-08 13:37 ` Luiz Romário Santana Rios
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2024-08-08 13:30 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Luiz Romário Santana Rios <luizromario@tecgraf.puc-rio.br> writes:
Hi,
> Thanks for the answer. I looked into this a little bit further and,
> looking into the code for `tramp-sshfs-handle-exec-path`:
>
> (defun tramp-sshfs-handle-exec-path ()
> "Like `exec-path' for Tramp files."
> (append
> (with-parsed-tramp-file-name default-directory nil
> (with-tramp-connection-property (tramp-get-process v) "remote-path"
> (with-temp-buffer
> (let (process-file-side-effects)
> (process-file "getconf" nil t nil "PATH"))
> ;; ...
>
> it seems to query the "remote-path" property. Only if the query fails,
> does it get the default "PATH" variable from getconf (which is exactly
> the "/bin:/usr/bin" I've been getting). Why does the query to
> "remote-path" fail?
The 'query the "remote-path" property' looks into the Tramp cache for
the given connection. If there is a value, it is used. Otherwise, the
code is executed, which is (process-file "getconf" nil t nil "PATH").
The result is stored in the cache; next time the function is called it
uses the cached result.
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-08-08 13:30 ` Michael Albinus
@ 2024-08-08 13:37 ` Luiz Romário Santana Rios
2024-08-08 14:23 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Luiz Romário Santana Rios @ 2024-08-08 13:37 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
Em 08/08/2024 10:30, Michael Albinus escreveu:
> The 'query the "remote-path" property' looks into the Tramp cache for
> the given connection. If there is a value, it is used. Otherwise, the
> code is executed, which is (process-file "getconf" nil t nil "PATH").
>
> The result is stored in the cache; next time the function is called it
> uses the cached result.
>
> Best regards, Michael.
Thanks for the explanation.
Any reason we couldn't just query `tramp-remote-path` instead of calling
getconf? I've been using eglot with sshfs for a while and it doesn't
seem to have any trouble calling a remote clangd process.
I'd be very interested in ironing out sshfs. I work remotely through an
ssh connection everyday and sshfs has greatly improved performance and
stability compared to the regular ssh, but this issue prevents me from
e.g. calling magit. I've never looked into emacs's code, but I know a
little emacs-lisp from writing my own .emacs file. Where do I look for
resources on adding support to `tramp-remote-path` on sshfs?
Regards, Romário.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-08-08 13:37 ` Luiz Romário Santana Rios
@ 2024-08-08 14:23 ` Michael Albinus
2024-08-08 15:18 ` Luiz Romário Santana Rios
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2024-08-08 14:23 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Luiz Romário Santana Rios <luizromario@tecgraf.puc-rio.br> writes:
Hi Romário,
> Thanks for the explanation.
>
> Any reason we couldn't just query `tramp-remote-path` instead of
> calling getconf? I've been using eglot with sshfs for a while and it
> doesn't seem to have any trouble calling a remote clangd process.
Because tramp-remote-path has some features which aren't well suited for
sshfs connections. For example, there are the tramp-default-remote-path
and tramp-own-remote-path symbols. Furthermore, Tramp applies a sanity
check when using it, and removes non-existing directories. And
tramp-remote-path is marked as connection-local variable, which isn't
supported in tramp-sshfs.el.
> I'd be very interested in ironing out sshfs. I work remotely through
> an ssh connection everyday and sshfs has greatly improved performance
> and stability compared to the regular ssh, but this issue prevents me
> from e.g. calling magit. I've never looked into emacs's code, but I
> know a little emacs-lisp from writing my own .emacs file. Where do I
> look for resources on adding support to `tramp-remote-path` on sshfs?
You might override tramp-sshfs-handle-exec-path with an own
implementation. Something like (untested)
--8<---------------cut here---------------start------------->8---
(with-eval-after-load 'tramp-sshfs
(add-function
:override (symbol-function #'tramp-sshfs-handle-exec-path)
(lambda ()
`("/bin" "/usr/bin"
;; The equivalent to `exec-directory'.
,(tramp-file-local-name (expand-file-name default-directory))))))
--8<---------------cut here---------------end--------------->8---
However, I don't know whether it works sufficiently. process-file for
remote sshfs processes uses the *local* call-process, so there might be
differences in used exec directories and program availability.
> Regards, Romário.
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-08-08 14:23 ` Michael Albinus
@ 2024-08-08 15:18 ` Luiz Romário Santana Rios
2024-08-08 15:24 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Luiz Romário Santana Rios @ 2024-08-08 15:18 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
Em 08/08/2024 11:23, Michael Albinus escreveu:
> process-file for
> remote sshfs processes uses the *local* call-process, so there might be
> differences in used exec directories and program availability.
Maybe I'm misunderstanding this, but wouldn't this mean remote binaries
would be executed locally? This is not what happens to me. As I
mentioned already, I'm able to run eglot+clangd with sshfs and it
executes in the remote machine. Same for compiling our application.
Thanks again for the answer.
Regards, Romário.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-08-08 15:18 ` Luiz Romário Santana Rios
@ 2024-08-08 15:24 ` Michael Albinus
2024-08-08 17:33 ` Michael Albinus
0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2024-08-08 15:24 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Luiz Romário Santana Rios <luizromario@tecgraf.puc-rio.br> writes:
Hi Romário,
>> process-file for
>> remote sshfs processes uses the *local* call-process, so there might be
>> differences in used exec directories and program availability.
>
> Maybe I'm misunderstanding this, but wouldn't this mean remote
> binaries would be executed locally? This is not what happens to me. As
> I mentioned already, I'm able to run eglot+clangd with sshfs and it
> executes in the remote machine. Same for compiling our application.
You're right. I did check tramp-sshfs-handle-process-file shortly, and
was confused by calling call-process. But this initiates a remote process.
Sorry.
> Thanks again for the answer.
>
> Regards, Romário.
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: tramp-sshfs doesn't seem to respect tramp-remote-path
2024-08-08 15:24 ` Michael Albinus
@ 2024-08-08 17:33 ` Michael Albinus
0 siblings, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2024-08-08 17:33 UTC (permalink / raw)
To: Luiz Romário Santana Rios; +Cc: help-gnu-emacs
Michael Albinus <michael.albinus@gmx.de> writes:
Hi Romário,
>> Maybe I'm misunderstanding this, but wouldn't this mean remote
>> binaries would be executed locally? This is not what happens to me. As
>> I mentioned already, I'm able to run eglot+clangd with sshfs and it
>> executes in the remote machine. Same for compiling our application.
>
> You're right. I did check tramp-sshfs-handle-process-file shortly, and
> was confused by calling call-process. But this initiates a remote process.
To be more precise: tramp-sshfs-handle-process-file uses call-process
for the remote process. But call-process doesn't know the function
(exec-path). Instead, it uses the variable exec-path for starting the
local process. No handling for the remote path.
If your problem is just the git program name, you might configure
magit-remote-git-executable to an absolute path.
Best regards, Michael.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-08-08 17:33 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 13:22 tramp-sshfs doesn't seem to respect tramp-remote-path Luiz Romário Santana Rios
2024-07-30 16:47 ` Michael Albinus
2024-07-30 21:28 ` Luiz Romário Santana Rios
2024-07-31 11:47 ` Michael Albinus
2024-07-31 15:18 ` Luiz Romário Santana Rios
2024-07-31 16:43 ` Michael Albinus
2024-08-08 13:13 ` Luiz Romário Santana Rios
2024-08-08 13:30 ` Michael Albinus
2024-08-08 13:37 ` Luiz Romário Santana Rios
2024-08-08 14:23 ` Michael Albinus
2024-08-08 15:18 ` Luiz Romário Santana Rios
2024-08-08 15:24 ` Michael Albinus
2024-08-08 17:33 ` Michael Albinus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).