Re: git-send-email and "mailhost" misbehavior
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 16, 2010, 19:06 UTC
- Message-ID
- <7vy68tgkb7.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <AANLkTinAjqb7cuCaiu=UvT9m5R=RM5E0hf4zPuKYVmHn@mail.gmail.com>
Mike Frysinger <vapier@gentoo.org> writes:
Show 42 quoted lines
> i have sendemail in my ~/.gitconfig setup like so:
> [sendemail]
> smtpserver = localhost:1111
>
> and i have a ssh tunnel running there to forward my e-mail to another
> machine's localhost:25
>
> however, when i attempt to send e-mail from some systems, the `git
> send-email` process pauses for like 2 minutes without doing anything.
> after hassling my e-mail admin about greylisting (which is disabled
> for localhost), i looked at git-send-email a bit closer.
>
> running it through a heavy strace shows the source of the pause:
> connect(6, {sa_family=AF_INET, sin_port=htons(25),
> sin_addr=inet_addr("208.68.139.38")}, 16)
> then there's a timeout after 120 seconds trying to connect to this guy
>
> so wtf is "208.68.139.38" !? well, my shitty ISP (comcast) is doing
> DNS hijacking for unresolved DNS names. so git-send-email tried to
> look up some host and it got back "208.68.139.38". while comcast is
> wrong here, why is git-send-email looking up anything at all
> considering my sendemail.smtpserver is configured to localhost ?
>
> it seems that buried in the bowels of git-send-email and totally
> undocumented is this nugget:
> /usr/libexec/git-core/git-send-email:
> ...
> sub maildomain_mta {
> my $maildomain;
>
> if (eval { require Net::SMTP; 1 }) {
> for my $host (qw(mailhost localhost)) {
> my $smtp = Net::SMTP->new($host);
> ...
>
> so git-send-email is so kind as to attempt port 25 connections to
> "mailhost:25" and "localhost:25" while attempting to locate its FQDN
> !? this doesnt sound right at all. DNS lookups do not require actual
> TCP/IP connection attempts.
>
> stubbing out "mailhost" to 127.0.0.1 in /etc/hosts fixes my troubles.
> -mikeRedirecting to Jari Aalto for 134550f (git-send-email.perl - try to give real name of the calling host to HELO/EHLO, 2010-03-14)