Joel Reicher <joel.reic...@gmail.com> writes:

Hi Joel,

>> Both could be good buddies. When used with care (proper shell
>> arguments coming from tramp-sh-extra-args, sensitive settings in
>> .profile). But Tramp doesn't recommend any of them; it is up to the
>> user to change is she isn't happy with
>> tramp-default-remote-shell. /bin/sh is the minimal consensus we
>> could expect to exist remotely.
>
> I was meaning to ask about tramp-default-remote-shell also. On my
> version of Tramp (2.7.3.30.2) it's not a defcustom and it's also not
> mentioned in the manual, so changing it doesn't seem to be
> "approved". Rather, the manual mentions customising
> tramp-connection-properties.
>
> Is the default shell "supposed" to be changed?

Tramp doesn't encourage to change tramp-default-remote-shell, that's why
it is a defconst. The problem is, that a changed value is used then for
all remote machines. But this is not good for real world. /bin/bash
might be preferred on machine A, but might not exist on machine
B. That's why Tramp recommends to set connection properties instead
("remote-shell"), which take preference over tramp-default-remote-shell.

>>> And even as a third option I think invoking bash as sh enables some
>>> POSIX compatibility and disables some bash-specific features, so
>>> perhaps that's better still?
>>
>> What do you mean with this?
>
> "When invoked as sh, Bash enters POSIX mode after reading the startup
> files."
>
> https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html#Bash-POSIX-Mode-1
>
> So it's possible this mode is an even better Tramp buddy than
> bash-as-bash with the extra args, but I don't know how to judge
> this. (Although the below suggests the opposite, which is exactly the
> kind of information I'm after.)

I didn't know this. However, Tramp cannot force to call bash as sh.

>>> My problem here is that from what I can tell the remote shell is
>>> Tramp's agent, and I don't really know what helps Tramp the
>>> most. In the abstract I'm kind of a bit surprised it doesn't deploy
>>> a custom command loop with simple semantics implemented as an awk
>>> script or something like that. (Dependent on a good awk being
>>> available, of course.)
>>
>> There's tramp-find-shell, which does kind of. Could be improved, of
>> course, it is very rudimentary. And it still requires that Tramp has
>> connected to the remote already with tramp-default-remote-shell.
>
> That's very interesting. I think tilde expansion is exactly what I saw
> break on one of my remotes when the remote shell was /bin/sh, and the
> POSIX mode of bash does change tilde expansion. I didn't dig into the
> details enough to be sure that was the cause though.

Well proposals and/or patches welcome!

> Thanks and regards,
>
>       - Joel

Best regards, Michael.

Reply via email to