Skip to contentSkip to conversation

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

PATCH In review [email protected] 2 participants 3 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix obscure perl message when encryption=tls and smtp cannot connect.

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 renamed from usr/local/libexec/git-core/git-send-email.000 +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();
#1 lore raw
Quoted 7 lines · [email protected] 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 ?

Quoted 11 lines
usr/local/libexec/git-core/git-send-email renamed from usr/local/libexec/git-core/git-send-email.000 +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();
Signature · 1 line
Shawn.
#2 lore raw
Quoted 4 lines · Shawn O. Pearce
Quoted 2 lines · [email protected] wrote:

When encryption=tls and smtp cannot connect, git-send-email prints following perl error:

Quoted 8 lines
Quoted 5 lines

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 ?

Quoted 13 lines
Quoted 5 lines
usr/local/libexec/git-core/git-send-email        2009-09-26 00:11:39.000000000 +0300 renamed from usr/local/libexec/git-core/git-send-email.000    2009-09-26 00:10:01.000000000 +0300 +0 -0
@@ -922,7 +922,7 @@
                       $smtp ||= Net::SMTP->new((defined $smtp_server_port)
Quoted 7 lines

                                               ? "$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