unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* tramp and executable-find
@ 2020-06-20 15:22 Ivan Yonchovski
  2020-06-20 16:47 ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: Ivan Yonchovski @ 2020-06-20 15:22 UTC (permalink / raw)
  To: Michael Albinus, emacs-devel


Hi Michael,

As part of investigating
https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
executable-find does not return the binary when it is not on the remote
PATH(or at least this is what I see) even if you specify the full path
to the binary. Can you comment if this is the expected behaviour?

Thanks,
Ivan



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 15:22 tramp and executable-find Ivan Yonchovski
@ 2020-06-20 16:47 ` Michael Albinus
  2020-06-20 17:00   ` Philipp Stephani
  2020-06-20 17:08   ` yyoncho
  0 siblings, 2 replies; 12+ messages in thread
From: Michael Albinus @ 2020-06-20 16:47 UTC (permalink / raw)
  To: Ivan Yonchovski; +Cc: emacs-devel

Ivan Yonchovski <yyoncho@gmail.com> writes:

> Hi Michael,

Hi Ivan

> As part of investigating
> https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
> executable-find does not return the binary when it is not on the remote
> PATH(or at least this is what I see) even if you specify the full path
> to the binary. Can you comment if this is the expected behaviour?

`executable-find' is not designed to be supported by a file name handler
like Tramp. It will always check for binaries on the local host.

> Thanks,
> Ivan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 16:47 ` Michael Albinus
@ 2020-06-20 17:00   ` Philipp Stephani
  2020-06-20 17:08   ` yyoncho
  1 sibling, 0 replies; 12+ messages in thread
From: Philipp Stephani @ 2020-06-20 17:00 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Ivan Yonchovski, Emacs developers

Am Sa., 20. Juni 2020 um 18:49 Uhr schrieb Michael Albinus
<michael.albinus@gmx.de>:
>
> Ivan Yonchovski <yyoncho@gmail.com> writes:
>
> > Hi Michael,
>
> Hi Ivan
>
> > As part of investigating
> > https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
> > executable-find does not return the binary when it is not on the remote
> > PATH(or at least this is what I see) even if you specify the full path
> > to the binary. Can you comment if this is the expected behaviour?
>
> `executable-find' is not designed to be supported by a file name handler
> like Tramp. It will always check for binaries on the local host.
>

Starting with Emacs 27, it takes an optional REMOTE argument to check
on the remote host. It doesn't have its own file name handler, though;
it rather relies on the file name handler for `exec-path'.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 16:47 ` Michael Albinus
  2020-06-20 17:00   ` Philipp Stephani
@ 2020-06-20 17:08   ` yyoncho
  2020-06-20 17:43     ` Michael Albinus
  1 sibling, 1 reply; 12+ messages in thread
From: yyoncho @ 2020-06-20 17:08 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]

Hi Michael,

Can you comment on remote flag mentioned by Philip as well?

Here it is the docs for it:

REMOTE is non-nil, search on the remote host indicated by
`default-directory' instead.

Thanks,
Ivan

On Sat, Jun 20, 2020 at 7:47 PM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Ivan Yonchovski <yyoncho@gmail.com> writes:
>
> > Hi Michael,
>
> Hi Ivan
>
> > As part of investigating
> > https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
> > executable-find does not return the binary when it is not on the remote
> > PATH(or at least this is what I see) even if you specify the full path
> > to the binary. Can you comment if this is the expected behaviour?
>
> `executable-find' is not designed to be supported by a file name handler
> like Tramp. It will always check for binaries on the local host.
>
> > Thanks,
> > Ivan
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 1527 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 17:08   ` yyoncho
@ 2020-06-20 17:43     ` Michael Albinus
  2020-06-20 18:23       ` yyoncho
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2020-06-20 17:43 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

yyoncho <yyoncho@gmail.com> writes:

> Hi Michael,

Hi Ivan,

