Re: Symlinks of sh to bash breaks extra args?

Michael Albinus <[email protected]> Mon, 22 Sep 2025 10:32:52 +0200
Newsgroups gmane.emacs.tramp
Message-ID <[email protected]>
Joel Reicher <[email protected]> writes:

Hi Joel,

> I've only just started looking at how all this works so I'm sure
> there's a lot I don't understand, but it seems to me the intention of
> tramp-sh-extra-args is broken by the combination of it using a regex
> on bash, the default remote shell for tramp being /bin/sh, and then
> the (quite common) arrangement of the remote having a symlink from
> /bin/sh to /bin/bash. The result is then bash, but tramp doesn't know
> it and then never applies those extra args.

That is true. When tramp-sh-extra-args was added to Tramp (2002-06-19
according to the ChangeLog), this problem (/bin/sh is a link) didn't
exist. And even now, on many remote systems (like my QNAP NAS), the
setup is different.

However, I don't know a better way to know which shell variant is used
on the remote system prior calling it.

> Is this a problem? I don't know how important those extra args are,
> but things seem to work better with them.

Users change tramp-default-remote-shell. And then, there is a good
chance to benefit from tramp-sh-extra-args.

The settings are not essential. They give just a set of arguments which
help to be a better Tramp buddy. But if they aren't used, the Tramp
manual gives you several hints for configuration of the remote shell,
mainly based on the value of $TERM.

> Regards,
>
>        - Joel

Best regards, Michael.