Skip Menu |

This queue is for tickets about the Net-SSH-Perl CPAN distribution.

Report information
The Basics
Id: 34874
Status: resolved
Priority: 0/
Queue: Net-SSH-Perl

People
Owner: Nobody in particular
Requestors: john [...] sackheads.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.67
Fixed in: 1.31



Subject: setting terminal height appropriately when requesting pty
I haven't verified this in all versions of Net::SSH::Perl, but browsing the source of 1.30 and previous versions, I see the same issue. When requesting a pty, currently Net::SSH::Perl::SSH1.pm and SSH2.pm both set all terminal sizes to 0. This is irritating when ssh'ing to a Cisco IOS device, as it uses the terminal height parameter to set a default pager length. The fix seems to be simple. I've attached a patch for SSH1.pm, it's a very similar fix for SSH2.pm. It would be awesome if this could be included in the next version. Thanks John
Subject: fix-terminal-length.patch
*** SSH1.pm.old Fri Apr 11 12:37:56 2008 --- SSH1.pm Fri Apr 11 12:32:20 2008 *************** *** 218,224 **** $packet = $ssh->packet_start(SSH_CMSG_REQUEST_PTY); my($term) = $ENV{TERM} =~ /(\w+)/; $packet->put_str($term); ! $packet->put_int32(0) for 1..4; $packet->put_int8(0); $packet->send; --- 218,233 ---- $packet = $ssh->packet_start(SSH_CMSG_REQUEST_PTY); my($term) = $ENV{TERM} =~ /(\w+)/; $packet->put_str($term); ! if (eval "require Term::ReadKey") { ! my @sz=Term::ReadKey::GetTerminalSize($ssh->sock); ! $packet->put_int32($sz[1]); ! $packet->put_int32($sz[0]); ! $packet->put_int32($sz[2]); ! $packet->put_int32($sz[3]); ! } ! else { ! $packet->put_int32(0) for 1..4; ! } $packet->put_int8(0); $packet->send;
just attaching the SSH2.pm patch
*** SSH2.pm.old Fri Apr 11 18:32:24 2008 --- SSH2.pm Fri Apr 11 18:35:10 2008 *************** *** 189,195 **** my $r_packet = $channel->request_start('pty-req', 0); my($term) = $ENV{TERM} =~ /(\w+)/; $r_packet->put_str($term); ! $r_packet->put_int32(0) for 1..4; $r_packet->put_str(""); $r_packet->send; $channel->{ssh}->debug("Requesting shell."); --- 189,204 ---- my $r_packet = $channel->request_start('pty-req', 0); my($term) = $ENV{TERM} =~ /(\w+)/; $r_packet->put_str($term); ! if (eval "require Term:::ReadKey") { ! my @sz=Term::ReadKey::GetTerminalSize($ssh->sock); ! $packet->put_int32($sz[1]); ! $packet->put_int32($sz[0]); ! $packet->put_int32($sz[2]); ! $packet->put_int32($sz[3]); ! } ! else { ! $r_packet->put_int32(0) for 1..4; ! } $r_packet->put_str(""); $r_packet->send; $channel->{ssh}->debug("Requesting shell.");
Subject: Setting terminal height appropriately when requesting pty
Applied in version 1.31, thanks!