diff --git a/guix/ftp-client.scm b/guix/ftp-client.scm index a6a54a4d9c8671df96e8c889f60fd388c3c4af20..22d4c7dde23f06fcc59e4d44e3315f8d202abb96 100644 --- a/guix/ftp-client.scm +++ b/guix/ftp-client.scm @@ -121,15 +121,18 @@ (define (raise-error errno) (raise-error errno))))) (connect s sockaddr))) -(define* (ftp-open host #:optional (port 21) #:key timeout) +(define* (ftp-open host #:optional (port "ftp") #:key timeout) "Open an FTP connection to HOST on PORT (a service-identifying string, or a TCP port number), and return it. When TIMEOUT is not #f, it must be a (possibly inexact) number denoting the maximum duration in seconds to wait for the connection to complete; passed TIMEOUT, an ETIMEDOUT error is raised." - ;; Use 21 as the default PORT instead of "ftp", to avoid depending on - ;; libc's NSS, which is not available during bootstrap. + ;; Using "ftp" for PORT instead of 21 allows 'getaddrinfo' to return only + ;; TCP/IP addresses (otherwise it would return SOCK_DGRAM and SOCK_RAW + ;; addresses as well.) With our bootstrap Guile, which includes a + ;; statically-linked NSS, resolving "ftp" works well, as long as + ;; /etc/services is available. (define addresses (getaddrinfo host diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index a7618ee2868b20fb541cdb3336a4939e233c7d95..034f0f95ee2b7e61bea23d7ff890a039d69af8ed 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -316,7 +316,7 @@ (define response ('ftp (catch #t (lambda () - (let ((conn (ftp-open (uri-host uri) 21 #:timeout timeout))) + (let ((conn (ftp-open (uri-host uri) #:timeout timeout))) (define response (dynamic-wind (const #f)