transport read
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 566
- Forks
- 163
- Avg merge
- 4h 51m
- Merged PRs (30d)
- 2
Description
code:
use ssh2::Session;
use ssh2::TraceFlags;
use std::io::prelude::*;
use std::net::TcpStream;
fn main() {
let tcp = TcpStream::connect("XXXXXX:22").unwrap();
let mut sess = Session::new().unwrap();
sess.trace(TraceFlags::all());
sess.set_tcp_stream(tcp);
sess.handshake().unwrap();
let username = "XXX";
let password = "XXXXX";
sess.userauth_password(username, password).unwrap();
println!("{:?}", sess.authenticated());
let mut channel = sess.channel_session().unwrap();
let command = "display interface brief";
// let command = "hostname";
channel.exec(command).unwrap();
let mut s = String::new();
channel.read_to_string(&mut s).unwrap();
println!("{}", s);
channel.wait_close().unwrap();
println!("{}", channel.exit_status().unwrap());
}
trace:
libssh2] 1.964524 Transport: Packet type 94 received, length=18
[libssh2] 1.964533 Conn: 9 bytes packet_add() for 0/1/0
[libssh2] 1.964547 Conn: increasing read_avail by 9 bytes to 89/2095097
[libssh2] 1.964562 Conn: channel_read() got 80 of data from 0/1/0 [ul]
[libssh2] 1.964573 Conn: channel_read() got 9 of data from 0/1/0 [ul]
[libssh2] 1.964592 Conn: channel_read() wants 1952 bytes from channel 0/1 stream #0
[libssh2] 1.964608 Failure Event: -37 - would block
[libssh2] 1.997268 Conn: channel_read() wants 1952 bytes from channel 0/1 stream #0
[libssh2] 1.997332 Socket: Error recving 16384 bytes (got 104)
[libssh2] 1.997344 Failure Event: -43 - transport read
thread 'main' panicked at src/main.rs:30:36:
called Result::unwrap() on an Err value: Custom { kind: Other, error: "transport read" }
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[libssh2] 1.997885 Conn: Freeing channel 0/1 resources
[libssh2] 1.997899 Conn: Sending EOF on channel 0/1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure from the Rust example at src/main.rs:30, using the supplied libssh2 trace and the channel.read_to_string call as the entry points. Trace the transport-read error through ssh2-rs and libssh2, then establish whether the command should complete without returning the reported error; the issue is done when the cause and expected behavior are confirmed with a regression test or a clearly documented limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100