threads / patch / 44517

patchRemove dependency on deprecated Net::SMTP::SSL

Subject: [PATCH] Remove dependency on deprecated Net::SMTP::SSL

## tl;dr

16 messages between Nov 20, 2016 and Jun 1, 2017. Diffs are folded; open one to read it.

replies: 15people: 8as markdown or json

Mike Fisher· Nov 20, 2016, 21:18 UTC · lore

Refactor send_message() to remove dependency on deprecated Net::SMTP::SSL:

<http://search.cpan.org/~rjbs/Net-SMTP-SSL-1.04/lib/Net/SMTP/SSL.pm#DEPRECATED>
Signed-off-by: Mike Fisher <mfisher@csh.rit.edu>
---
  git-send-email.perl | 54 
+++++++++++++++++++++++++----------------------------
  1 file changed, 25 insertions(+), 29 deletions(-)
Show changes to git-send-email.perl +25 −29
diff --git a/git-send-email.perl b/git-send-email.perl
index da81be4..fc166c5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1330,15 +1330,17 @@ Message-Id: $message_id
  		print $sm "$header\n$message";
  		close $sm or die $!;
  	} else {
-
  		if (!defined $smtp_server) {
  			die "The required SMTP server is not properly defined."
  		}

+		require Net::SMTP;
+		$smtp_domain ||= maildomain();
+		my $smtp_ssl = 0;
+
  		if ($smtp_encryption eq 'ssl') {
  			$smtp_server_port ||= 465; # ssmtp
-			require Net::SMTP::SSL;
-			$smtp_domain ||= maildomain();
+			$smtp_ssl = 1;
  			require IO::Socket::SSL;

  			# Suppress "variable accessed once" warning.
@@ -1347,37 +1349,31 @@ Message-Id: $message_id
  				$IO::Socket::SSL::DEBUG = 1;
  			}

-			# Net::SMTP::SSL->new() does not forward any SSL options
  			IO::Socket::SSL::set_client_defaults(
  				ssl_verify_params());
-			$smtp ||= Net::SMTP::SSL->new($smtp_server,
-						      Hello => $smtp_domain,
-						      Port => $smtp_server_port,
-						      Debug => $debug_net_smtp);
  		}
  		else {
-			require Net::SMTP;
-			$smtp_domain ||= maildomain();
  			$smtp_server_port ||= 25;
-			$smtp ||= Net::SMTP->new($smtp_server,
-						 Hello => $smtp_domain,
-						 Debug => $debug_net_smtp,
-						 Port => $smtp_server_port);
-			if ($smtp_encryption eq 'tls' && $smtp) {
-				require Net::SMTP::SSL;
-				$smtp->command('STARTTLS');
-				$smtp->response();
-				if ($smtp->code == 220) {
-					$smtp = Net::SMTP::SSL->start_SSL($smtp,
-									  ssl_verify_params())
-						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
-					$smtp_encryption = '';
-					# Send EHLO again to receive fresh
-					# supported commands
-					$smtp->hello($smtp_domain);
-				} else {
-					die "Server does not support STARTTLS! ".$smtp->message;
-				}
+		}
+
+		$smtp ||= Net::SMTP->new($smtp_server,
+					 Hello => $smtp_domain,
+					 Port => $smtp_server_port,
+					 Debug => $debug_net_smtp,
+					 SSL => $smtp_ssl);
+
+		if ($smtp_encryption eq 'tls' && $smtp) {
+			$smtp->command('STARTTLS');
+			$smtp->response();
+			if ($smtp->code == 220) {
+				$smtp->starttls(ssl_verify_params())
+					or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
+				$smtp_encryption = '';
+				# Send EHLO again to receive fresh
+				# supported commands
+				$smtp->hello($smtp_domain);
+			} else {
+				die "Server does not support STARTTLS! ".$smtp->message;
  			}
  		}
-- 
2.9.3 (Apple Git-75)
brian m. carlson· Nov 20, 2016, 21:53 UTC · re: Mike Fisher · lore

Re: [PATCH] Remove dependency on deprecated Net::SMTP::SSL

On Sun, Nov 20, 2016 at 04:18:16PM -0500, Mike Fisher wrote:
> Refactor send_message() to remove dependency on deprecated
> Net::SMTP::SSL:
> 
> <http://search.cpan.org/~rjbs/Net-SMTP-SSL-1.04/lib/Net/SMTP/SSL.pm#DEPRECATED>

As much as I hate to say this, I think this is going to cause compatibility problems. Net::SMTP is part of core Perl (as of v5.7.3), but the version you want to rely on (which you did not provide an explicit dependency on) is from October 2014.

That basically means that no Perl on a Red Hat or CentOS system is going to provide that support, since RHEL 7 was released in June 2014. Providing an updated Git on those platforms would require replacing the system Perl or parts of it, which would be undesirable. This would affect Debian 7 as well.

We currently support Perl 5.8 [0], so if you want to remove support for Net::SMTP::SSL, I'd recommend a solution that works with that version.

[0] I personally believe we should drop support for Perl older than 5.10.1 (if not newer), but that's my opinion and it isn't shared by other list regulars.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Renato Botelho· Jan 13, 2017, 14:59 UTC · re: brian m. carlson · lore

Re: [PATCH] Remove dependency on deprecated Net::SMTP::SSL

Show 29 quoted lines
> On 20 Nov 2016, at 19:53, brian m. carlson <sandals@crustytoothpaste.net> wrote:
> 
> On Sun, Nov 20, 2016 at 04:18:16PM -0500, Mike Fisher wrote:
>> Refactor send_message() to remove dependency on deprecated
>> Net::SMTP::SSL:
>> 
>> <http://search.cpan.org/~rjbs/Net-SMTP-SSL-1.04/lib/Net/SMTP/SSL.pm#DEPRECATED>
> 
> As much as I hate to say this, I think this is going to cause
> compatibility problems.  Net::SMTP is part of core Perl (as of v5.7.3),
> but the version you want to rely on (which you did not provide an
> explicit dependency on) is from October 2014.
> 
> That basically means that no Perl on a Red Hat or CentOS system is going
> to provide that support, since RHEL 7 was released in June 2014.
> Providing an updated Git on those platforms would require replacing the
> system Perl or parts of it, which would be undesirable.  This would
> affect Debian 7 as well.
> 
> We currently support Perl 5.8 [0], so if you want to remove support for
> Net::SMTP::SSL, I'd recommend a solution that works with that version.
> 
> [0] I personally believe we should drop support for Perl older than
> 5.10.1 (if not newer), but that's my opinion and it isn't shared by
> other list regulars.
> -- 
> brian m. carlson / brian with sandals: Houston, Texas, US
> +1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
> OpenPGP: https://keybase.io/bk2204
Net::SMTP::SSL is marked as DEPRECATED on FreeBSD ports tree and will be removed in 2017-03-31. When it happens users will not be able to run git-send-email anymore. I’m considering to add Mike’s patch to FreeBSD ports tree as an alternative but it would be good to have a official solution for this problem.
FreeBSD bug report can be found at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214335

-- Renato Botelho

Torsten Bögershausen· Nov 21, 2016, 05:37 UTC · re: Mike Fisher · lore

Re: [PATCH] Remove dependency on deprecated Net::SMTP::SSL

>On 20/11/16 22:18, Mike Fisher  wrote:
Thanks for contributing to Git.
One comment on the head line:
 >Refactor send_message() to remove dependency on deprecated
Net::SMTP::SSL
The word "refactor" may be used in other way: Re-structure the code,
and use the same API.
"Remove dependency on deprecated Net::SMTP::SSL"
> Refactor send_message() to remove dependency on deprecated
> Net::SMTP::SSL:

Is there a security risk with require Net::SMTP::SSL ? If yes, the commit message should state this. If no: Even if it is deprecated, is it still in use somewhere ? Does it hurt someone, is there any OS release where the old code doesn't work anymore ? Or is it "only" nice to have ? Since when does Net::SMTP include Net::SMTP::SSL ? On which system has the change been tested ?

I think the commit message could and should give more information like this.

My comments may be over-critical. Lets see if other people from the list know more than me.

Show 17 quoted lines
>
> <http://search.cpan.org/~rjbs/Net-SMTP-SSL-1.04/lib/Net/SMTP/SSL.pm#DEPRECATED>
>
> Signed-off-by: Mike Fisher <mfisher@csh.rit.edu>
> ---
>  git-send-email.perl | 54 +++++++++++++++++++++++++----------------------------
>  1 file changed, 25 insertions(+), 29 deletions(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index da81be4..fc166c5 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1330,15 +1330,17 @@ Message-Id: $message_id
>          print $sm "$header\n$message";
>          close $sm or die $!;
>      } else {
> -
I can see one refactoring, that is the removal of an empty line.
Show 75 quoted lines
>
>          if (!defined $smtp_server) {
>              die "The required SMTP server is not properly defined."
>          }
>
> +        require Net::SMTP;
> +        $smtp_domain ||= maildomain();
> +        my $smtp_ssl = 0;
> +
>          if ($smtp_encryption eq 'ssl') {
>              $smtp_server_port ||= 465; # ssmtp
> -            require Net::SMTP::SSL;
> -            $smtp_domain ||= maildomain();
> +            $smtp_ssl = 1;
>              require IO::Socket::SSL;
>
>              # Suppress "variable accessed once" warning.
> @@ -1347,37 +1349,31 @@ Message-Id: $message_id
>                  $IO::Socket::SSL::DEBUG = 1;
>              }
>
> -            # Net::SMTP::SSL->new() does not forward any SSL options
>              IO::Socket::SSL::set_client_defaults(
>                  ssl_verify_params());
> -            $smtp ||= Net::SMTP::SSL->new($smtp_server,
> -                              Hello => $smtp_domain,
> -                              Port => $smtp_server_port,
> -                              Debug => $debug_net_smtp);
>          }
>          else {
> -            require Net::SMTP;
> -            $smtp_domain ||= maildomain();
>              $smtp_server_port ||= 25;
> -            $smtp ||= Net::SMTP->new($smtp_server,
> -                         Hello => $smtp_domain,
> -                         Debug => $debug_net_smtp,
> -                         Port => $smtp_server_port);
> -            if ($smtp_encryption eq 'tls' && $smtp) {
> -                require Net::SMTP::SSL;
> -                $smtp->command('STARTTLS');
> -                $smtp->response();
> -                if ($smtp->code == 220) {
> -                    $smtp = Net::SMTP::SSL->start_SSL($smtp,
> -                                      ssl_verify_params())
> -                        or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> -                    $smtp_encryption = '';
> -                    # Send EHLO again to receive fresh
> -                    # supported commands
> -                    $smtp->hello($smtp_domain);
> -                } else {
> -                    die "Server does not support STARTTLS! ".$smtp->message;
> -                }
> +        }
> +
> +        $smtp ||= Net::SMTP->new($smtp_server,
> +                     Hello => $smtp_domain,
> +                     Port => $smtp_server_port,
> +                     Debug => $debug_net_smtp,
> +                     SSL => $smtp_ssl);
> +
> +        if ($smtp_encryption eq 'tls' && $smtp) {
> +            $smtp->command('STARTTLS');
> +            $smtp->response();
> +            if ($smtp->code == 220) {
> +                $smtp->starttls(ssl_verify_params())
> +                    or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> +                $smtp_encryption = '';
> +                # Send EHLO again to receive fresh
> +                # supported commands
> +                $smtp->hello($smtp_domain);
> +            } else {
> +                die "Server does not support STARTTLS! ".$smtp->message;
>              }
>          }
>
Dennis Kaarsemaker· Mar 18, 2017, 22:23 UTC · re: Mike Fisher · lore

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

Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 isn't that old yet, keep the old code in place and use it when necessary.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
---
 Note: I've only been able to test the starttls bits. None of the smtp servers
 I use actually use ssl, only starttls.
 git-send-email.perl | 52 ++++++++++++++++++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 18 deletions(-)
Show changes to git-send-email.perl +34 −18
diff --git a/git-send-email.perl b/git-send-email.perl
index eea0a517f7..e247ea39dd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1353,10 +1353,12 @@ EOF
 			die __("The required SMTP server is not properly defined.")
 		}
 
+		require Net::SMTP;
+		my $use_net_smtp_ssl = $Net::SMTP::VERSION lt "1.28";
+		$smtp_domain ||= maildomain();
+
 		if ($smtp_encryption eq 'ssl') {
 			$smtp_server_port ||= 465; # ssmtp
-			require Net::SMTP::SSL;
-			$smtp_domain ||= maildomain();
 			require IO::Socket::SSL;
 
 			# Suppress "variable accessed once" warning.
@@ -1368,34 +1370,48 @@ EOF
 			# Net::SMTP::SSL->new() does not forward any SSL options
 			IO::Socket::SSL::set_client_defaults(
 				ssl_verify_params());
-			$smtp ||= Net::SMTP::SSL->new($smtp_server,
-						      Hello => $smtp_domain,
-						      Port => $smtp_server_port,
-						      Debug => $debug_net_smtp);
+
+			if ($use_net_smtp_ssl) {
+				require Net::SMTP::SSL;
+				$smtp ||= Net::SMTP::SSL->new($smtp_server,
+							      Hello => $smtp_domain,
+							      Port => $smtp_server_port,
+							      Debug => $debug_net_smtp);
+			}
+			else {
+				$smtp ||= Net::SMTP->new($smtp_server,
+							 Hello => $smtp_domain,
+							 Port => $smtp_server_port,
+							 Debug => $debug_net_smtp,
+							 SSL => 1);
+			}
 		}
 		else {
-			require Net::SMTP;
-			$smtp_domain ||= maildomain();
 			$smtp_server_port ||= 25;
 			$smtp ||= Net::SMTP->new($smtp_server,
 						 Hello => $smtp_domain,
 						 Debug => $debug_net_smtp,
 						 Port => $smtp_server_port);
 			if ($smtp_encryption eq 'tls' && $smtp) {
-				require Net::SMTP::SSL;
-				$smtp->command('STARTTLS');
-				$smtp->response();
-				if ($smtp->code == 220) {
+				if ($use_net_smtp_ssl) {
+					$smtp->command('STARTTLS');
+					$smtp->response();
+					if ($smtp->code != 220) {
+						die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
+					}
+					require Net::SMTP::SSL;
 					$smtp = Net::SMTP::SSL->start_SSL($smtp,
 									  ssl_verify_params())
 						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
-					$smtp_encryption = '';
-					# Send EHLO again to receive fresh
-					# supported commands
-					$smtp->hello($smtp_domain);
-				} else {
-					die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
 				}
+				else {
+					$smtp->starttls(ssl_verify_params())
+						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
+				}
+				$smtp_encryption = '';
+				# Send EHLO again to receive fresh
+				# supported commands
+				$smtp->hello($smtp_domain);
 			}
 		}
 
-- 
2.12.0-437-g0cc2799
Ævar Arnfjörð Bjarmason· Mar 18, 2017, 22:47 UTC · re: Dennis Kaarsemaker · lore

Re: [PATCH] send-email: Net::SMTP::SSL is obsolete, use only when necessary

On Sat, Mar 18, 2017 at 11:23 PM, Dennis Kaarsemaker <dennis@kaarsemaker.net> wrote:

Show 25 quoted lines
> Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
> since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
> isn't that old yet, keep the old code in place and use it when
> necessary.
>
> Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
> ---
>  Note: I've only been able to test the starttls bits. None of the smtp servers
>  I use actually use ssl, only starttls.
>
>  git-send-email.perl | 52 ++++++++++++++++++++++++++++++++++------------------
>  1 file changed, 34 insertions(+), 18 deletions(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index eea0a517f7..e247ea39dd 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1353,10 +1353,12 @@ EOF
>                         die __("The required SMTP server is not properly defined.")
>                 }
>
> +               require Net::SMTP;
> +               my $use_net_smtp_ssl = $Net::SMTP::VERSION lt "1.28";
> +               $smtp_domain ||= maildomain();
> +

While Net::SMTP is unlikely to change its versioning scheme, let's use comparisons via the version module here in case they do change it to something silly, and this ends up introducing a bug.

E.g. 04.00 would be considered a higher version by CPAN than 1.28, but not by this code:

    $ perl -wE 'my ($x, $y) = @ARGV; my ($vx, $vy) = map {
version->parse($_) } ($x, $y); say $vx < $vy ? "vlower" : "vhigher";
say $x lt $y ? "slower" : "shigher"' 04.00 1.28
    vhigher
    slower

If we grep ::VERSION we can find other cases where we've gotten this wrong, unlikely to bite us in practice, but version.pm is in core (so core that you don't even need to use/require it), so let's do this better for new code.

>[...]
> +                                       if ($smtp->code != 220) {
> +                                               die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
Here a new message you're adding gets __(), makes sense.
Show 16 quoted lines
> +                                       }
> +                                       require Net::SMTP::SSL;
>                                         $smtp = Net::SMTP::SSL->start_SSL($smtp,
>                                                                           ssl_verify_params())
>                                                 or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> -                                       $smtp_encryption = '';
> -                                       # Send EHLO again to receive fresh
> -                                       # supported commands
> -                                       $smtp->hello($smtp_domain);
> -                               } else {
> -                                       die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
>                                 }
> +                               else {
> +                                       $smtp->starttls(ssl_verify_params())
> +                                               or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> +                               }

I see you just copied that from above but I wonder if it makes sense to just mark both occurrences with __() too while we're at it.

Dennis Kaarsemaker· Mar 18, 2017, 23:14 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH] send-email: Net::SMTP::SSL is obsolete, use only when necessary

On Sat, 2017-03-18 at 23:47 +0100, Ævar Arnfjörð Bjarmason wrote:
Show 11 quoted lines
> On Sat, Mar 18, 2017 at 11:23 PM, Dennis Kaarsemaker
> <dennis@kaarsemaker.net> wrote:
>
> > +               require Net::SMTP;
> > +               my $use_net_smtp_ssl = $Net::SMTP::VERSION lt "1.28";
> > +               $smtp_domain ||= maildomain();
> > +
> 
> While Net::SMTP is unlikely to change its versioning scheme, let's use
> comparisons via the version module here in case they do change it to
> something silly, and this ends up introducing a bug.
ok.
Show 5 quoted lines
> > [...]
> > +                                       if ($smtp->code != 220) {
> > +                                               die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> 
> Here a new message you're adding gets __(), makes sense.
Didn't add it, it just moved from a bit further below :)
Show 7 quoted lines
> > +                               else {
> > +                                       $smtp->starttls(ssl_verify_params())
> > +                                               or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> > +                               }
> 
> I see you just copied that from above but I wonder if it makes sense
> to just mark both occurrences with __() too while we're at it.
ok.
D.
Dennis Kaarsemaker· Mar 24, 2017, 21:37 UTC · re: Ævar Arnfjörð Bjarmason · lore

[PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 isn't that old yet, keep the old code in place and use it when necessary.

While we're in the area, mark some messages for translation that were not yet marked as such.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
---
 git-send-email.perl | 54 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 19 deletions(-)
Show changes to git-send-email.perl +35 −19
diff --git a/git-send-email.perl b/git-send-email.perl
index eea0a517f7..0d90439d9a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1353,10 +1353,12 @@ EOF
 			die __("The required SMTP server is not properly defined.")
 		}
 
+		require Net::SMTP;
+		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
+		$smtp_domain ||= maildomain();
+
 		if ($smtp_encryption eq 'ssl') {
 			$smtp_server_port ||= 465; # ssmtp
-			require Net::SMTP::SSL;
-			$smtp_domain ||= maildomain();
 			require IO::Socket::SSL;
 
 			# Suppress "variable accessed once" warning.
@@ -1368,34 +1370,48 @@ EOF
 			# Net::SMTP::SSL->new() does not forward any SSL options
 			IO::Socket::SSL::set_client_defaults(
 				ssl_verify_params());
-			$smtp ||= Net::SMTP::SSL->new($smtp_server,
-						      Hello => $smtp_domain,
-						      Port => $smtp_server_port,
-						      Debug => $debug_net_smtp);
+
+			if ($use_net_smtp_ssl) {
+				require Net::SMTP::SSL;
+				$smtp ||= Net::SMTP::SSL->new($smtp_server,
+							      Hello => $smtp_domain,
+							      Port => $smtp_server_port,
+							      Debug => $debug_net_smtp);
+			}
+			else {
+				$smtp ||= Net::SMTP->new($smtp_server,
+							 Hello => $smtp_domain,
+							 Port => $smtp_server_port,
+							 Debug => $debug_net_smtp,
+							 SSL => 1);
+			}
 		}
 		else {
-			require Net::SMTP;
-			$smtp_domain ||= maildomain();
 			$smtp_server_port ||= 25;
 			$smtp ||= Net::SMTP->new($smtp_server,
 						 Hello => $smtp_domain,
 						 Debug => $debug_net_smtp,
 						 Port => $smtp_server_port);
 			if ($smtp_encryption eq 'tls' && $smtp) {
-				require Net::SMTP::SSL;
-				$smtp->command('STARTTLS');
-				$smtp->response();
-				if ($smtp->code == 220) {
+				if ($use_net_smtp_ssl) {
+					$smtp->command('STARTTLS');
+					$smtp->response();
+					if ($smtp->code != 220) {
+						die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
+					}
+					require Net::SMTP::SSL;
 					$smtp = Net::SMTP::SSL->start_SSL($smtp,
 									  ssl_verify_params())
-						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
-					$smtp_encryption = '';
-					# Send EHLO again to receive fresh
-					# supported commands
-					$smtp->hello($smtp_domain);
-				} else {
-					die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
+						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
+				}
+				else {
+					$smtp->starttls(ssl_verify_params())
+						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
 				}
+				$smtp_encryption = '';
+				# Send EHLO again to receive fresh
+				# supported commands
+				$smtp->hello($smtp_domain);
 			}
 		}
 
-- 
2.12.0-488-gd3584ba
Dennis Kaarsemaker· May 4, 2017, 07:01 UTC · re: Dennis Kaarsemaker · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Ping. It's a little over a month since I sent this, but I haven't seen any comments. Is this commit good to go?

On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote:
Show 98 quoted lines
> Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
> since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
> isn't that old yet, keep the old code in place and use it when
> necessary.
> 
> While we're in the area, mark some messages for translation that were
> not yet marked as such.
> 
> Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
> ---
>  git-send-email.perl | 54 ++++++++++++++++++++++++++++++++++-------------------
>  1 file changed, 35 insertions(+), 19 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index eea0a517f7..0d90439d9a 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1353,10 +1353,12 @@ EOF
>  			die __("The required SMTP server is not properly defined.")
>  		}
>  
> +		require Net::SMTP;
> +		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
> +		$smtp_domain ||= maildomain();
> +
>  		if ($smtp_encryption eq 'ssl') {
>  			$smtp_server_port ||= 465; # ssmtp
> -			require Net::SMTP::SSL;
> -			$smtp_domain ||= maildomain();
>  			require IO::Socket::SSL;
>  
>  			# Suppress "variable accessed once" warning.
> @@ -1368,34 +1370,48 @@ EOF
>  			# Net::SMTP::SSL->new() does not forward any SSL options
>  			IO::Socket::SSL::set_client_defaults(
>  				ssl_verify_params());
> -			$smtp ||= Net::SMTP::SSL->new($smtp_server,
> -						      Hello => $smtp_domain,
> -						      Port => $smtp_server_port,
> -						      Debug => $debug_net_smtp);
> +
> +			if ($use_net_smtp_ssl) {
> +				require Net::SMTP::SSL;
> +				$smtp ||= Net::SMTP::SSL->new($smtp_server,
> +							      Hello => $smtp_domain,
> +							      Port => $smtp_server_port,
> +							      Debug => $debug_net_smtp);
> +			}
> +			else {
> +				$smtp ||= Net::SMTP->new($smtp_server,
> +							 Hello => $smtp_domain,
> +							 Port => $smtp_server_port,
> +							 Debug => $debug_net_smtp,
> +							 SSL => 1);
> +			}
>  		}
>  		else {
> -			require Net::SMTP;
> -			$smtp_domain ||= maildomain();
>  			$smtp_server_port ||= 25;
>  			$smtp ||= Net::SMTP->new($smtp_server,
>  						 Hello => $smtp_domain,
>  						 Debug => $debug_net_smtp,
>  						 Port => $smtp_server_port);
>  			if ($smtp_encryption eq 'tls' && $smtp) {
> -				require Net::SMTP::SSL;
> -				$smtp->command('STARTTLS');
> -				$smtp->response();
> -				if ($smtp->code == 220) {
> +				if ($use_net_smtp_ssl) {
> +					$smtp->command('STARTTLS');
> +					$smtp->response();
> +					if ($smtp->code != 220) {
> +						die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> +					}
> +					require Net::SMTP::SSL;
>  					$smtp = Net::SMTP::SSL->start_SSL($smtp,
>  									  ssl_verify_params())
> -						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> -					$smtp_encryption = '';
> -					# Send EHLO again to receive fresh
> -					# supported commands
> -					$smtp->hello($smtp_domain);
> -				} else {
> -					die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> +						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
> +				}
> +				else {
> +					$smtp->starttls(ssl_verify_params())
> +						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
>  				}
> +				$smtp_encryption = '';
> +				# Send EHLO again to receive fresh
> +				# supported commands
> +				$smtp->hello($smtp_domain);
>  			}
>  		}
>  
Dennis Kaarsemaker· May 19, 2017, 20:54 UTC · re: Dennis Kaarsemaker · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Second ping. This problem is not going away, so if this solution is not acceptable, I'd like to know what needs to be improved.

On Thu, 2017-05-04 at 09:01 +0200, Dennis Kaarsemaker wrote:
Show 102 quoted lines
> Ping. It's a little over a month since I sent this, but I haven't seen
> any comments. Is this commit good to go?
> 
> On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote:
> > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
> > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
> > isn't that old yet, keep the old code in place and use it when
> > necessary.
> > 
> > While we're in the area, mark some messages for translation that were
> > not yet marked as such.
> > 
> > Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
> > ---
> >  git-send-email.perl | 54 ++++++++++++++++++++++++++++++++++-------------------
> >  1 file changed, 35 insertions(+), 19 deletions(-)
> > 
> > diff --git a/git-send-email.perl b/git-send-email.perl
> > index eea0a517f7..0d90439d9a 100755
> > --- a/git-send-email.perl
> > +++ b/git-send-email.perl
> > @@ -1353,10 +1353,12 @@ EOF
> >  			die __("The required SMTP server is not properly defined.")
> >  		}
> >  
> > +		require Net::SMTP;
> > +		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
> > +		$smtp_domain ||= maildomain();
> > +
> >  		if ($smtp_encryption eq 'ssl') {
> >  			$smtp_server_port ||= 465; # ssmtp
> > -			require Net::SMTP::SSL;
> > -			$smtp_domain ||= maildomain();
> >  			require IO::Socket::SSL;
> >  
> >  			# Suppress "variable accessed once" warning.
> > @@ -1368,34 +1370,48 @@ EOF
> >  			# Net::SMTP::SSL->new() does not forward any SSL options
> >  			IO::Socket::SSL::set_client_defaults(
> >  				ssl_verify_params());
> > -			$smtp ||= Net::SMTP::SSL->new($smtp_server,
> > -						      Hello => $smtp_domain,
> > -						      Port => $smtp_server_port,
> > -						      Debug => $debug_net_smtp);
> > +
> > +			if ($use_net_smtp_ssl) {
> > +				require Net::SMTP::SSL;
> > +				$smtp ||= Net::SMTP::SSL->new($smtp_server,
> > +							      Hello => $smtp_domain,
> > +							      Port => $smtp_server_port,
> > +							      Debug => $debug_net_smtp);
> > +			}
> > +			else {
> > +				$smtp ||= Net::SMTP->new($smtp_server,
> > +							 Hello => $smtp_domain,
> > +							 Port => $smtp_server_port,
> > +							 Debug => $debug_net_smtp,
> > +							 SSL => 1);
> > +			}
> >  		}
> >  		else {
> > -			require Net::SMTP;
> > -			$smtp_domain ||= maildomain();
> >  			$smtp_server_port ||= 25;
> >  			$smtp ||= Net::SMTP->new($smtp_server,
> >  						 Hello => $smtp_domain,
> >  						 Debug => $debug_net_smtp,
> >  						 Port => $smtp_server_port);
> >  			if ($smtp_encryption eq 'tls' && $smtp) {
> > -				require Net::SMTP::SSL;
> > -				$smtp->command('STARTTLS');
> > -				$smtp->response();
> > -				if ($smtp->code == 220) {
> > +				if ($use_net_smtp_ssl) {
> > +					$smtp->command('STARTTLS');
> > +					$smtp->response();
> > +					if ($smtp->code != 220) {
> > +						die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> > +					}
> > +					require Net::SMTP::SSL;
> >  					$smtp = Net::SMTP::SSL->start_SSL($smtp,
> >  									  ssl_verify_params())
> > -						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> > -					$smtp_encryption = '';
> > -					# Send EHLO again to receive fresh
> > -					# supported commands
> > -					$smtp->hello($smtp_domain);
> > -				} else {
> > -					die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> > +						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
> > +				}
> > +				else {
> > +					$smtp->starttls(ssl_verify_params())
> > +						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
> >  				}
> > +				$smtp_encryption = '';
> > +				# Send EHLO again to receive fresh
> > +				# supported commands
> > +				$smtp->hello($smtp_domain);
> >  			}
> >  		}
> >  
Ævar Arnfjörð Bjarmason· May 20, 2017, 07:56 UTC · re: Dennis Kaarsemaker · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

On Fri, May 19, 2017 at 10:54 PM, Dennis Kaarsemaker <dennis@kaarsemaker.net> wrote:

> Second ping. This problem is not going away, so if this solution is not
> acceptable, I'd like to know what needs to be improved.
FWIW:
Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Show 103 quoted lines
> On Thu, 2017-05-04 at 09:01 +0200, Dennis Kaarsemaker wrote:
>> Ping. It's a little over a month since I sent this, but I haven't seen
>> any comments. Is this commit good to go?
>>
>> On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote:
>> > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
>> > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
>> > isn't that old yet, keep the old code in place and use it when
>> > necessary.
>> >
>> > While we're in the area, mark some messages for translation that were
>> > not yet marked as such.
>> >
>> > Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
>> > ---
>> >  git-send-email.perl | 54 ++++++++++++++++++++++++++++++++++-------------------
>> >  1 file changed, 35 insertions(+), 19 deletions(-)
>> >
>> > diff --git a/git-send-email.perl b/git-send-email.perl
>> > index eea0a517f7..0d90439d9a 100755
>> > --- a/git-send-email.perl
>> > +++ b/git-send-email.perl
>> > @@ -1353,10 +1353,12 @@ EOF
>> >                     die __("The required SMTP server is not properly defined.")
>> >             }
>> >
>> > +           require Net::SMTP;
>> > +           my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
>> > +           $smtp_domain ||= maildomain();
>> > +
>> >             if ($smtp_encryption eq 'ssl') {
>> >                     $smtp_server_port ||= 465; # ssmtp
>> > -                   require Net::SMTP::SSL;
>> > -                   $smtp_domain ||= maildomain();
>> >                     require IO::Socket::SSL;
>> >
>> >                     # Suppress "variable accessed once" warning.
>> > @@ -1368,34 +1370,48 @@ EOF
>> >                     # Net::SMTP::SSL->new() does not forward any SSL options
>> >                     IO::Socket::SSL::set_client_defaults(
>> >                             ssl_verify_params());
>> > -                   $smtp ||= Net::SMTP::SSL->new($smtp_server,
>> > -                                                 Hello => $smtp_domain,
>> > -                                                 Port => $smtp_server_port,
>> > -                                                 Debug => $debug_net_smtp);
>> > +
>> > +                   if ($use_net_smtp_ssl) {
>> > +                           require Net::SMTP::SSL;
>> > +                           $smtp ||= Net::SMTP::SSL->new($smtp_server,
>> > +                                                         Hello => $smtp_domain,
>> > +                                                         Port => $smtp_server_port,
>> > +                                                         Debug => $debug_net_smtp);
>> > +                   }
>> > +                   else {
>> > +                           $smtp ||= Net::SMTP->new($smtp_server,
>> > +                                                    Hello => $smtp_domain,
>> > +                                                    Port => $smtp_server_port,
>> > +                                                    Debug => $debug_net_smtp,
>> > +                                                    SSL => 1);
>> > +                   }
>> >             }
>> >             else {
>> > -                   require Net::SMTP;
>> > -                   $smtp_domain ||= maildomain();
>> >                     $smtp_server_port ||= 25;
>> >                     $smtp ||= Net::SMTP->new($smtp_server,
>> >                                              Hello => $smtp_domain,
>> >                                              Debug => $debug_net_smtp,
>> >                                              Port => $smtp_server_port);
>> >                     if ($smtp_encryption eq 'tls' && $smtp) {
>> > -                           require Net::SMTP::SSL;
>> > -                           $smtp->command('STARTTLS');
>> > -                           $smtp->response();
>> > -                           if ($smtp->code == 220) {
>> > +                           if ($use_net_smtp_ssl) {
>> > +                                   $smtp->command('STARTTLS');
>> > +                                   $smtp->response();
>> > +                                   if ($smtp->code != 220) {
>> > +                                           die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
>> > +                                   }
>> > +                                   require Net::SMTP::SSL;
>> >                                     $smtp = Net::SMTP::SSL->start_SSL($smtp,
>> >                                                                       ssl_verify_params())
>> > -                                           or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
>> > -                                   $smtp_encryption = '';
>> > -                                   # Send EHLO again to receive fresh
>> > -                                   # supported commands
>> > -                                   $smtp->hello($smtp_domain);
>> > -                           } else {
>> > -                                   die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
>> > +                                           or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
>> > +                           }
>> > +                           else {
>> > +                                   $smtp->starttls(ssl_verify_params())
>> > +                                           or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
>> >                             }
>> > +                           $smtp_encryption = '';
>> > +                           # Send EHLO again to receive fresh
>> > +                           # supported commands
>> > +                           $smtp->hello($smtp_domain);
>> >                     }
>> >             }
>> >
Junio C Hamano· May 31, 2017, 22:50 UTC · re: Dennis Kaarsemaker · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
> Second ping. This problem is not going away, so if this solution is not
> acceptable, I'd like to know what needs to be improved.

Perhaps you needed to actually test with older installation that people have, it seems, between pings. Immediately after this was merged to 'master', we start getting bug reports X-<.

Eric Biggers' message 
    https://public-inbox.org/git/<20170531222455.GD72735@gmail.com>
seems to indicate that we should cut off at 3.01 not 1.28?
Thanks.
Show 20 quoted lines
> On Thu, 2017-05-04 at 09:01 +0200, Dennis Kaarsemaker wrote:
>> Ping. It's a little over a month since I sent this, but I haven't seen
>> any comments. Is this commit good to go?
>> 
>> On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote:
>> > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
>> > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
>> > isn't that old yet, keep the old code in place and use it when
>> > necessary.
>> > ...
>> > diff --git a/git-send-email.perl b/git-send-email.perl
>> > index eea0a517f7..0d90439d9a 100755
>> > --- a/git-send-email.perl
>> > +++ b/git-send-email.perl
>> > @@ -1353,10 +1353,12 @@ EOF
>> >  			die __("The required SMTP server is not properly defined.")
>> >  		}
>> >  
>> > +		require Net::SMTP;
>> > +		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
Dennis Kaarsemaker· Jun 1, 2017, 19:42 UTC · re: Junio C Hamano · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

On Thu, 2017-06-01 at 07:50 +0900, Junio C Hamano wrote:
Show 16 quoted lines
> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
> 
> > Second ping. This problem is not going away, so if this solution is not
> > acceptable, I'd like to know what needs to be improved.
> 
> Perhaps you needed to actually test with older installation that
> people have, it seems, between pings.  Immediately after this was
> merged to 'master', we start getting bug reports X-<.
> 
> Eric Biggers' message 
> 
>     https://public-inbox.org/git/<20170531222455.GD72735@gmail.com>;
> 
> seems to indicate that we should cut off at 3.01 not 1.28?
> 
> Thanks.
Apologies for that. The version numbering of libnet is *weird*. The
libnet version this was fixed in *is* 1.28, but the Net::SMTP module in
 libnet version 1.28 has version 2.33.

I did test with some older perl versions, but not far enough back it seems :(

D.
Jonathan Nieder· May 31, 2017, 21:46 UTC · re: Dennis Kaarsemaker · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Hi,
Dennis Kaarsemaker wrote:
> Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
> since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
> isn't that old yet, keep the old code in place and use it when
> necessary.
This broke git send-email for me.  The error message is
  Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.
Is 1.28 the right minimum version?
  $ perl -e 'require Net::SMTP; print version->parse($Net::SMTP::VERSION); print "\n"'
  2.31
  $ grep VERSION /usr/share/perl/5.18.2/Net/SMTP.pm
  use vars qw($VERSION @ISA);
  $VERSION = "2.31";
  $ grep starttls /usr/share/perl/5.18.2/Net/SMTP.pm
  $ dpkg-query -W perl
  perl    5.18.2-2ubuntu1.1
Patch left unsnipped for reference.

Thanks, Jonathan

Show 96 quoted lines
> While we're in the area, mark some messages for translation that were
> not yet marked as such.
>
> Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
> ---
>  git-send-email.perl | 54 ++++++++++++++++++++++++++++++++++-------------------
>  1 file changed, 35 insertions(+), 19 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index eea0a517f7..0d90439d9a 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1353,10 +1353,12 @@ EOF
>  			die __("The required SMTP server is not properly defined.")
>  		}
>  
> +		require Net::SMTP;
> +		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28");
> +		$smtp_domain ||= maildomain();
> +
>  		if ($smtp_encryption eq 'ssl') {
>  			$smtp_server_port ||= 465; # ssmtp
> -			require Net::SMTP::SSL;
> -			$smtp_domain ||= maildomain();
>  			require IO::Socket::SSL;
>  
>  			# Suppress "variable accessed once" warning.
> @@ -1368,34 +1370,48 @@ EOF
>  			# Net::SMTP::SSL->new() does not forward any SSL options
>  			IO::Socket::SSL::set_client_defaults(
>  				ssl_verify_params());
> -			$smtp ||= Net::SMTP::SSL->new($smtp_server,
> -						      Hello => $smtp_domain,
> -						      Port => $smtp_server_port,
> -						      Debug => $debug_net_smtp);
> +
> +			if ($use_net_smtp_ssl) {
> +				require Net::SMTP::SSL;
> +				$smtp ||= Net::SMTP::SSL->new($smtp_server,
> +							      Hello => $smtp_domain,
> +							      Port => $smtp_server_port,
> +							      Debug => $debug_net_smtp);
> +			}
> +			else {
> +				$smtp ||= Net::SMTP->new($smtp_server,
> +							 Hello => $smtp_domain,
> +							 Port => $smtp_server_port,
> +							 Debug => $debug_net_smtp,
> +							 SSL => 1);
> +			}
>  		}
>  		else {
> -			require Net::SMTP;
> -			$smtp_domain ||= maildomain();
>  			$smtp_server_port ||= 25;
>  			$smtp ||= Net::SMTP->new($smtp_server,
>  						 Hello => $smtp_domain,
>  						 Debug => $debug_net_smtp,
>  						 Port => $smtp_server_port);
>  			if ($smtp_encryption eq 'tls' && $smtp) {
> -				require Net::SMTP::SSL;
> -				$smtp->command('STARTTLS');
> -				$smtp->response();
> -				if ($smtp->code == 220) {
> +				if ($use_net_smtp_ssl) {
> +					$smtp->command('STARTTLS');
> +					$smtp->response();
> +					if ($smtp->code != 220) {
> +						die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> +					}
> +					require Net::SMTP::SSL;
>  					$smtp = Net::SMTP::SSL->start_SSL($smtp,
>  									  ssl_verify_params())
> -						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
> -					$smtp_encryption = '';
> -					# Send EHLO again to receive fresh
> -					# supported commands
> -					$smtp->hello($smtp_domain);
> -				} else {
> -					die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message);
> +						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
> +				}
> +				else {
> +					$smtp->starttls(ssl_verify_params())
> +						or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());
>  				}
> +				$smtp_encryption = '';
> +				# Send EHLO again to receive fresh
> +				# supported commands
> +				$smtp->hello($smtp_domain);
>  			}
>  		}
>  
> -- 
> 2.12.0-488-gd3584ba
> 
Junio C Hamano· May 31, 2017, 22:39 UTC · re: Jonathan Nieder · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Jonathan Nieder <jrnieder@gmail.com> writes:
Show 22 quoted lines
> Dennis Kaarsemaker wrote:
>
>> Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine
>> since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28
>> isn't that old yet, keep the old code in place and use it when
>> necessary.
>
> This broke git send-email for me.  The error message is
>
>   Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.
>
> Is 1.28 the right minimum version?
>
>   $ perl -e 'require Net::SMTP; print version->parse($Net::SMTP::VERSION); print "\n"'
>   2.31
>   $ grep VERSION /usr/share/perl/5.18.2/Net/SMTP.pm
>   use vars qw($VERSION @ISA);
>   $VERSION = "2.31";
>   $ grep starttls /usr/share/perl/5.18.2/Net/SMTP.pm
>   $ dpkg-query -W perl
>   perl    5.18.2-2ubuntu1.1
>
Thanks.  

Let's revert the merge for now until we know (this time for certain) what the minimum version is.

Jonathan Nieder· May 31, 2017, 22:53 UTC · re: Junio C Hamano · lore

Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary

Hi,
Jun 01, 2017 at 07:39:16AM +0900, Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
Show 7 quoted lines
>> This broke git send-email for me.  The error message is
>>
>>   Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.
>>
>> Is 1.28 the right minimum version?
>>
>>   $ perl -e 'require Net::SMTP; print version->parse($Net::SMTP::VERSION); print "\n"'
[...]
Show 8 quoted lines
>>   $ grep starttls /usr/share/perl/5.18.2/Net/SMTP.pm
>>   $ dpkg-query -W perl
>>   perl    5.18.2-2ubuntu1.1
>
> Thanks.
>
> Let's revert the merge for now until we know (this time for certain)
> what the minimum version is.

Thanks. I just sent http://public-inbox.org/git/20170531224415.GC81679@aiede.mtv.corp.google.com in response to another thread. That uses 3.01 as minimum version, since it is the minimum version imported to core perl with starttls support.

I haven't tried testing with historical Net::SMTP versions, though. Is there a git repository available with all Net::SMTP versions from CPAN, or is https://perl5.git.perl.org/perl.git as good as it gets?

Regards, Jonathan

← back to recent threads