all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* tramp and how to source remote environment
@ 2009-02-18  1:17 ramestica
  2009-02-18  1:43 ` ramestica
  0 siblings, 1 reply; 9+ messages in thread
From: ramestica @ 2009-02-18  1:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I use bash and, therefore, I have a rich .bashrc file that I share
among the few machines I work in. This rc file takes care of
identifying the machine and setting my environment accordingly.

I'm trying to figure out whether is possible in tramp or not to always
source my .bashrc file before attempting any command in the remote
machine. Is that possible at all?

I read the 'Remote shell setup hints' section in the manual, but it
does not seem to work for me. I have a .bash_profile file that sources
my .bashrc and I have no .profile in my home.

Any hints on this?

thanks,
 Rodrigo

tramp 2.1.15
emacs 23.0.60


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

* Re: tramp and how to source remote environment
  2009-02-18  1:17 tramp and how to source remote environment ramestica
@ 2009-02-18  1:43 ` ramestica
  2009-02-18 21:30   ` Michael Albinus
       [not found]   ` <mailman.1109.1234992614.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: ramestica @ 2009-02-18  1:43 UTC (permalink / raw)
  To: help-gnu-emacs

ooops, I'm just realizing that my environment (.bashrc) is actually
sourced. What happens is that PATH is set to something unexpected
which I suppose is a tramp default somehow:

/bin:/usr/bin:/usr/sbin:/usr/local/bin

That is, all seems to be working as described in the manual. I just
need to find out why is that my PATH is ovrwritten by the content
shown above.

sorry for the noise,
 Rodrigo

On Feb 17, 8:17 pm, ramest...@gmail.com wrote:
> Hi,
>
> I use bash and, therefore, I have a rich .bashrc file that I share
> among the few machines I work in. This rc file takes care of
> identifying the machine and setting my environment accordingly.
>
> I'm trying to figure out whether is possible in tramp or not to always
> source my .bashrc file before attempting any command in the remote
> machine. Is that possible at all?
>
> I read the 'Remote shell setup hints' section in the manual, but it
> does not seem to work for me. I have a .bash_profile file that sources
> my .bashrc and I have no .profile in my home.
>
> Any hints on this?
>
> thanks,
>  Rodrigo
>
> tramp 2.1.15
> emacs 23.0.60



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

* Re: tramp and how to source remote environment
  2009-02-18  1:43 ` ramestica
@ 2009-02-18 21:30   ` Michael Albinus
       [not found]   ` <mailman.1109.1234992614.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2009-02-18 21:30 UTC (permalink / raw)
  To: ramestica; +Cc: help-gnu-emacs

ramestica@gmail.com writes:

> ooops, I'm just realizing that my environment (.bashrc) is actually
> sourced. What happens is that PATH is set to something unexpected
> which I suppose is a tramp default somehow:
>
> /bin:/usr/bin:/usr/sbin:/usr/local/bin
>
> That is, all seems to be working as described in the manual. I just
> need to find out why is that my PATH is ovrwritten by the content
> shown above.

Please check the Tramp manual, (info "(tramp)Remote Programs")

> sorry for the noise,
>  Rodrigo

Best regards, Michael.




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

* Re: tramp and how to source remote environment
       [not found]   ` <mailman.1109.1234992614.31690.help-gnu-emacs@gnu.org>
@ 2009-02-27  2:18     ` ramestica
  2009-03-03 16:36       ` Michael Albinus
       [not found]       ` <mailman.2278.1236098043.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: ramestica @ 2009-02-27  2:18 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 18, 4:30 pm, Michael Albinus <michael.albi...@gmx.de> wrote:
> Please check the Tramp manual, (info "(tramp)Remote Programs")

Hi Michael,

reading the manual does not seem to help me. Looking into tramp.el the
problem (my problem) seems to be that tramp does not respect whatever
my PATH is set to during the login process (in my case
within .bash_profile).

Perhaps there is in the lisp code of tramp-get-remote-path (used by
tramp-set-remote-path to actually set the path) something that I'm not
understanding. Too much lisp there for me.

On the other hand, if in tramp-set-remote-path I replace

"PATH=%s; export PATH"

by

"PATH=${PATH}:%s; export PATH"

then things start to work the way I want it! My PATH (crafted within
my .bash_profile) is now preserved and now I can actually compile.

Is there something I missed about how to configure tramp or does tramp
simply not work the way I want it?

thanks,
 Rodrigo


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

* Re: tramp and how to source remote environment
  2009-02-27  2:18     ` ramestica
@ 2009-03-03 16:36       ` Michael Albinus
       [not found]       ` <mailman.2278.1236098043.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2009-03-03 16:36 UTC (permalink / raw)
  To: ramestica; +Cc: help-gnu-emacs

ramestica@gmail.com writes:

> Hi Michael,

Hi Rodrigo,

> reading the manual does not seem to help me. Looking into tramp.el the
> problem (my problem) seems to be that tramp does not respect whatever
> my PATH is set to during the login process (in my case
> within .bash_profile).
>
> Perhaps there is in the lisp code of tramp-get-remote-path (used by
> tramp-set-remote-path to actually set the path) something that I'm not
> understanding. Too much lisp there for me.

Tramp has the variable tramp-remote-path. You can add there your
preferred paths, like

(add-to-list 'tramp-remote-path "/my/path" 'append)

> On the other hand, if in tramp-set-remote-path I replace
>
> "PATH=%s; export PATH"
>
> by
>
> "PATH=${PATH}:%s; export PATH"
>
> then things start to work the way I want it! My PATH (crafted within
> my .bash_profile) is now preserved and now I can actually compile.

Maybe the following works (not tested):

(add-to-list 'tramp-remote-path "${PATH}")

> thanks,
>  Rodrigo

Best regards, Michael.





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

* Re: tramp and how to source remote environment
       [not found]       ` <mailman.2278.1236098043.31690.help-gnu-emacs@gnu.org>
@ 2009-03-05  4:59         ` ramestica
  2009-03-05 14:05           ` Michael Albinus
       [not found]           ` <mailman.2422.1236261821.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: ramestica @ 2009-03-05  4:59 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 3, 11:36 am, Michael Albinus <michael.albi...@gmx.de> wrote:
> Tramp has the variable tramp-remote-path. You can add there your
> preferred paths, like
>
> (add-to-list 'tramp-remote-path "/my/path" 'append)

this is not convenient because different machines have different
paths. The logic for setting up those paths (based on the machine
name) is part of my remote bash_profile. Repeating that logic in my
local emacs configuration its simply not good.

> Maybe the following works (not tested):
>
> (add-to-list 'tramp-remote-path "${PATH}")

This does not work because in tramp-get-remote-path the function delq
removes "${PATH}" from remote-path.

Rodrigo



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

* Re: tramp and how to source remote environment
  2009-03-05  4:59         ` ramestica
@ 2009-03-05 14:05           ` Michael Albinus
       [not found]           ` <mailman.2422.1236261821.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2009-03-05 14:05 UTC (permalink / raw)
  To: ramestica; +Cc: help-gnu-emacs

ramestica@gmail.com writes:

> On Mar 3, 11:36 am, Michael Albinus <michael.albi...@gmx.de> wrote:
>> Tramp has the variable tramp-remote-path. You can add there your
>> preferred paths, like
>>
>> (add-to-list 'tramp-remote-path "/my/path" 'append)
>
> this is not convenient because different machines have different
> paths. The logic for setting up those paths (based on the machine
> name) is part of my remote bash_profile. Repeating that logic in my
> local emacs configuration its simply not good.

That's right. Tramp is not designed for that case. Maybe I shall
extend it this way ...

>> Maybe the following works (not tested):
>>
>> (add-to-list 'tramp-remote-path "${PATH}")
>
> This does not work because in tramp-get-remote-path the function delq
> removes "${PATH}" from remote-path.

I don't understand. Do you mean this line:

(setq remote-path (delq 'tramp-default-remote-path remote-path)))

This deletes the *symbol* `tramp-default-remote-path', and nothing else.

> Rodrigo

Best regards, Michael.





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

* Re: tramp and how to source remote environment
       [not found]           ` <mailman.2422.1236261821.31690.help-gnu-emacs@gnu.org>
@ 2009-03-05 14:49             ` ramestica
  2009-03-17 20:25               ` Michael Albinus
  0 siblings, 1 reply; 9+ messages in thread
From: ramestica @ 2009-03-05 14:49 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 5, 9:05 am, Michael Albinus <michael.albi...@gmx.de> wrote:
> I don't understand. Do you mean this line:
>
> (setq remote-path (delq 'tramp-default-remote-path remote-path)))
>
> This deletes the *symbol* `tramp-default-remote-path', and nothing else.

I mean the code after the comment ";; Remove non-existing
directories.".

In general I find a bit too intrusive from tramp to go and do
something with my PATH in the remote machine. I would like the call to
tramp-set-remote-pat in tramp-open-connection-setup-interactive-shell
to be a choice left to the user. What do you think of the attached
patch?

Rodrigo

 *** tramp.el.orig       2009-03-05 09:40:40.000000000 -0500
--- tramp.el    2009-03-05 08:48:53.000000000 -0500
***************
*** 871,876 ****
--- 871,881 ----
       (tramp-set-completion-function
        "fcp" tramp-completion-function-alist-ssh)))

