Skip to content
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

Get only last line of uname -sm output on remote server #25383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

foxtran
Copy link

@foxtran foxtran commented Feb 22, 2025

Closes #25382

Release notes:

  • SSH remoting: fixed connecting when your .bashrc writes to stdout.

Copy link

cla-bot bot commented Feb 22, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @foxtran on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@foxtran
Copy link
Author

foxtran commented Feb 22, 2025

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 22, 2025
Copy link

cla-bot bot commented Feb 22, 2025

The cla-bot has been summoned, and re-checked this pull request!

@zed-industries-bot
Copy link

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against f4cb00b

@ConradIrwin
Copy link
Member

@foxtran thanks!

Also, there are likely to be other places confused by this extra echo, as due to the way ssh works we end up doing a lot of IO over stdin/stdout; with this fixed does your setup work?

@foxtran
Copy link
Author

foxtran commented Feb 22, 2025

with this fixed does your setup work?

Not exactly, but these errors come not from extra "echo" in .bashrc.

we end up doing a lot of IO over stdin/stdout

The other places of run_command does not try to parse the output so this part works fine.

@ConradIrwin
Copy link
Member

Right, but when we start the SshSession we read the output and assume it is photo-bufs:

let stdout_task = cx.background_spawn({
let mut connection_activity_tx = connection_activity_tx.clone();
async move {
loop {
stdout_buffer.resize(MESSAGE_LEN_SIZE, 0);
let len = child_stdout.read(&mut stdout_buffer).await?;
if len == 0 {
return anyhow::Ok(());
}
if len < MESSAGE_LEN_SIZE {
child_stdout.read_exact(&mut stdout_buffer[len..]).await?;
}
let message_len = message_len_from_buffer(&stdout_buffer);
let envelope =
read_message_with_len(&mut child_stdout, &mut stdout_buffer, message_len)
.await?;
connection_activity_tx.try_send(()).ok();
incoming_tx.unbounded_send(envelope).ok();
}
}
});

I suspect this code is also broken in the same way, and less clear how to fix.

I wonder if a better fix could be to notice: uname output is incorrect, and prompt people to fix their .bashrc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prebuilt remote servers are not yet available for Beer
3 participants