threads / patch / 21059

patchfix obscure perl message when encryption=tls and smtp cannot connect.

Subject: [PATCH] fix obscure perl message when encryption=tls and smtp cannot connect.

## tl;dr

3 messages between Sep 25, 2009 and Sep 25, 2009. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

iler.ml@gmail.com· Sep 25, 2009, 21:30 UTC · lore
When encryption=tls and smtp cannot connect, git-send-email prints following perl error:
Can't call method "command" on an undefined value at /usr/local/libexec/git-core/git-send-email line 927.

(ithis is when smtp host orport is misspelled, or network is down, and encryption is tls). We expect some familiar "Cannot connect to SERVER:PORT" message. Fix it to print normal "smtp can't connect" diagnostics.

--- /usr/local/libexec/git-core/git-send-email.000 2009-09-26 00:10:01.000000000 +0300 +++ /usr/local/libexec/git-core/git-send-email 2009-09-26 00:11:39.000000000 +0300

Show changes to diff +1 −1
@@ -922,7 +922,7 @@
 			$smtp ||= Net::SMTP->new((defined $smtp_server_port)
 						 ? "$smtp_server:$smtp_server_port"
 						 : $smtp_server);
-			if ($smtp_encryption eq 'tls') {
+			if ($smtp_encryption eq 'tls' && $smtp) {
 				require Net::SMTP::SSL;
 				$smtp->command('STARTTLS');
 				$smtp->response();
Shawn O. Pearce· Sep 25, 2009, 21:34 UTC · re: iler.ml@gmail.com · lore

Re: [PATCH] fix obscure perl message when encryption=tls and smtp cannot connect.

iler.ml@gmail.com wrote:
Show 7 quoted lines
> When encryption=tls and smtp cannot connect, git-send-email prints following perl error:
> 
> Can't call method "command" on an undefined value at /usr/local/libexec/git-core/git-send-email line 927.
> 
> (ithis is when smtp host orport is misspelled, or network is down, and encryption is tls).
> We expect some familiar "Cannot connect to SERVER:PORT" message.
> Fix it to print normal "smtp can't connect" diagnostics.
Thanks, looks reasonable.  Signed-off-by line, per the Developer's
Certificate of Origin in Documentation/SubmittingPatches ?
 
Show 11 quoted lines
> --- /usr/local/libexec/git-core/git-send-email.000	2009-09-26 00:10:01.000000000 +0300
> +++ /usr/local/libexec/git-core/git-send-email	2009-09-26 00:11:39.000000000 +0300
> @@ -922,7 +922,7 @@
>  			$smtp ||= Net::SMTP->new((defined $smtp_server_port)
>  						 ? "$smtp_server:$smtp_server_port"
>  						 : $smtp_server);
> -			if ($smtp_encryption eq 'tls') {
> +			if ($smtp_encryption eq 'tls' && $smtp) {
>  				require Net::SMTP::SSL;
>  				$smtp->command('STARTTLS');
>  				$smtp->response();
-- 
Shawn.
Yakov Lerner· Sep 25, 2009, 21:39 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] fix obscure perl message when encryption=tls and smtp cannot connect.

On Sat, Sep 26, 2009 at 00:34, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 12 quoted lines
>
> iler.ml@gmail.com wrote:
> > When encryption=tls and smtp cannot connect, git-send-email prints following perl error:
> >
> > Can't call method "command" on an undefined value at /usr/local/libexec/git-core/git-send-email line 927.
> >
> > (ithis is when smtp host orport is misspelled, or network is down, and encryption is tls).
> > We expect some familiar "Cannot connect to SERVER:PORT" message.
> > Fix it to print normal "smtp can't connect" diagnostics.
>
> Thanks, looks reasonable.  Signed-off-by line, per the Developer's
> Certificate of Origin in Documentation/SubmittingPatches ?
Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
Show 13 quoted lines
>
> > --- /usr/local/libexec/git-core/git-send-email.000    2009-09-26 00:10:01.000000000 +0300
> > +++ /usr/local/libexec/git-core/git-send-email        2009-09-26 00:11:39.000000000 +0300
> > @@ -922,7 +922,7 @@
> >                       $smtp ||= Net::SMTP->new((defined $smtp_server_port)
> >                                                ? "$smtp_server:$smtp_server_port"
> >                                                : $smtp_server);
> > -                     if ($smtp_encryption eq 'tls') {
> > +                     if ($smtp_encryption eq 'tls' && $smtp) {
> >                               require Net::SMTP::SSL;
> >                               $smtp->command('STARTTLS');
> >                               $smtp->response();
>
Yakov

← back to recent threads