Subject: bug#26501: [PATCH 1/1] gnu: mutt: Update to 1.8.1.

From: [email-masked] (Ludovic Courtès)
Date: Tue, 18 Apr 2017 10:08:57 +0200

Leo Famulari <[email-masked]> skribis:

> On Mon, Apr 17, 2017 at 11:22:17PM +0200, Ludovic Courtès wrote:
>> Leo Famulari <[email-masked]> skribis:
>> 
>> > On Sun, Apr 16, 2017 at 11:57:25AM +0200, Ludovic Courtès wrote:
>> >> Leo Famulari <[email-masked]> skribis:
>> >> >>               (uri (string-append "ftp://ftp.mutt.org/pub/mutt/mutt-"
>> >> >>                                   version ".tar.gz"))
>> >> >
>> >> > I found that Guix's FTP client is having trouble with this URL. It hangs
>> >> > until it times out; other clients like wget and Firefox work fine.
>> >> 
>> >> I can’t reproduce this problem with Guix master (‘guix download’) and
>> >> Guile 2.2 or 2.0.  Do you have more details?
>> >
>> > Strace shows it hangs here:
>> >
>> > [pid  4066] connect(13, {sa_family=AF_INET6, sin6_port=htons(60512), inet_pton(AF_INET6, "2600:3402:200:227::2", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28
>> >
>> > When I disable IPv6, it works. I can use other FTP clients over IPv6 to
>> > download this file.
>> 
>> And what does strace give for those other FTP clients?  The port number
>> looks fishy.
>
> I'm out of my depth, but here is what I believe is the relevant portion
> of the strace output while using wget (full strace log attached):
>
> connect(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("140.211.166.134")}, 16) = -1 ENETUNREACH (Network is unreachable)
> close(3)                                = 0   
> socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP) = 3
> connect(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2600:3402:200:227::2", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = 0
> getsockname(3, {sa_family=AF_INET6, sin6_port=htons(59772), inet_pton(AF_INET6, "2601:47:4101:9916:2d39:1eca:471f:95be", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [28]) = 0
> connect(3, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0
> connect(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2600:3404:200:237::2", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = 0
> getsockname(3, {sa_family=AF_INET6, sin6_port=htons(33848), inet_pton(AF_INET6, "2601:47:4101:9916:2d39:1eca:471f:95be", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [28]) = 0
> connect(3, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0
> connect(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2605:bc80:3010::134", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = 0
> getsockname(3, {sa_family=AF_INET6, sin6_port=htons(55724), inet_pton(AF_INET6, "2601:47:4101:9916:2d39:1eca:471f:95be", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [28]) = 0

Weird, could you try this at the Guile REPL?

--8<---------------cut here---------------start------------->8---
scheme@(guix ftp-client)> ,use(srfi srfi-1)
scheme@(guix ftp-client)> (filter (lambda (ai)
				    (= AF_INET6 (addrinfo:fam ai)))
				  (getaddrinfo "ftp.mutt.org" "ftp"))
$12 = (#(0 10 1 6 #(10 50511718684201498269534063486220369922 21 0 0) #f) #(0 10 1 6 #(10 50511718842657823593210643852661096450 21 0 0) #f) #(0 10 1 6 #(10 50540448573204388932900632194751398196 21 0 0) #f))
scheme@(guix ftp-client)> (map (compose sockaddr:port addrinfo:addr) $12)
$13 = (21 21 21)
--8<---------------cut here---------------end--------------->8---

Here I get port 21 every time.  If I connect to the first one, I get:

  connect(14, {sa_family=AF_INET6, sin6_port=htons(21), inet_pton(AF_INET6, "2600:3402:200:227::2", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable)

… which is as expected (well, no IPv6 here, but the arguments to
‘connect’ look good.)

Thanks,
Ludo’.