> Can you comment on remote flag mentioned by Philip as well?
>
> Here it is the docs for it:
>
> REMOTE is non-nil, search on the remote host indicated by
> `default-directory' instead.

Right, I forgot this. Sorry. So let's go back to your question:

>> As part of investigating
>> https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
>> executable-find does not return the binary when it is not on the
>> remote PATH(or at least this is what I see) even if you specify the
>> full path to the binary. Can you comment if this is the expected
>> behaviour?

The crucial point is `default-directory'. In my local environment, I
have for example

--8<---------------cut here---------------start------------->8---
(let ((default-directory "/tmp"))
  (executable-find "emacs"))
"/usr/local/bin/emacs"

(let ((default-directory "/tmp"))
  (executable-find "emacs" 'remote))
"/usr/local/bin/emacs"

(let ((default-directory "/ssh:ford:"))
  (executable-find "emacs"))
"/usr/local/bin/emacs"

(let ((default-directory "/ssh:ford:"))
  (executable-find "emacs" 'remote))
"/opt/bin/emacs"
--8<---------------cut here---------------end--------------->8---

You get the remote path only if `default-directory' is a remote file
name, and the REMOTE argument of `executable-find' is non-nil. And this
is understandable: if `default-directory' is not a remote file name,
`executable-find' does not know which remote host it shall use for search.

> Thanks,
> Ivan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 17:43     ` Michael Albinus
@ 2020-06-20 18:23       ` yyoncho
  2020-06-20 18:27         ` yyoncho
  0 siblings, 1 reply; 12+ messages in thread
From: yyoncho @ 2020-06-20 18:23 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]

Hi Michael,

The examples that do not work on my side are when using a full
file path when the binary is not on remote PATH.

Thanks,
Ivan

On Sat, Jun 20, 2020 at 8:43 PM Michael Albinus <michael.albinus@gmx.de>
wrote:

> yyoncho <yyoncho@gmail.com> writes:
>
> > Hi Michael,
>
> Hi Ivan,
>
> > Can you comment on remote flag mentioned by Philip as well?
> >
> > Here it is the docs for it:
> >
> > REMOTE is non-nil, search on the remote host indicated by
> > `default-directory' instead.
>
> Right, I forgot this. Sorry. So let's go back to your question:
>
> >> As part of investigating
> >> https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
> >> executable-find does not return the binary when it is not on the
> >> remote PATH(or at least this is what I see) even if you specify the
> >> full path to the binary. Can you comment if this is the expected
> >> behaviour?
>
> The crucial point is `default-directory'. In my local environment, I
> have for example
>
> --8<---------------cut here---------------start------------->8---
> (let ((default-directory "/tmp"))
>   (executable-find "emacs"))
> "/usr/local/bin/emacs"
>
> (let ((default-directory "/tmp"))
>   (executable-find "emacs" 'remote))
> "/usr/local/bin/emacs"
>
> (let ((default-directory "/ssh:ford:"))
>   (executable-find "emacs"))
> "/usr/local/bin/emacs"
>
> (let ((default-directory "/ssh:ford:"))
>   (executable-find "emacs" 'remote))
> "/opt/bin/emacs"
> --8<---------------cut here---------------end--------------->8---
>
> You get the remote path only if `default-directory' is a remote file
> name, and the REMOTE argument of `executable-find' is non-nil. And this
> is understandable: if `default-directory' is not a remote file name,
> `executable-find' does not know which remote host it shall use for search.
>
> > Thanks,
> > Ivan
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 2773 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 18:23       ` yyoncho
@ 2020-06-20 18:27         ` yyoncho
  2020-06-20 19:14           ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: yyoncho @ 2020-06-20 18:27 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2275 bytes --]

Here it is an example:

Copy ls from /bin/ and name it lss.

Then:

;; works
(let ((default-directory "<remote-path>"))
  (executable-find "lss" 'remote))

;; does not work
(let ((default-directory "<remote-path>"))
  (executable-find "/bin/lss" 'remote))

Thanks,
Ivan

On Sat, Jun 20, 2020 at 9:23 PM yyoncho <yyoncho@gmail.com> wrote:

> Hi Michael,
>
> The examples that do not work on my side are when using a full
> file path when the binary is not on remote PATH.
>
> Thanks,
> Ivan
>
> On Sat, Jun 20, 2020 at 8:43 PM Michael Albinus <michael.albinus@gmx.de>
> wrote:
>
>> yyoncho <yyoncho@gmail.com> writes:
>>
>> > Hi Michael,
>>
>> Hi Ivan,
>>
>> > Can you comment on remote flag mentioned by Philip as well?
>> >
>> > Here it is the docs for it:
>> >
>> > REMOTE is non-nil, search on the remote host indicated by
>> > `default-directory' instead.
>>
>> Right, I forgot this. Sorry. So let's go back to your question:
>>
>> >> As part of investigating
>> >> https://github.com/emacs-lsp/lsp-mode/issues/1688 I noticed that
>> >> executable-find does not return the binary when it is not on the
>> >> remote PATH(or at least this is what I see) even if you specify the
>> >> full path to the binary. Can you comment if this is the expected
>> >> behaviour?
>>
>> The crucial point is `default-directory'. In my local environment, I
>> have for example
>>
>> --8<---------------cut here---------------start------------->8---
>> (let ((default-directory "/tmp"))
>>   (executable-find "emacs"))
>> "/usr/local/bin/emacs"
>>
>> (let ((default-directory "/tmp"))
>>   (executable-find "emacs" 'remote))
>> "/usr/local/bin/emacs"
>>
>> (let ((default-directory "/ssh:ford:"))
>>   (executable-find "emacs"))
>> "/usr/local/bin/emacs"
>>
>> (let ((default-directory "/ssh:ford:"))
>>   (executable-find "emacs" 'remote))
>> "/opt/bin/emacs"
>> --8<---------------cut here---------------end--------------->8---
>>
>> You get the remote path only if `default-directory' is a remote file
>> name, and the REMOTE argument of `executable-find' is non-nil. And this
>> is understandable: if `default-directory' is not a remote file name,
>> `executable-find' does not know which remote host it shall use for search.
>>
>> > Thanks,
>> > Ivan
>>
>> Best regards, Michael.
>>
>

[-- Attachment #2: Type: text/html, Size: 3639 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 18:27         ` yyoncho
@ 2020-06-20 19:14           ` Michael Albinus
  2020-06-20 19:29             ` yyoncho
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2020-06-20 19:14 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

yyoncho <yyoncho@gmail.com> writes:

> Here it is an example:
>
> Copy ls from /bin/ and name it lss.
>
> Then:
>
> ;; works 
> (let ((default-directory "<remote-path>"))
>   (executable-find "lss" 'remote)) 
>
> ;; does not work
> (let ((default-directory "<remote-path>"))
>   (executable-find "/bin/lss" 'remote))

But this second example doesn't make sense. You want to know the path,
where the executable "lss" is located. Why do you want to give an
absolute file name as argument?

The docstring of executable-find says "Search for COMMAND in ‘exec-path’".
A command is a command, and not an absolute file name.

*If* you want to use an absolute file name, you would need to give it
also to the command, like

(let ((default-directory "<remote-path>"))
  (executable-find "<remote identification>/bin/lss" 'remote))

where <remote identification> is something like /ssh:user@host: - you
see that this doesn't make sense. Search for "lss", that's it, as you
have shown with your first example.

> Thanks,
> Ivan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 19:14           ` Michael Albinus
@ 2020-06-20 19:29             ` yyoncho
  2020-06-21  7:16               ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: yyoncho @ 2020-06-20 19:29 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]

Hi Michael,

Thank you,  this is enough for me to solve the original issue in lsp-mode
repo.

As a side note, if you do search for /bin/ls executable-find will work
although it is not prefixed with the remote identifier. This is what
confused me initially.

> Why do you want to give an
> absolute file name as argument?

This is a configuration setting for lsp-mode when the server is located
on the remote server. Some users dont have admin access on the remote
machine so they put the binary somewhere else so they have you use full
path.

Thanks,
Ivan

On Sat, Jun 20, 2020 at 10:14 PM Michael Albinus <michael.albinus@gmx.de>
wrote:

> yyoncho <yyoncho@gmail.com> writes:
>
> > Here it is an example:
> >
> > Copy ls from /bin/ and name it lss.
> >
> > Then:
> >
> > ;; works
> > (let ((default-directory "<remote-path>"))
> >   (executable-find "lss" 'remote))
> >
> > ;; does not work
> > (let ((default-directory "<remote-path>"))
> >   (executable-find "/bin/lss" 'remote))
>
> But this second example doesn't make sense. You want to know the path,
> where the executable "lss" is located. Why do you want to give an
> absolute file name as argument?
>
> The docstring of executable-find says "Search for COMMAND in ‘exec-path’".
> A command is a command, and not an absolute file name.
>
> *If* you want to use an absolute file name, you would need to give it
> also to the command, like
>
> (let ((default-directory "<remote-path>"))
>   (executable-find "<remote identification>/bin/lss" 'remote))
>
> where <remote identification> is something like /ssh:user@host: - you
> see that this doesn't make sense. Search for "lss", that's it, as you
> have shown with your first example.
>
> > Thanks,
> > Ivan
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 2609 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-20 19:29             ` yyoncho
@ 2020-06-21  7:16               ` Michael Albinus
  2020-06-21  8:41                 ` yyoncho
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2020-06-21  7:16 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

yyoncho <yyoncho@gmail.com> writes:

> Hi Michael,

Hi Ivan,

> As a side note, if you do search for /bin/ls executable-find will work
> although it is not prefixed with the remote identifier. This is what
> confused me initially.

Everything you do with a COMMAND being an absolute file name will return
not specified results. It might work, or not. Don't trust on this.

> This is a configuration setting for lsp-mode when the server is
> located on the remote server. Some users dont have admin access on the
> remote machine so they put the binary somewhere else so they have you
> use full path.

They don't have to. They shall add that directory to the remote path, and
they can still use the program name.

> Thanks,
> Ivan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-21  7:16               ` Michael Albinus
@ 2020-06-21  8:41                 ` yyoncho
  2020-06-21  9:34                   ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: yyoncho @ 2020-06-21  8:41 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

Hi Michael,

Thank you for clarification. By remote path, you mean tramp-remote-path,
right?

Thanks,
Ivan

On Sun, Jun 21, 2020 at 10:16 AM Michael Albinus <michael.albinus@gmx.de>
wrote:

> yyoncho <yyoncho@gmail.com> writes:
>
> > Hi Michael,
>
> Hi Ivan,
>
> > As a side note, if you do search for /bin/ls executable-find will work
> > although it is not prefixed with the remote identifier. This is what
> > confused me initially.
>
> Everything you do with a COMMAND being an absolute file name will return
> not specified results. It might work, or not. Don't trust on this.
>
> > This is a configuration setting for lsp-mode when the server is
> > located on the remote server. Some users dont have admin access on the
> > remote machine so they put the binary somewhere else so they have you
> > use full path.
>
> They don't have to. They shall add that directory to the remote path, and
> they can still use the program name.
>
> > Thanks,
> > Ivan
>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 1509 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tramp and executable-find
  2020-06-21  8:41                 ` yyoncho
@ 2020-06-21  9:34                   ` Michael Albinus
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Albinus @ 2020-06-21  9:34 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

yyoncho <yyoncho@gmail.com> writes:

> Hi Michael,

Hi Ivan,

> Thank you for clarification. By remote path, you mean
> tramp-remote-path, right?

Yes.

> Thanks,
> Ivan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-06-21  9:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 15:22 tramp and executable-find Ivan Yonchovski
2020-06-20 16:47 ` Michael Albinus
2020-06-20 17:00   ` Philipp Stephani
2020-06-20 17:08   ` yyoncho
2020-06-20 17:43     ` Michael Albinus
2020-06-20 18:23       ` yyoncho
2020-06-20 18:27         ` yyoncho
2020-06-20 19:14           ` Michael Albinus
2020-06-20 19:29             ` yyoncho
2020-06-21  7:16               ` Michael Albinus
2020-06-21  8:41                 ` yyoncho
2020-06-21  9:34                   ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).