Subject: | Width/height swapped in interactive shells. |
This seems related to bug 60859, which is marked resolved, but the
problem is still present in 1.35. This happens with both my distro-
supplied perl 5.10.1 and a built-for-testing 5.16.3, on CentOS 6.3.
When requesting a pty, it's submitting the terminal width and height in
the wrong order, in both the SSH2.pm and SSH1.pm files. It needs to
send width, height, xpix, ypix; but, each time, it's sending height,
width, xpix, ypix.
if (defined $sz[0]) {
$foundsize = 1;
-> $packet->put_int32($sz[1]); # height
-> $packet->put_int32($sz[0]); # width
$packet->put_int32($sz[2]); # xpix
$packet->put_int32($sz[3]); # ypix
}
I've attached patches for both SSH2.pm and SSH1.pm.
Example of buggy behavior:
[sld@sandbox]~/work/% cat w
#!/home/sld/localperl/bin/perl
use strict;
use warnings;
use Net::SSH::Perl;
use Term::ReadKey;
my $ssh = Net::SSH::Perl->new("localhost",protocol=>2,interactive=>0);
$ssh->login("other","somestring");
ReadMode('raw');
$ssh->shell;
ReadMode('restore');
[sld@sandbox]~/work/% stty size
48 161
[sld@sandbox]~/work/% ./w
Last login: Thu Mar 14 13:52:20 2013 from localhost
[other@sandbox ~]$ stty size
161 48
[other@sandbox ~]$ exit
logout
[sld@sandbox]~/work/% stty size
48 161
After fixing SSH2.pm like this,
if (defined $sz[0]) {
$foundsize = 1;
-> $r_packet->put_int32($sz[0]); # width
-> $r_packet->put_int32($sz[1]); # height
$r_packet->put_int32($sz[2]); # xpix
$r_packet->put_int32($sz[3]); # ypix
}
it then works as expected:
[sld@sandbox]~/work/% stty size
48 161
[sld@sandbox]~/work/% ./w
Last login: Thu Mar 14 13:54:06 2013 from localhost
[other@sandbox ~]$ stty size
48 161
[other@sandbox ~]$ exit
logout
[sld@sandbox]~/work/% stty size
48 161
cheers,
--sabrina
Subject: | SSH1.patch |
--- SSH1.pm.orig 2013-03-15 14:36:28.653794091 -0500
+++ SSH1.pm 2013-03-15 14:36:41.462686460 -0500
@@ -226,8 +226,8 @@
my @sz = Term::ReadKey::GetTerminalSize($ssh->sock);
if (defined $sz[0]) {
$foundsize = 1;
- $packet->put_int32($sz[1]); # height
$packet->put_int32($sz[0]); # width
+ $packet->put_int32($sz[1]); # height
$packet->put_int32($sz[2]); # xpix
$packet->put_int32($sz[3]); # ypix
}
Subject: | SSH2.patch |
--- SSH2.pm.orig 2013-03-15 14:13:44.485668810 -0500
+++ SSH2.pm 2013-03-15 14:35:25.740543536 -0500
@@ -150,8 +150,8 @@
my @sz = Term::ReadKey::GetTerminalSize($ssh->sock);
if (defined $sz[0]) {
$foundsize = 1;
- $packet->put_int32($sz[1]); # height
$packet->put_int32($sz[0]); # width
+ $packet->put_int32($sz[1]); # height
$packet->put_int32($sz[2]); # xpix
$packet->put_int32($sz[3]); # ypix
}
@@ -225,8 +225,8 @@
my @sz = Term::ReadKey::GetTerminalSize($ssh->sock);
if (defined $sz[0]) {
$foundsize = 1;
- $r_packet->put_int32($sz[1]); # height
$r_packet->put_int32($sz[0]); # width
+ $r_packet->put_int32($sz[1]); # height
$r_packet->put_int32($sz[2]); # xpix
$r_packet->put_int32($sz[3]); # ypix
}