Bug#701652: libnet-ssh2-perl: Cannot enable zlib compression

Francois Gouget fgouget at free.fr
Mon Feb 25 19:03:39 UTC 2013


Package: libnet-ssh2-perl
Version: 0.46-2
Severity: normal

Dear Maintainer,

Setting up zlib compression with

  $ssh2->method('COMP_CS', 'zlib', 'none');

does not work. The first hint is that after connecting one gets:

print "COMP_CS is ", $ssh2->method('COMP_CS'), " err=[", ssherror($ssh2), "]\n";
COMP_CS is none err=[]

Transfering a bunch of highly compressible data to a distant host through a relatively slow link only confirms the problem.

This issue can be reproduced with the perl script below:

--- ssh2test
#!/usr/bin/perl
use warnings;
use strict;

use Fcntl;
use Net::SSH2;

my $hostname = $ARGV[0];
die 'you must specify the remote hostname' if (!$hostname);

my $ssh2 = Net::SSH2->new();
$ssh2->debug(1);
$ssh2->method('COMP_CS', 'zlib', 'none');
$ssh2->method('COMP_SC', 'zlib', 'none');

sub ssh2error()
{
  my @List = $ssh2->error();
  return $List[2];
}

$ssh2->connect($hostname) or die ssh2error();
print "COMP_CS is ", $ssh2->method('COMP_CS'), " err=[", ssh2error(), "]\n";
print "COMP_SC is ", $ssh2->method('COMP_SC'), " err=[", ssh2error(), "]\n";

# Adjust the authentication to suit yourself.
$ssh2->auth("username" => $ENV{USER});

my $local;
open($local, ">", "ssh2test.tmp") or die $!;
my $str = 'a' x (1024 * 1024);
for (my $i = 0; $i < 10; $i++)
{
    print $local $str;
}
close($local);

$ssh2->scp_put("ssh2test.tmp") or die ssh2error();
$ssh2->disconnect();
---

$ time ./ssh2test slowhost
COMP_CS is none err=[]
COMP_SC is none err=[]
libssh2_scp_send_ex(ss->session, path, mode, size, mtime, atime) -> 0x267b990
Net::SSH2::Channel::read(size = 1, ext = 0)
- read 1 bytes
- read 1 total
Net::SSH2::Channel::DESTROY
Net::SSH2::DESTROY object 0x23d1920

real	2m6.709s
user	0m0.480s
sys	0m0.080s

Mesure the run time and bandwidth use (e.g. gkrellm graph) while the test is running. Then compare these with a transfer of the same amount of data with 'scp -C'. For instance:

$ dd if=/dev/zero of=foo bs=1M count=10
$ time scp ssh2test.tmp slowhost:
ssh2test.tmp                                  100%   10MB 102.4KB/s   01:40    

real	2m7.725s
user	0m0.244s
sys	0m0.044s

$ time scp -C ssh2test.tmp slowhost:
ssh2test.tmp                                  100%   10MB  10.0MB/s   00:01    

real	0m3.645s
user	0m0.140s
sys	0m0.008s


This should make it clear that Net:SSH2 did not enable compression.

I tried placing the method('COMP_CS', 'zlib') calls at various points to no avail.
Also this problem is already present in libnet-ssh2-perl 0.44-1.


-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libnet-ssh2-perl depends on:
ii  libc6                       2.13-37
ii  libssh2-1                   1.4.2-1.1
ii  perl                        5.14.2-17
ii  perl-base [perlapi-5.14.2]  5.14.2-17
ii  zlib1g                      1:1.2.7.dfsg-13

Versions of packages libnet-ssh2-perl recommends:
ii  libterm-readkey-perl  2.30-4+b2

libnet-ssh2-perl suggests no packages.

-- no debconf information



More information about the pkg-perl-maintainers mailing list