GNU bug report logs -
#26191
Allow custom FTP logins.
Previous Next
Reported by: Roel Janssen <roel <at> gnu.org>
Date: Mon, 20 Mar 2017 12:11:01 UTC
Severity: normal
Done: Roel Janssen <roel <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Roel Janssen <roel <at> gnu.org> writes:
>>From e7263ce1d1a242f187c9801b14ea47043f59be8e Mon Sep 17 00:00:00 2001
> From: Roel Janssen <roel <at> gnu.org>
> Date: Mon, 20 Mar 2017 12:59:59 +0100
> Subject: [PATCH 2/2] download: Handle username and password properties for FTP
> uris.
>
> guix/build/download.scm (ftp-fetch): Process username and password from a URI.
> ---
> guix/build/download.scm | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/guix/build/download.scm b/guix/build/download.scm
> index 36c815c16..f48da7500 100644
> --- a/guix/build/download.scm
> +++ b/guix/build/download.scm
> @@ -241,7 +241,14 @@ and 'guix publish', something like
> (define* (ftp-fetch uri file #:key timeout)
> "Fetch data from URI and write it to FILE. Return FILE on success. Bail
> out if the connection could not be established in less than TIMEOUT seconds."
> - (let* ((conn (ftp-open (uri-host uri) #:timeout timeout))
> + (let* ((userinfo (string-split (uri-userinfo uri) #\:))
> + (username (if (and (> (length userinfo) 0)
> + (not (string= (car userinfo) "")))
> + (car userinfo) #f))
> + (password (if (> (length userinfo) 1) (cadr userinfo) #f))
> + (conn (ftp-open (uri-host uri) #:timeout timeout
> + #:username username
> + #:password password))
> (size (false-if-exception (ftp-size conn (uri-path uri))))
> (in (ftp-retr conn (basename (uri-path uri))
> (dirname (uri-path uri)))))
Hi Roel,
The code looks good and seems to work fine, but seeing that this is my
first time reviewing a patch to the "inner workings" of Guix, I'll defer
to the opinion of someone more experienced.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 8 years and 69 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.