Skip to content

git send-email fails due to used system Perl #1795

Closed
pmenzel opened this issue Mar 29, 2020 · 10 comments
Closed

git send-email fails due to used system Perl #1795

pmenzel opened this issue Mar 29, 2020 · 10 comments

Comments

@pmenzel
Copy link
Collaborator

pmenzel commented Mar 29, 2020

$ git send-email outgoing/*
[…]
Can't locate Net/SMTP/SSL.pm in @INC (@INC contains: /usr/share/perl5 /usr/local/lib/perl5/site_perl/5.12.1/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.12.1 /usr/local/lib/perl5/vendor_perl/5.12.1/x86_64-linux-thread-multi /usr/local/lib/perl5/vendor_perl/5.12.1 /usr/local/lib/perl5/5.12.1/x86_64-linux-thread-multi /usr/local/lib/perl5/5.12.1 .) at /usr/libexec/git-core/git-send-email line 1542.

Same with prun perl-5.28.1-0 git send-email ….

@donald
Copy link
Collaborator

donald commented Mar 29, 2020

Maybe it would work, if you didn't put smtpEncryption = tls into your .gitconfig.

This is the old perl installation, which (since two years or so) is planned to be replaced. The modules are not registered anywhere, they were just installed on the distmaster over several years. So I didn't make things worse by just adding Net::SMTP::SSL.

Try again tomorrow.

@pmenzel
Copy link
Collaborator Author

pmenzel commented Apr 27, 2020

Thanks, on to the next error:

STARTTLS failed! SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/libexec/git-core/git-send-email line 1543.

@donald
Copy link
Collaborator

donald commented Apr 27, 2020

perldoc Net::SMPT::SSL :

Hey! Read this!

Since Net::SMTP v1.28 (2014-10-08), Net::SMTP itself has support for SMTP over SSL, and also for STARTTLS.
Use Net::SMTP, not Net::SMTP::SSL.

Fix git? :-)

@donald
Copy link
Collaborator

donald commented Apr 27, 2020

This works:

#! /usr/bin/perl
use strict;
use Net::SMTP::SSL;

my $smtps = Net::SMTP::SSL->new("harry.molgen.mpg.de", Port => 465);
$smtps->mail('buczek@molgen.mpg.de');
$smtps->to('buczek@molgen.mpg.de');
$smtps->data();
$smtps->datasend("From: buczek\@molgen.mpg.de\n");
$smtps->datasend("To: buczek\@molgen.mpg.de\n");
$smtps->datasend("Subject: test ".scalar(localtime)."\n");
$smtps->datasend("\n");
$smtps->datasend("Test");
$smtps->dataend();
$smtps->quit();

@donald
Copy link
Collaborator

donald commented Apr 27, 2020

/usr/libexec/git-core/git-send-email wouldn't use NET::SMTP::SSL if Net::SMTP had version 2.24 2.34 or above (lines 1497ff). Maybe we just need to update Net::SMTP.

@pmenzel
Copy link
Collaborator Author

pmenzel commented Apr 27, 2020

You mean 2.34:

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

@donald
Copy link
Collaborator

donald commented Apr 27, 2020

When I change the shebang of /usr/libexec/git-core/git-send-email to #!/usr/bin/env perl then these two work:

prun perl git send-email test.txt --to "buczek@molgen.mpg.de"
(. /package/pkg/perl-5.12.1-0/profile ;  git send-email test.txt --to "buczek@molgen.mpg.de" )

I'm working on #1419 again (see mariux64/pkg-scripts#113 ). When this is done, /usr/bin/perl will invoke a perl from /pkg. So I guess, this problem will be fixed by the way.

@pmenzel
Copy link
Collaborator Author

pmenzel commented Apr 27, 2020

For the record, here the failing code in question:

                                    require Net::SMTP::SSL;
                                    $smtp = Net::SMTP::SSL->start_SSL($smtp,
                                                                      ssl_verify_params())
                                            or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr());

Thanks for the prun perl test. I thought, I tried that last time with prun perl-5.28.1-0 git send-email … (see original report).

@donald
Copy link
Collaborator

donald commented Apr 27, 2020

prun has no effect, if the script contains a #! /usr/bin/perl shebang as it is here the case.

@donald
Copy link
Collaborator

donald commented Apr 30, 2020

git send-email test.txt --to "buczek@molgen.mpg.de" with smtpEncryption = tls in .gitconfig now works out of the box, because of #1808

@donald donald closed this as completed Apr 30, 2020
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants