-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem interpreting signals emitted by terminal on BSD systems properly #29
Comments
Similer to #28 (comment) , I think the problem is likely that Joe is having trouble with the You can check this by trying the following:
|
@justinmk3 Confirmed this formatting issue happens with Confirm this happens on both on Terminal and iTerm on OS-X. And this has happened as far as back as I can remember using SSM. Only gotten around to reporting it now because of the increasing usage and adoption. Another issue I've found @justinmk3 is that copy/paste doesn't work via |
Example: # VIA SSH...
$ TERM=xterm joe test # Then CTRL-K + V to pagedown to the bottom and I see...
<img src="./externals/Landingpage/images/googleplus.png" alt="" />
</a>
</li>
<li>
<a target="_blank" href="http://website.com">
<img src="./externals/Landingpage/images/twitter.png" alt="" />
</a>
</li>
<li>
<a target="_blank" href="http://website.com">
<img src="./externals/Landingpage/images/facebook.png" alt="" />
</a>
</li>
</ul>
</div>
</div>
</div>
# VIA SSM...
$ TERM=xterm joe test # Then CTRL-K + V to pagedown to the bottom and I see...
<img src="./externals/Landingpage/images/googleplus.png" alt="" />
</a>
</li>
<li>
<a target="_blank" href="http://website.com">
<img src="./externals/Landingpage/images/twitter.png" alt="" />
</a>
</li>
<li>
<a target="_blank" href="http://website.com">
<img src="./externals/Landingpage/images/facebook.png" alt="" />
</a>
</li>
</ul>
</div>
</div>
</div> Note the bottom-half of the lines above are displayed without their space prefixes. |
I'm not intimately familiar with SSM, but I think the next step would be to share more concrete details about your SSH config and how exactly you are invoking
Something in the stack (SSM, SSH, your terminal, ...) is eating control codes (cursor-positioning in this case). I would expect SSM to strictly pass-through the data so the terminal can handle it. Depends on how SSH+SSM is invoked/configured... |
@justinmk3 I don't really know how/what to look into to give more information on this. My setup is simply...
Then open up My belief is still that, for the most part, the only issues I have are with using |
Thanks. I can reproduce the rendering issues (but not the exact CTRL-D behavior) by connecting that way. Forcing
In ConclusionIIUC, ssm when invoked via For interactive sessions, that function may need to set some termios properties. Related |
@justinmk3 For replicating this issue I was not using screen or tmux, no. I do use those tools especially screen fairly regularly however, but haven't noticed much issues with that. Only/mostly with joe. I do confirm the If I understand your conclusion and links, it seems like some setup in the init display mode for Unix-based sessions might need a few commands to help ensure all the control and cursor-related messages get sent/received in both directions. I have no knowledge at this specific area, but I could poke around and fiddle. And worst-case, maybe I/you/others could help refine what we've learned here into a very clear issue report for someone else to work out. |
TL; DR: Run More details: A coworker and I ran into an issue where we'd use SSM to ssh to an instance: aws ssm start-session --document-name AWS-StartInteractiveCommand --parameters '{"command": ["sudo su ec2-user"]}' --target i-00112233445566778 but when we would yank from the kill ring (via
I have only experienced this connecting from a Mac laptop to a Linux EC2 instance. Can't reproduce it when connecting from a Linux machine to a Linux EC2 instance. We noticed that on Mac
We found that SSM sessions will not terminate if you first unmap the dsusp signal. Here's how to do that: stty dsusp undef Is there some way that the session manager plugin can be updated to not fire the dsusp signal when running on a Mac and a user enters |
On a BSD system like my Mac, perhaps the bytes emitted by SIGTSTP are different from the bytes sent by Linux, so the signal is never captured by the session manager plugin? session-manager-plugin/src/sessionmanagerplugin/session/sessionutil/control_signals_unix.go Lines 25 to 33 in c523002
|
@pedros007 Man, this is exactly what I've been suffering from for ages. I'm glad someone dug harder than I did to figure this out. This alone is preventing me from completely eliminating my usage of SSH. My cli editor regularly uses CTRL-Y during editing and it disconnects me. I have to try really hard not to use a command sequence which is embedded deep in my unix-ey brain from 20+ years of using it. Every time it happens I curse this silly feature and its silly bugs. I don't know enough about the internal unix control signals to recommend what the actual fix is, but I hope someone does and can make the fix to this plugin permanently so I can enjoy uninterrupted shell sessions. I'm pleased to here there's a command I can run |
I put this command in my |
@AndrewFarley I wonder if this issue should be renamed. The current title implies it's a problem specific to your editor. Reproduce steps which seems to only happen on a MacOS terminal:
Expected behavior: paste from the kill-ring (which is empty, so nothing should happen) Actual behavior: The session terminates with the log line
The kludgy workaround fix is to:
|
@pedros007 You're right, let me fix up the title and description of this now that we know what the issue is. Hopefully someone can fix it |
As an emacs user, this is killing me. I just switched from ssh to session manager (plugin). At least |
@jra Try running
My terminal has |
@trharris78 Here is what I get from
I just tried |
Someone else having the same |
Sorry if this is a daft question: one of the responses to a related ticket mentioned that JOE puts the terminal in "raw" mode so it can handle ctrl-D itself. I don't see anywhere that the SSM client puts the local terminal in raw mode so it can transmit those control characters to the remote end. Would that be a reasonable fix? |
Same problem on Ctrl+O with description in #79, I closed it as duplicate. The title of this issue should be updated to reflect that the problem is about handling of Ctrl+key inputs, it would be clearer. |
I built upon the analysis from @justinmk3 (thanks!) and submitted a PR in #80. Everything is described in the PR description. It fixes the issue, but it needs some polishing and probably the eye of somebody experienced with such issues. It's great if some of you can confirm if the branch fixes the problem for you or not. 🙏 |
Hi, I can't comment on the PR as I don't have enough Go knowledge, but I have tested this and I can confirm this fixes the issue for me (specifically being able to use Ctrl+s on k9s, although other Ctrl key combinations seem to work as well) on Mac OS Sonama. Thanks @jbbarth! |
@jbbarth Man, I LOVE you. You just made SSM actually usable for me. Using joe and performing CTRL-Y doesn't suddenly eject me from the SSM session. You single-handedly turned this from a tool I use to put an SSH key onto a machine, into something I can use daily. This works great for me, fixes all issues I highlighted in this issue. If you have some way to donate $$$ in some way (paypal/crypto/gift card) I would be happy to chuck you over a HUGE thanks. Definitely hope some others can review this code and get this merged and released for everyone ASAP. I'm keen to get people I manage to be able to use this and completely remove SSH everywhere always. |
Thank you all for reporting the issue and the discussions, and @jbbarth for your pull request! Session Manager team has received this pull request, will review and merge the change in upcoming release. |
@yuting-fan there's been two releases already since then, is there anything else you still need to be able to review and merge this? |
Hello @yuting-fan, it's almost been a year since your previous comment. Could we get news on this? |
NOTE: This issue's contents and title have been significantly changed as of Jan 15 because of some folks getting to the underlying issue.
The underlying issue is that when using a BSD-based system (like OS-X) this plugin sends some undesirable control signals. This appears to ONLY affect Macs, not Windows or Linux.
@pedros007 Believes this issue is related to the ControlSignals handled by a ShellSession
Reproduce steps which seems to only happen on a MacOS terminal:
aws ssm start-session --target i-00112233445566778
The kludgy workaround currently is
aws ssm start-session --target i-00112233445566778
For more details about this issue please see some of the comments towards the bottom of the thread/issue.
The text was updated successfully, but these errors were encountered: