Skip to contentSkip to conversation

git-send-email broken: Can't locate object method "starttls"

BUG Superseded Eric Biggers 3 participants 6 messages May 31, 2017 – Jun 1, 2017

lore
Share & tools
lore
#0 lore raw

Hi,

There seems to be a bug in 'git send-email' caused by this commit:

commit 0ead000c3aca13a10ae51a3c74c866981e0d33b8
Author: Dennis Kaarsemaker <[email protected]>
Date: Fri Mar 24 22:37:32 2017 +0100

send-email: Net::SMTP::SSL is obsolete, use only when necessary

When running git send-email I get the following error:

Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.

The perl version is 5.18.2, and the Net::SMTP version is 2.31.

I suspect the following line of code which appears to assume that starttls() is present in Net::SMTP >= 1.28:

	my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");

... but in fact it appears to have been added by the following commit to perl, which bumped the Net::SMTP version from 2.34 up to 3.01:

	https://perl5.git.perl.org/perl.git/commit/2e1731446cd265cddae2ea6c43a375168fdb6f56

Eric

#1 lore raw

PATCH 1/1 send-email: Net::SMTP::starttls was introduced in v3.01 (Re: [BUG] git-send-email broken: Can't locate object method "starttls")

Subject: send-email: Net::SMTP::starttls was introduced in v3.01

We cannot rely on the starttls method being present in the copy of Net::SMTP shipped with perl until v5.21.5~169 (Update libnet to CPAN version 3.01, 2014-10-10).

---
Hi Eric,

Quoted 6 lines · Eric Biggers

There seems to be a bug in 'git send-email' caused by this commit:

commit 0ead000c3aca13a10ae51a3c74c866981e0d33b8
Author: Dennis Kaarsemaker <[email protected]>
Date: Fri Mar 24 22:37:32 2017 +0100

Quoted 7 lines

send-email: Net::SMTP::SSL is obsolete, use only when necessary

When running git send-email I get the following error:

Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.

The perl version is 5.18.2, and the Net::SMTP version is 2.31.

Thanks for reporting. Does this patch help?

Regards,
Jonathan

 git-send-email.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-send-email.perl +1 -1
index 0d90439d9..3441e3cf5 100755
@@ -1354,7 +1354,7 @@ EOF
 		}
 
 		require Net::SMTP;
-		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
+		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("3.01");
 		$smtp_domain ||= maildomain();
 
 		if ($smtp_encryption eq 'ssl') {
Signature · 1 line
2.13.0.506.g27d5fe0cd
#2 lore raw

Re: [PATCH] send-email: Net::SMTP::starttls was introduced in v3.01 (Re: [BUG] git-send-email broken: Can't locate object method "starttls")

Quoted 22 lines · Jonathan Nieder

Subject: send-email: Net::SMTP::starttls was introduced in v3.01

We cannot rely on the starttls method being present in the copy of Net::SMTP shipped with perl until v5.21.5~169 (Update libnet to CPAN version 3.01, 2014-10-10).

---
Hi Eric,

Quoted 8 lines · Eric Biggers

There seems to be a bug in 'git send-email' caused by this commit:

commit 0ead000c3aca13a10ae51a3c74c866981e0d33b8
Author: Dennis Kaarsemaker <[email protected]>
Date: Fri Mar 24 22:37:32 2017 +0100

send-email: Net::SMTP::SSL is obsolete, use only when necessary

Quoted 7 lines
Quoted 5 lines

When running git send-email I get the following error:

Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.

The perl version is 5.18.2, and the Net::SMTP version is 2.31.

Thanks for reporting. Does this patch help?

Good, you beat me to it ;-) Once we get this confirmed, let's queue an emergency fix.

Thanks.

Quoted 20 lines

Regards,
Jonathan

 git-send-email.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-send-email.perl +1 -1
index 0d90439d9..3441e3cf5 100755
@@ -1354,7 +1354,7 @@ EOF
 		}
 
 		require Net::SMTP;
-		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
+		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("3.01");
 		$smtp_domain ||= maildomain();
 
 		if ($smtp_encryption eq 'ssl') {
#3 lore raw

Re: [PATCH] send-email: Net::SMTP::starttls was introduced in v3.01 (Re: [BUG] git-send-email broken: Can't locate object method "starttls")

In reply to Jonathan Nieder
Quoted 42 lines · Jonathan Nieder

Subject: send-email: Net::SMTP::starttls was introduced in v3.01

We cannot rely on the starttls method being present in the copy of Net::SMTP shipped with perl until v5.21.5~169 (Update libnet to CPAN version 3.01, 2014-10-10).

---
Hi Eric,

Quoted 6 lines · Eric Biggers

There seems to be a bug in 'git send-email' caused by this commit:

commit 0ead000c3aca13a10ae51a3c74c866981e0d33b8
Author: Dennis Kaarsemaker <[email protected]>
Date: Fri Mar 24 22:37:32 2017 +0100

Quoted 7 lines

send-email: Net::SMTP::SSL is obsolete, use only when necessary

When running git send-email I get the following error:

Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.

The perl version is 5.18.2, and the Net::SMTP version is 2.31.

Thanks for reporting. Does this patch help?

Regards,
Jonathan

 git-send-email.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-send-email.perl +0 -0
index 0d90439d9..3441e3cf5 100755

git-send-email.perl EOF · line 1360

Quoted 8 lines
git-send-email.perl +1 -1
@@ -1354,7 +1354,7 @@ EOF
 		}
 
 		require Net::SMTP;
-		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
+		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("3.01");
 		$smtp_domain ||= maildomain();
 
 		if ($smtp_encryption eq 'ssl') {

Yes, that solves the problem for me.

Eric

#4 lore raw

Re: [PATCH] send-email: Net::SMTP::starttls was introduced in v3.01 (Re: [BUG] git-send-email broken: Can't locate object method "starttls")

Quoted 12 lines · Eric Biggers
Quoted 10 lines · Jonathan Nieder

Subject: send-email: Net::SMTP::starttls was introduced in v3.01

We cannot rely on the starttls method being present in the copy of Net::SMTP shipped with perl until v5.21.5~169 (Update libnet to CPAN version 3.01, 2014-10-10).

---

[...]

Quoted 9 lines
Quoted 9 lines

+++ b/git-send-email.perl

git-send-email.perl +1 -1
@@ -1354,7 +1354,7 @@ EOF
 		}
 
 		require Net::SMTP;
-		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
+		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("3.01");
 		$smtp_domain ||= maildomain();
 
Quoted 4 lines

git-send-email.perl EOF · line 1360

Quoted 2 lines
git-send-email.perl +0 -0
 		if ($smtp_encryption eq 'ssl') {

Yes, that solves the problem for me.

Thanks. Mining through https://github.com/gbarr/perl-libnet, I find

  $ git log -Sstarttls
[...]
  commit b4a7a274a7fe5344c154abc4b3fdd7c446d36370
  Author: Steffen Ullrich <[email protected]>
  Date:   Fri May 9 23:15:48 2014 +0200

SSL and IPv6 support for Net::SMTP

  $ git show b4a7a274a7fe5344c154abc4b3fdd7c446d36370
[...]
  diff --git a/Net/SMTP.pm b/Net/SMTP.pm
  index 705b5c5..fcc124f 100644
  --- a/Net/SMTP.pm
  +++ b/Net/SMTP.pm
  @@ -18,7 +18,31 @@ use Net::Config;

$VERSION = "2.33";
[...]

  $ git log -p --ancestry-path b4a7a274a7fe5344c154abc4b3fdd7c446d36370..HEAD  -- Net/SMTP.pm
[...]
  commit 67b37d5c7118f9af50e5a5a00c242992caba3b8d
  Author: Steve Hay <[email protected]>
  Date:   Mon Jun 2 14:13:55 2014 +0100

Bump $VERSION in changed modules

  diff --git a/Net/SMTP.pm b/Net/SMTP.pm
  index 4496f6f..9dfaadf 100644
  --- a/Net/SMTP.pm
  +++ b/Net/SMTP.pm
  @@ -16,7 +16,7 @@ use IO::Socket;
   use Net::Cmd;
   use Net::Config;
   
  -$VERSION = "2.34";
  +$VERSION = "2.35";
   # Code for detecting if we can use SSL
   my $ssl_class = eval {

I think 2.35 is the correct minimum version.

Jonathan

#5 lore raw

PATCH v2 1/1 send-email: Net::SMTP::starttls was introduced in v2.34 (Re: [BUG] git-send-email broken: Can't locate object method "starttls")

Subject: send-email: Net::SMTP::starttls was introduced in v2.34

We cannot rely on the starttls method being present in Net::SMTP until c274b798e6881a941d941808c6d89966975cb8c8 (Merge branch 'ipv6_ssl' of
https://github.com/noxxi/perl-libnet into noxxi-ipv6_ssl, 2014-06-02), which set the module version to 2.34.

This version was first shipped as part of perl in v5.21.5~169 (Update libnet to CPAN version 3.01, 2014-10-10).

Noticed on an Ubuntu system with perl 5.18.2-2ubuntu1.1, which provides Net::SMTP version 2.31. The error message is

Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.

---

Quoted 1 line · Jonathan Nieder

Thanks. Mining through https://github.com/gbarr/perl-libnet, I find

[...]

Quoted 1 line

I think 2.35 is the correct minimum version.

Nah, I'm reading wrong. The relevant commit is c274b798 (Merge branch 'ipv6_ssl' of https://github.com/noxxi/perl-libnet into noxxi-ipv6_ssl, 2014-06-02), which bumped VERSION to 2.34.

Here's an updated patch.

Thanks,
Jonathan

 git-send-email.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-send-email.perl +1 -1
index 0d90439d9..d326238c0 100755
@@ -1354,7 +1354,7 @@ EOF
 		}
 
 		require Net::SMTP;
-		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
+		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("2.34");
 		$smtp_domain ||= maildomain();
 
 		if ($smtp_encryption eq 'ssl') {
Signature · 1 line
2.13.0.506.g27d5fe0cd