6

I am trying to debug some bizarre issues with my exec-path settings.

When I debug PATH in shell, the key tool is "which", which tells me the absolute path we resolve for a given binary, i.e.

(701) % which ifconfig
/sbin/ifconfig

Is there some equivalent to tell me, for example, what binary Tramp will get when it asks to execute "ssh"?

2 Answers 2

8

You can attempt locating an executable in exec-path with executable-find:

(executable-find "ls") ;=> "/usr/bin/ls"
(executable-find "sl") ;=> nil
0

Tramp provides a debugging buffer, usually *debug tramp...* that provides a lot of information. For example...

;; GNU Emacs: 24.4.51.2 Tramp: 2.2.9-24.4 -*- mode: outline; -*-
17:54:29.340451 tramp-maybe-open-connection (3) # Opening connection for schwern.net using scp...
17:54:29.369182 tramp-maybe-open-connection (3) # Sending command `exec ssh   -o ControlPath=/var/folders/0b/7xp2lxbd7yl0tcpms06fr3d40000gn/T/tramp.40010Dqz.%r@%h:%p -o ControlMaster=auto -o ControlPersist=no -e none schwern.net'

You can see, it's running exec ssh which will pick up the normal ssh from your PATH. If you want to be sure you can run M-x shell and check which ssh or use the commands in @wasamasa's answer.

What tramp will use to login is controlled by the tramp-login-program argument to the particular method in the tramp-methods variable. For example, here's the ssh method.

 ("ssh"
  (tramp-login-program "ssh")
  (tramp-login-args
   (("-l" "%u")
    ("-p" "%p")
    ("%c")
    ("-e" "none")
    ("%h")))
  (tramp-async-args
   (("-q")))
  (tramp-remote-shell "/bin/sh")
  (tramp-remote-shell-args
   ("-c"))
  (tramp-gw-args
   (("-o" "GlobalKnownHostsFile=/dev/null")
    ("-o" "UserKnownHostsFile=/dev/null")
    ("-o" "StrictHostKeyChecking=no")))
  (tramp-default-port 22))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.