git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: send-email: Net::SMTP::SSL failure

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 7, 2017, 17:16 UTC
Message-ID
<CACBZZX6AKYA5PmE6Le4cxCTCOOix1ErHyT21C=L83CQBYaN=RQ@mail.gmail.com>
In-Reply-To
<CAKvHMgSgOyDhffPm=-QEQNzoCoPtmWbV_R7JDtBFTHQ-sL3Wug@mail.gmail.com>
On Wed, Jun 7, 2017 at 7:00 PM, Liam Breck <liam@networkimprov.net> wrote:
Show 39 quoted lines
> On Tue, Jun 6, 2017 at 10:47 PM, Liam Breck <liam@networkimprov.net> wrote:
>>
>> This is configured to send via a gmail account
>> git send-email --to-cover --cc-cover <patch-list>
>>
>> I See
>> Attempt to reload IO/Socket/SSL.pm aborted.
>> Compilation failed in require at
>> /usr/share/perl5/vendor_perl/Net/SMTP/SSL.pm line 6.
>> BEGIN failed--compilation aborted at
>> /usr/share/perl5/vendor_perl/Net/SMTP/SSL.pm line 6.
>> Compilation failed in require at /usr/lib/git-core/git-send-email line 1386.
>> fatal: 'send-email' appears to be a git command, but we were not
>> able to execute it. Maybe git-send-email is broken?
>>
>> Net/SMTP/SSL.pm v1.04
>>
>> perl v5.26.0
>>
>> Seen in git 2.11.1, 2.12.2, 2.13.0, 2.13.1 on Arch Linux
>
> Also fails with perl 5.24.1 & 5.24.0
>
> Last working config was git 2.9.3 on perl 5.24.1
>
> The relevant code from git-send-email is:
>
>             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');
>
> I really wish git bundled its non-core perl libs...
What's the output from just:
    perl -MNet::SMTP -we1

I have not looked deeply at this, but the error you're getting means "we tried to load it before and failed, and here you are trying again".

This is almost definitely due to this line in git-send-email:
        if (eval { require Net::SMTP; 1 }) {
And more generally, this code is all buggy:
    4 matches for "eval.*require" in buffer: git-send-email.perl
    153:my $have_email_valid = eval { require Email::Valid; 1 };
    154:my $have_mail_address = eval { require Mail::Address; 1 };
   1118:        if (eval { require Net::Domain; 1 }) {
   1129:        if (eval { require Net::SMTP; 1 }) {

Well, "buggy" in the sense that we're just happy-go-lucky trying to load these modules, and if they have an error we don't report it, then when we try to load them again perl just emits a generic error saying you're trying to require() something that already failed somewhere before, a minimal test case for that is:

    $ cat /tmp/Fails.pm
    package Fails;
    die "oh noes";
    $ perl -I/tmp -we 'eval { require Fails }; require Fails'
    Attempt to reload Fails.pm aborted.
    Compilation failed in require at -e line 1.
Whereas what we really want to do is some variant of:
    $ perl -MData::Dumper -I/tmp -we 'eval { require Fails } or warn
$@; require Fails'
    oh noes at /tmp/Fails.pm line 2.
    Compilation failed in require at -e line 1.
    Attempt to reload Fails.pm aborted.
    Compilation failed in require at -e line 1.

Or even the more adventerous, this can have some bad side-effects with some libraries (you lie to perl saying you haven't seen it before), but I doubt Net::SMTP cares much, particularly when we're just about to report an error:

    $ perl -MData::Dumper -I/tmp -we 'eval { require Fails } or do {
delete $INC{"Fails.pm"} }; require Fails'
    oh noes at /tmp/Fails.pm line 2.
    Compilation failed in require at -e line 1.
Previous: Liam BreckNext: Liam Breck
Message 3 of 12 in “send-email: Net::SMTP::SSL failure”
  1. Liam BreckJun 7, 2017
  2. Liam BreckJun 7, 2017
  3. Ævar Arnfjörð BjarmasonJun 7, 2017
  4. Liam BreckJun 7, 2017
  5. Ævar Arnfjörð BjarmasonJun 7, 2017
  6. Liam BreckJun 7, 2017
  7. Ævar Arnfjörð BjarmasonJun 7, 2017
  8. Liam BreckJun 7, 2017
  9. Samuel LijinJun 8, 2017
  10. Liam BreckJun 8, 2017
  11. Ævar Arnfjörð BjarmasonJun 8, 2017
  12. Junio C HamanoJun 9, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.