{"thread":{"id":"25754","subject":"git-send-email and \"mailhost\" misbehavior","startedAt":"2010-11-15T20:24:02Z","lastAt":"2010-11-16T19:06:20Z","messageCount":2,"participants":["Mike Frysinger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"155945","messageId":"AANLkTinAjqb7cuCaiu=UvT9m5R=RM5E0hf4zPuKYVmHn@mail.gmail.com","threadId":"25754","inReplyTo":null,"subject":"git-send-email and \"mailhost\" misbehavior","fromName":"Mike Frysinger","fromEmail":"vapier@gentoo.org","sentAt":"2010-11-15T20:24:02Z","receivedAt":"2010-11-15T20:24:02Z","isPatch":false,"sender":{"key":"vapier@gentoo.org","avatar":"https://gravatar.com/avatar/e84e90ef943ceda7d1138ced7f3cc3f866dc1fdf9cb76313ffba167fb73fa057?d=mp&s=160"},"body":"i have sendemail in my ~/.gitconfig setup like so:\n[sendemail]\n    smtpserver = localhost:1111\n\nand i have a ssh tunnel running there to forward my e-mail to another\nmachine's localhost:25\n\nhowever, when i attempt to send e-mail from some systems, the `git\nsend-email` process pauses for like 2 minutes without doing anything.\nafter hassling my e-mail admin about greylisting (which is disabled\nfor localhost), i looked at git-send-email a bit closer.\n\nrunning it through a heavy strace shows the source of the pause:\nconnect(6, {sa_family=AF_INET, sin_port=htons(25),\nsin_addr=inet_addr(\"208.68.139.38\")}, 16)\nthen there's a timeout after 120 seconds trying to connect to this guy\n\nso wtf is \"208.68.139.38\" !?  well, my shitty ISP (comcast) is doing\nDNS hijacking for unresolved DNS names.  so git-send-email tried to\nlook up some host and it got back \"208.68.139.38\".  while comcast is\nwrong here, why is git-send-email looking up anything at all\nconsidering my sendemail.smtpserver is configured to localhost ?\n\nit seems that buried in the bowels of git-send-email and totally\nundocumented is this nugget:\n/usr/libexec/git-core/git-send-email:\n...\nsub maildomain_mta {\n    my $maildomain;\n\n    if (eval { require Net::SMTP; 1 }) {\n        for my $host (qw(mailhost localhost)) {\n            my $smtp = Net::SMTP->new($host);\n...\n\nso git-send-email is so kind as to attempt port 25 connections to\n\"mailhost:25\" and \"localhost:25\" while attempting to locate its FQDN\n!?  this doesnt sound right at all.  DNS lookups do not require actual\nTCP/IP connection attempts.\n\nstubbing out \"mailhost\" to 127.0.0.1 in /etc/hosts fixes my troubles.\n-mike\n"},{"id":"156011","messageId":"7vy68tgkb7.fsf@alter.siamese.dyndns.org","threadId":"25754","inReplyTo":"AANLkTinAjqb7cuCaiu=UvT9m5R=RM5E0hf4zPuKYVmHn@mail.gmail.com","subject":"Re: git-send-email and \"mailhost\" misbehavior","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-11-16T19:06:20Z","receivedAt":"2010-11-16T19:06:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mike Frysinger <vapier@gentoo.org> writes:\n\n> i have sendemail in my ~/.gitconfig setup like so:\n> [sendemail]\n>     smtpserver = localhost:1111\n>\n> and i have a ssh tunnel running there to forward my e-mail to another\n> machine's localhost:25\n>\n> however, when i attempt to send e-mail from some systems, the `git\n> send-email` process pauses for like 2 minutes without doing anything.\n> after hassling my e-mail admin about greylisting (which is disabled\n> for localhost), i looked at git-send-email a bit closer.\n>\n> running it through a heavy strace shows the source of the pause:\n> connect(6, {sa_family=AF_INET, sin_port=htons(25),\n> sin_addr=inet_addr(\"208.68.139.38\")}, 16)\n> then there's a timeout after 120 seconds trying to connect to this guy\n>\n> so wtf is \"208.68.139.38\" !?  well, my shitty ISP (comcast) is doing\n> DNS hijacking for unresolved DNS names.  so git-send-email tried to\n> look up some host and it got back \"208.68.139.38\".  while comcast is\n> wrong here, why is git-send-email looking up anything at all\n> considering my sendemail.smtpserver is configured to localhost ?\n>\n> it seems that buried in the bowels of git-send-email and totally\n> undocumented is this nugget:\n> /usr/libexec/git-core/git-send-email:\n> ...\n> sub maildomain_mta {\n>     my $maildomain;\n>\n>     if (eval { require Net::SMTP; 1 }) {\n>         for my $host (qw(mailhost localhost)) {\n>             my $smtp = Net::SMTP->new($host);\n> ...\n>\n> so git-send-email is so kind as to attempt port 25 connections to\n> \"mailhost:25\" and \"localhost:25\" while attempting to locate its FQDN\n> !?  this doesnt sound right at all.  DNS lookups do not require actual\n> TCP/IP connection attempts.\n>\n> stubbing out \"mailhost\" to 127.0.0.1 in /etc/hosts fixes my troubles.\n> -mike\n\nRedirecting to Jari Aalto for 134550f (git-send-email.perl - try to give\nreal name of the calling host to HELO/EHLO, 2010-03-14)\n"}]}