-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ctrl + Space in the terminal crashes the session with: received invalid non-UTF8 text data #21213
Comments
Note: I transferred this to the main Cockpit repo, instead of Cockpit Machines, as this appears to be related to the terminal in Cockpit (according to the URL), not the consoles in Cockpit Machines I see this behavior on both the latest Firefox and Chrome on GNOME 47 on Fedora 41. It's not an issue for the page itself, as hitting control+space doesn't do anything when the focus isn't on the widget, so I don't think it's intentional from the Cockpit side nor does it seem to be browser-related. It does disconnect when you're focused on the terminal widget, so I'm thinking that it might be a bug in keyboard handling in the terminal JavaScript from |
ctrl+space oopses cockpit for me and it shouldn't. So we should look into this. |
It happened to me on firefox and on the Steam overlay browser (chromium). |
Notes:
--- pkg/lib/cockpit-components-terminal.jsx
+++ pkg/lib/cockpit-components-terminal.jsx
@@ -132,8 +132,11 @@ export class Terminal extends React.Component {
this.terminalRef = React.createRef();
term.onData(function(data) {
+ const e = new TextEncoder();
+ const bytes = e.encode(data);
+ console.log("terminal onData string", data, "bytes", bytes);
if (this.props.channel.valid)
- this.props.channel.send(data);
+ this.props.channel.send(bytes);
}.bind(this));
if (props.onTitleChanged) generally works and stops the crash, but entirely ignores the Ctrl+Space, and encodes it as
|
Pressing Ctrl+Space in the terminal was previously considered a major insult and killed the session. Both the "externally visible" representation in JS as a string (a null byte) as well as the actual bytes sent to the websocket (0xA0) are broken and useless. The latter caused a session disconnect due to invalid UTF-8 data, and the former makes it impossible to properly work around this issue (which would be to send [0xC2, 0xA0] to the web socket). So the best thing that we can do is to ignore invalid keys (which show up as NUL). Fixes cockpit-project#21213
@thepragmaticmero I sent a PR #21283 to fix the session killing, but I'm afraid Ctrl+Space still won't work for you -- it comes out of the browser as NUL byte, and the only thing we can do is to ignore it 😢 |
Pressing Ctrl+Space in the terminal was previously considered a major insult and killed the session. Both the "externally visible" representation in JS as a string (a null byte) as well as the actual bytes sent to the websocket (0xA0) are broken and useless. The latter caused a session disconnect due to invalid UTF-8 data, and the former makes it impossible to properly work around this issue (which would be to send [0xC2, 0xA0] to the web socket). So the best thing that we can do is to ignore invalid keys (which show up as NUL). Fixes cockpit-project#21213
I'll use a workaround then, revert to using Ctrl+B on my workflow it's fine for now. |
Pressing Ctrl+Space in the terminal was previously considered a major insult and killed the session. Both the "externally visible" representation in JS as a string (a null byte) as well as the actual bytes sent to the websocket (0xA0) are broken and useless. The latter caused a session disconnect due to invalid UTF-8 data, and the former makes it impossible to properly work around this issue (which would be to send [0xC2, 0xA0] to the web socket). So the best thing that we can do is to ignore invalid keys (which show up as NUL). Fixes #21213
The shortcut Ctrl + Space is a hardcoded keyboard shortcut on the remote terminal
https://ip:port/system/terminal
, it closes the connection to the remote terminal. My configuration has Ctrl + Space as a leader key for tmux, the hardcoded shortcut inhibits the leader function on tmux. Disconnecting it.Possible solutions:
Is there a
cockpit.conf
parameter that solves the problem maybe?The text was updated successfully, but these errors were encountered: