[Top][All Lists]

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

Re: 'exec /bin/bash --login' in ~/.profile

From: Michael Albinus
Subject: Re: 'exec /bin/bash --login' in ~/.profile
Date: Thu, 10 Feb 2011 14:25:45 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Marc Girod <address@hidden> writes:

> Sorry. New occurrence of the no Id error, flushed with 
> tramp-cleanup-connection (/bin/id found on remote host).
> More details on 'exec /bin/bash --login' (same user):
>  ~/.bash_profile run, but not only PS1 overwritten,
>  but also PATH (which means that I pretty much have to re-run it)

PATH is always set by a new connection. You can control it by
`tramp-remote-path', see the manual for details. If you want to keep
ypur PATH as set in ~/.bash_profile, use `tramp-own-remote-path'.

Btw, what are the results of the following commands on your remote host:

# uname -sr
# getconf PATH

> Confirmed from the debug buffer (I have to wrap some lines for gmane):
> 11:51:40.258167 tramp-send-command (6) # exec env ENV='' \
> PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh
> ...
> 11:51:40.887167 tramp-open-connection-setup-interactive-shell (5) # \
> Setting shell prompt
> 11:51:40.887167 tramp-send-command (6) # \
> PS1=///525d2765eba4e0b1750fbb40e924da1f\#\$
> 11:51:41.068167 tramp-wait-for-regexp (6) # 
> ///525d2765eba4e0b1750fbb40e924da1f#$
> ...
> 11:51:41.902167 tramp-set-remote-path (5) # Setting $PATH \
> environment variable
> 11:51:41.903167 tramp-send-command (6) #
> PATH=/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/local/bin; \
> export PATH
> ...
> 11:51:43.570167 tramp-send-command (6) # cd
> /view/emagiro_t7/vobs/atcctest/ClearCase-SyncTree/; \
> exec /usr/bin/bash --noediting -i

> This doesn't seem to be a setting of mine...?
> Unless... I do have: explicit-shell-file-name "/usr/bin/bash"...
> This was however meant for my local host!

As I said: shell-mode is (likely) not aware of remote hosts. It might
always use explicit-shell-file-name, whereever you are.

> The question is: I understand that tramp might need to set a friendly
> environment for the time of establishing the connection.
> But how am I supposed to restore my own environment after the 
> connection has completed?

See above.

> Actually, the prompt I am left with is not the one set in the debug 
> buffer transcript. This one was: ///525d2765eba4e0b1750fbb40e924da1f#$,
> not merely #$

"#$ " is the initial path Tramp is using. When the connection is
established, it switches to "///525d2765eba4e0b1750fbb40e924da1f#$".

The reason is, that Tramp must detect the prompt under *any*
circumstances, whatever file contents is transferred over the wire.

Back in November there was already a discussion about this issue. See

> Marc

Best regards, Michael.

reply via email to

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