Skip Menu |

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

Report information
The Basics
Id: 92556
Status: rejected
Priority: 0/
Queue: Net-OpenSSH

People
Owner: Nobody in particular
Requestors: liam.gretton [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::OpenSSH->new() doesn't trap all errors
Date: Wed, 29 Jan 2014 11:40:01 +0000
To: bug-Net-OpenSSH [...] rt.cpan.org
From: Liam Gretton <liam.gretton [...] gmail.com>
I'd expect Net::OpenSSH->new() to have all errors trapped and reported only via Net::OpenSSH2->error() but they're not. my $ssh = Net::OpenSSH->($host, user => "wronguser"); if ($ssh->error) { print "Error: ".$ssh-error."\n"; exit(1); } On executing this, where 'wronguser' is invalid... Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Error: unable to establish master SSH connection: master process exited unexpectedly The 'permission denied' error goes to stderr and isn't trapped. Thanks, Liam
Subject: Re: [rt.cpan.org #92556] Net::OpenSSH->new() doesn't trap all errors
Date: Thu, 30 Jan 2014 07:19:22 -0800 (PST)
To: "bug-Net-OpenSSH [...] rt.cpan.org" <bug-Net-OpenSSH [...] rt.cpan.org>
From: Salvador Fandino <sfandino [...] yahoo.com>
Show quoted text
>________________________________ > From: "liam.gretton@gmail.com via RT" <bug-Net-OpenSSH@rt.cpan.org> >To: >Sent: Wednesday, January 29, 2014 12:40 PM >Subject: [rt.cpan.org #92556] Net::OpenSSH->new() doesn't trap all errors > > >Wed Jan 29 06:40:11 2014: Request 92556 was acted upon. >Transaction: Ticket created by liam.gretton@gmail.com >       Queue: Net-OpenSSH >     Subject: Net::OpenSSH->new() doesn't trap all errors >   Broken in: (no value) >    Severity: (no value) >       Owner: Nobody >  Requestors: liam.gretton@gmail.com >      Status: new >Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=92556 > > > >I'd expect Net::OpenSSH->new() to have all errors trapped and reported >only via Net::OpenSSH2->error() but they're not. > >my $ssh = Net::OpenSSH->($host, user => "wronguser"); > >if ($ssh->error) { >   print "Error: ".$ssh-error."\n"; >   exit(1); >} > > >On executing this, where 'wronguser' is invalid... > >Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ That msg is sent by OpenSSH ssh directly to stderr. If you want to hide it, just redirect ssh stderr to dev null:   $ssh = Net::OpenSSH->new($host, user => 'wronguser',                            master_stderr_discard => 1) Alternatively you may want to redirect it to a temporary file so you can show it to the user in some way, later, upon failure. Show quoted text
>Error: unable to establish master SSH connection: master process exited
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ That's the error from ssh->error
Subject: Re: [rt.cpan.org #92556] Net::OpenSSH->new() doesn't trap all errors
Date: Fri, 31 Jan 2014 12:21:25 +0000
To: bug-Net-OpenSSH [...] rt.cpan.org
From: Liam Gretton <liam.gretton [...] gmail.com>
On 30/01/2014 15:19, Salvador \"Fandiño\" via RT wrote: Show quoted text
> That msg is sent by OpenSSH ssh directly to stderr. If you want to hide it, just redirect ssh stderr to dev null: > > $ssh = Net::OpenSSH->new($host, user => 'wronguser', > master_stderr_discard => 1)
I hadn't spotted the master_stderr_discard option, that's perfect. Thanks, Liam