Re: Symlinks of sh to bash breaks extra args?
Joel Reicher <[email protected]> Mon, 22 Sep 2025 20:30:18 +1000
| Newsgroups | gmane.emacs.tramp |
|---|---|
| Message-ID | <[email protected]> |
Michael Albinus <[email protected]> writes: > Joel Reicher <[email protected]> writes: > >> 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. And that's kind of what I'm struggling with. I can see the default value for extra args caters for both bash and zsh. Let's imagine I have both; which one would be a "better Tramp buddy" as you say below? 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? 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.) > 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. I do think I understand the options, but as I said above, I'm not sure how to figure out what I'm aiming for. Thanks and regards, - Joel