[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tramp path-munging breaks remote compilation

Subject: Re: tramp path-munging breaks remote compilation
Date: Wed, 26 May 2021 10:42:49 -0400
User-agent: mu4e 1.5.8; emacs 27.1

On 2021-05-26T07:57:41-0400, Kevin Broadey wrote:
> I'm running emacs-27.2 under Cygwin64 on a Windows 10 laptop to access files 
> on a CentOS-7 server over ssh. I've customized tramp-default-method to "ssh" 
> and tramp-syntax to simplified so I can "C-x d /myhost: RET" to get a dired 
> listing of my remote home directory.

> My remote machine is set up to use the "devtoolset-7" package which installs 
> gcc-7 in /opt/rh/devtoolset-7/root/usr/bin so, to get it in my PATH, my 
> .bash_profile contains "source /opt/rh/devtoolset-7/enable" which makes the 
> necessary environment changes, critically...

>     export PATH=/opt/rh/devtoolset-7/root/usr/bin${PATH:+:${PATH}}

> However, when I run "M-x compile RET env|sort RET" from emacs, it reports...

>     PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin

> The only way I've been able to get Tramp to Do The Right Thing and leave my 
> remote PATH the way I want it to be is to put this in my .emacs file...

>     ;; tramp is overzealous about setting the remote PATH,
>     ;; contrary to .profile, .bash_profile .bashrc etc
>     (eval-after-load "tramp-sh" '(defun tramp-set-remote-path(vec)))

I do this instead (bash is my shell locally and remotely):

(add-to-list 'tramp-remote-path 'tramp-own-remote-path)

I think that the pertinent entry in the documentation is:

4.15 How TRAMP finds and uses programs on the remote host


> This is maybe an extreme reaction, but I've got a job to do, and when it 
> comes to setting the remote PATH, I really do know better than my editor.

> I can understand that you would want a "safe" path for poking around under 
> the hood on the remote machine, but when you're executing commands on behalf 
> of the user, you really ought to be doing so in the user's environment, not 
> yours.

> Thanks

reply via email to

[Prev in Thread] Current Thread [Next in Thread]