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

3 messages from 2009-09-25 to 2009-09-25. Participants: iler.ml@gmail.com, Shawn O. Pearce, Yakov Lerner.
Thread: https://gitlist.dev/t/21059

## iler.ml@gmail.com, 2009-09-25 21:30

Subject: [PATCH] fix obscure perl message when encryption=tls and smtp cannot connect.
Message-ID: <1253914213-22274-1-git-send-email-iler.ml@gmail.com>
URL: https://gitlist.dev/e/1253914213-22274-1-git-send-email-iler.ml%40gmail.com

```
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
@@ -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, 2009-09-25 21:34

Subject: Re: [PATCH] fix obscure perl message when encryption=tls and smtp cannot connect.
Message-ID: <20090925213440.GX14660@spearce.org>
URL: https://gitlist.dev/e/20090925213440.GX14660%40spearce.org
In-Reply-To: <1253914213-22274-1-git-send-email-iler.ml@gmail.com>

```
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 ?
 
> --- /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, 2009-09-25 21:39

Subject: Re: [PATCH] fix obscure perl message when encryption=tls and smtp cannot connect.
Message-ID: <f36b08ee0909251439o38b8e414nc7621085d7489ade@mail.gmail.com>
URL: https://gitlist.dev/e/f36b08ee0909251439o38b8e414nc7621085d7489ade%40mail.gmail.com
In-Reply-To: <20090925213440.GX14660@spearce.org>

```
On Sat, Sep 26, 2009 at 00:34, Shawn O. Pearce <spearce@spearce.org> wrote:
>
> 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>

>
> > --- /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

```