+ (defcustom tramp-override-remote-path t
+   "To guess or not to guess a 'good' remote PATH."
+   :group 'tramp
+   :type 'boolean)
+
  (defconst tramp-echo-mark-marker "_echo"
    "String marker to surround echoed commands.")

***************
*** 6048,6054 ****
          500 0))))

    ;; Set remote PATH variable.
!   (tramp-set-remote-path vec)

    ;; Search for a good shell before searching for a command which
    ;; checks if a file exists. This is done because Tramp wants to
use
--- 6053,6060 ----
          500 0))))

    ;; Set remote PATH variable.
!   (if (eq tramp-override-remote-path t)
!       (tramp-set-remote-path vec))

    ;; Search for a good shell before searching for a command which
    ;; checks if a file exists. This is done because Tramp wants to
use


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

* Re: tramp and how to source remote environment
  2009-03-05 14:49             ` ramestica
@ 2009-03-17 20:25               ` Michael Albinus
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2009-03-17 20:25 UTC (permalink / raw)
  To: ramestica; +Cc: help-gnu-emacs

ramestica@gmail.com writes:

> In general I find a bit too intrusive from tramp to go and do
> something with my PATH in the remote machine. I would like the call to
> tramp-set-remote-pat in tramp-open-connection-setup-interactive-shell
> to be a choice left to the user. What do you think of the attached
> patch?

I have committed a patch in Tramp CVS with a similar intention. If you
apply

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

after loading Tramp, your $PATH settings shall be preserved.

> Rodrigo

Best regards, Michael.




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

end of thread, other threads:[~2009-03-17 20:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-18  1:17 tramp and how to source remote environment ramestica
2009-02-18  1:43 ` ramestica
2009-02-18 21:30   ` Michael Albinus
     [not found]   ` <mailman.1109.1234992614.31690.help-gnu-emacs@gnu.org>
2009-02-27  2:18     ` ramestica
2009-03-03 16:36       ` Michael Albinus
     [not found]       ` <mailman.2278.1236098043.31690.help-gnu-emacs@gnu.org>
2009-03-05  4:59         ` ramestica
2009-03-05 14:05           ` Michael Albinus
     [not found]           ` <mailman.2422.1236261821.31690.help-gnu-emacs@gnu.org>
2009-03-05 14:49             ` ramestica
2009-03-17 20:25               ` Michael Albinus

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.