Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id:
31985
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
sisyphus [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
0.18
Fixed in:
(no value)



Subject: A couple of t/Net-SSH2.t bugs (Win32)
Hi, When I build Net-SSH2-0.18 (and earlier) on Win32 I find I need to make the following changes to t/Net-SSH2.t: 1) Replace: # (3) authentication methods unless ($user) { my $def_user = getpwuid $<; print "\nEnter username [$def_user]: "; chomp($user = <STDIN>); $user ||= $def_user; } with: # (3) authentication methods unless ($user) { my $def_user; $def_user = getpwuid $< if $^O !~ /mswin/i; print $def_user ? "\nEnter username [$def_user]: " : "\nEnter username: "; chomp($user = <STDIN>); $user ||= $def_user; } 2) Replace: # (2) authenticate @auth = $pass ? (password => $pass) : (interact => 1); my $type = $ssh2->auth(username => $user, @auth); ok($type, "authenticated via: $type"); SKIP: { # SKIP-auth skip '- failed to authenticate with server', 37 unless $ssh2->auth_ok; pass('authenticated successfully'); with: # (2) authenticate @auth = $pass ? (password => $pass) : (interact => 1); #'interact => 1' not currently working on win32. if($^O =~ /mswin/i && !$pass) { print "\nEnter password (NOTE: Your password will be printed to the console in plain text - for all to see !!!)... or hit 'Ctrl-C' to abort the test: "; chomp($pass = <STDIN>); @auth = (password => $pass); } I believe both amendments are portable - though, admittedly, the second fix is a little agricultural, and could well be refined somewhat. I suppose that a better fix would be to get "interact => 1" working on Win32. Cheers, Rob
On Sat Dec 29 07:03:51 2007, SISYPHUS wrote:
Show quoted text
> When I build Net-SSH2-0.18 (and earlier) on Win32 I find I need to
make
Show quoted text
> the following changes to t/Net-SSH2.t:
Attached is a patch to the existing Net-SSH2.t (Net-SSH2-0.19) that enables all tests to run (and pass) on Win32. The application of this patch does *not* alter the way in which Net-SSH2.t runs on non-Win32 operating systems - instead it merely adds some conditional Win32 options where they are required. Cheers, Rob
--- Net-SSH2.t Sun May 24 13:10:58 2009 +++ Net-SSH2.t_new Sun May 24 13:41:12 2009 @@ -79,8 +79,9 @@ # (3) authentication methods unless ($user) { - my $def_user = getpwuid $<; - print "\nEnter username [$def_user]: "; + my $def_user; + $def_user = getpwuid $< if $^O !~ /mswin/i; + print $def_user ? "\nEnter username [$def_user]: " : "\nEnter username: "; chomp($user = <STDIN>); $user ||= $def_user; } @@ -92,6 +93,9 @@ # (2) authenticate @auth = $pass ? (password => $pass) : (interact => 1); +if($^O =~ /MSWin32/i && !$pass) { # interact probably failed to set $pass on Win32 + @auth = win32_auth(); +} my $type = $ssh2->auth(username => $user, @auth, publickey => "$ENV{HOME}/.ssh/id_dsa.pub", privatekey => "$ENV{HOME}/.ssh/id_dsa"); @@ -144,7 +148,12 @@ SKIP: { # SKIP-slurp eval { require File::Slurp }; skip '- File::Slurp required', 1 if $@; -is(${$check->sref}, File::Slurp::read_file($0), 'files match'); +if($^O =~ /MSWin32/i) { + is(${$check->sref}, File::Slurp::read_file($0, binmode => ':raw'), 'files match'); +} +else { + is(${$check->sref}, File::Slurp::read_file($0), 'files match'); +} } # SKIP-slurp } # SKIP-scalar @@ -189,6 +198,9 @@ scalar <$fh> for 1..2; my $line = <$fh>; chomp $line; +if($^O =~ /MSWin32/i) { + $line =~ s/\r//; +} is($line, '# THIS LINE WILL BE READ BY A TEST BELOW', "read '$line'"); #undef $fh; # don't undef it, ensure reference counts work properly @@ -233,3 +245,18 @@ } # SKIP-connect # vim:filetype=perl + +sub win32_auth { + eval{require Term::ReadKey;}; + print "\n NOTE: The password you are about to enter\n will be printed to the console." if $@; + print "\n To avoid this, either install Term::ReadKey\n or assign the correct value to \$pass" if $@; + print "\n at the beginning of this test script." if $@; + print "\nEnter password: "; + if($@) {$pass = <STDIN>} + else { + Term::ReadKey::ReadMode('noecho'); + $pass = Term::ReadKey::ReadLine(0); + } + chomp($pass); + return (password => $pass); +}
Subject: Re: [rt.cpan.org #31985] A couple of t/Net-SSH2.t bugs (Win32)
Date: Sun, 24 May 2009 09:27:54 -0700
To: Sisyphus via RT <bug-Net-SSH2@rt.cpan.org>
From: Rafael Kitover <rkitover@io.com>
Thank you very much, I'll try to get a new release out in the next couple of days.
It seems the patch was already applied several years ago! Closing.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.