Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

tmux + ssh + fish breaks. $SHELL gets evaluated locally / escaping problems? #692

Open
derphilipp opened this issue Apr 15, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@derphilipp
Copy link
Contributor

derphilipp commented Apr 15, 2021

What did you expect to happen?

Executing my upgrades for other machines works, unless I start using them inside tmux.

Having them as a dry-run exposes (for example):
/usr/bin/ssh -t flexo env TOPGRADE_PREFIX=flexo $SHELL -lc topgrade

What actually happened?
The remote side gives back an error:
env: ‘/usr/local/bin/fish’: No such file or directory
But of course that cannot be exected like that: Although locally there is a /usr/local/bin/fish - no such thing exists remotely. The remote shell would be /usr/bin/fish (and is set as a default anyway).

So I guess $SHELL shouldnt be evaluated locally - so if I escape it manually (on the commandline) to be...

/usr/bin/ssh -t flexo env TOPGRADE_PREFIX=flexo '$SHELL' -lc topgrade

(pay attention to the single quotes around $SHELL)
... it works.

Now another error occurs if we have the "yes" flag activated, as it tries to run, but fails being unable to parse the commandline correctly. Weird.

Again, if I escape the given commandline to:

(Before)

/usr/bin/ssh -t flexo env TOPGRADE_PREFIX=flexo $SHELL -lc topgrade -y

(After)

/usr/bin/ssh -t flexo env TOPGRADE_PREFIX=flexo '$SHELL' -lc topgrade\ -y

it works.

Additional details:

  • Which operating system or Linux distribution are you using?
    macOS, from here trying to connect to multiple linux hosts of different flavors. They all behave the same.
  • How did you install Topgrade?
    Manually downloaded and placed in /usr/local/bin (linux) or ~/bin/topgrade (macos)

Run topgrade --dry-run to see which commands Topgrade is running. If the command seems wrong and you know why pleaes tell us so.
If the command seems fine try to run it yourself and tell us if you got a different result from Topgrade.

Paste the output of `topgrade -v`
@derphilipp
Copy link
Contributor Author

derphilipp commented Apr 15, 2021

Adding a '-v' to tmux for debbuging purposes outputs the called commands for tmux:

==> tmux-client-22626.log <==
1618514975.156154 sending message 106 to peer 0x7fc150008000 (0 bytes)
1618514975.156174 cmd_pack_argv: argv[0]=new-window
1618514975.156181 cmd_pack_argv: argv[1]=-a
1618514975.156188 cmd_pack_argv: argv[2]=-t
1618514975.156194 cmd_pack_argv: argv[3]=topgrade:1
1618514975.156201 cmd_pack_argv: argv[4]=ssh -t flexo env TOPGRADE_PREFIX=flexo $SHELL -lc topgrade --keep
1618514975.156216 sending message 200 to peer 0x7fc150008000 (98 bytes)
1618514975.156225 client loop enter
1618514975.166874 peer 0x7fc150008000 message 203
1618514975.166907 client loop exit

@derphilipp derphilipp changed the title tmux + ssh breaks: $SHELL gets evaluated locally / escaping problems? tmux + ssh + fish breaks. $SHELL gets evaluated locally / escaping problems? Apr 19, 2021
@derphilipp
Copy link
Contributor Author

Further update: Even activating assume_yes without activating tmux generates an error - but it does not do so if I use -y.

@r-darwish r-darwish added the bug Something isn't working label Apr 19, 2021
@derphilipp
Copy link
Contributor Author

I would assume the problem lies in using fish as the default shell for my machines

@ImNtReal
Copy link
Contributor

I've been hitting this bug for some time, myself. Interestingly, it used to work with fish as my shell.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants