GNU bug report logs -
#51441
[PATCH] substitutes: keep base's uri-path for Properly construct URL.
Previous Next
Reported by: Z572 <873216071 <at> qq.com>
Date: Wed, 27 Oct 2021 14:12:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51441 in the body.
You can then email your comments to 51441 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#51441
; Package
guix-patches
.
(Wed, 27 Oct 2021 14:12:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Z572 <873216071 <at> qq.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Wed, 27 Oct 2021 14:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
Sorry for my english, and i'm not sure ChangeLog is right.
https://mirror.sjtu.edu.cn/guix use customize script to mirror official
substitutes server, at /guix not in / . narinfo-request will forget add /guix to url, so i
can't use substitutes from them, this patch fix it.
[0001-substitutes-keep-base-s-uri-path-for-Properly-constr.patch (text/x-patch, inline)]
From 7fe17965d5336d55ec8b1b7471cbbb34b12e9a0b Mon Sep 17 00:00:00 2001
From: Z572 <873216071 <at> qq.com>
Date: Wed, 27 Oct 2021 21:28:24 +0800
Subject: [PATCH] substitutes: keep base's uri-path for Properly construct URL.
substitutes (narinfo-request): keep BASE's uri-path for properly construct url.
some substitutes server don't use guix publish, them use customize scripts to
mirror official server, if them look likes https://example.com/guix ,
narinfo-request will lost /guix .
---
guix/substitutes.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/guix/substitutes.scm b/guix/substitutes.scm
index a5c554acff..bfbd29623e 100644
--- a/guix/substitutes.scm
+++ b/guix/substitutes.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014 Nikita Karetnikov <nikita <at> karetnikov.org>
;;; Copyright © 2018 Kyle Meyer <kyle <at> kyleam.com>
;;; Copyright © 2020 Christopher Baines <mail <at> cbaines.net>
+;;; Copyright © 2021 Zheng Junjie <873216071 <at> qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
"Return an HTTP request for the narinfo of PATH at CACHE-URL."
(let* ((base (string->uri cache-url))
(ref (build-relative-ref
- #:path (string-append (store-path-hash-part path) ".narinfo")))
+ #:path (string-append (uri-path base) "/"
+ (store-path-hash-part path) ".narinfo")))
(url (resolve-uri-reference ref base))
(headers '((User-Agent . "GNU Guile"))))
(build-request url #:method 'GET #:headers headers)))
--
2.33.1
[Message part 3 (text/plain, inline)]
--
over
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51441
; Package
guix-patches
.
(Wed, 27 Oct 2021 16:42:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 51441 <at> debbugs.gnu.org (full text, mbox):
it just fix fetch narinfos url, substitute still don't download, later i
will try fix it.
Z572 via Guix-patches via <guix-patches <at> gnu.org> writes:
> Hello,
>
> Sorry for my english, and i'm not sure ChangeLog is right.
>
> https://mirror.sjtu.edu.cn/guix use customize script to mirror official
> substitutes server, at /guix not in / . narinfo-request will forget add /guix to url, so i
> can't use substitutes from them, this patch fix it.
>
> From 7fe17965d5336d55ec8b1b7471cbbb34b12e9a0b Mon Sep 17 00:00:00 2001
> From: Z572 <873216071 <at> qq.com>
> Date: Wed, 27 Oct 2021 21:28:24 +0800
> Subject: [PATCH] substitutes: keep base's uri-path for Properly construct URL.
>
> substitutes (narinfo-request): keep BASE's uri-path for properly construct url.
>
> some substitutes server don't use guix publish, them use customize scripts to
> mirror official server, if them look likes https://example.com/guix ,
> narinfo-request will lost /guix .
> ---
> guix/substitutes.scm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/guix/substitutes.scm b/guix/substitutes.scm
> index a5c554acff..bfbd29623e 100644
> --- a/guix/substitutes.scm
> +++ b/guix/substitutes.scm
> @@ -3,6 +3,7 @@
> ;;; Copyright © 2014 Nikita Karetnikov <nikita <at> karetnikov.org>
> ;;; Copyright © 2018 Kyle Meyer <kyle <at> kyleam.com>
> ;;; Copyright © 2020 Christopher Baines <mail <at> cbaines.net>
> +;;; Copyright © 2021 Zheng Junjie <873216071 <at> qq.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
> "Return an HTTP request for the narinfo of PATH at CACHE-URL."
> (let* ((base (string->uri cache-url))
> (ref (build-relative-ref
> - #:path (string-append (store-path-hash-part path) ".narinfo")))
> + #:path (string-append (uri-path base) "/"
> + (store-path-hash-part path) ".narinfo")))
> (url (resolve-uri-reference ref base))
> (headers '((User-Agent . "GNU Guile"))))
> (build-request url #:method 'GET #:headers headers)))
> --
> 2.33.1
--
over
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51441
; Package
guix-patches
.
(Fri, 29 Oct 2021 02:17:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 51441 <at> debbugs.gnu.org (full text, mbox):
Z572 via Guix-patches via <guix-patches <at> gnu.org> writes:
> it just fix fetch narinfos url, substitute still don't download, later i
> will try fix it.
>
Because guix-daemon is old , it fork a old `guix substitute`, use old
(guix substitutes) module. so just need update guix-daemon:
1. guix system reconfigure path/to/config
2. herd restart guix-daemon
substitute will download.
It Works On My Machine :)
--
over
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51441
; Package
guix-patches
.
(Fri, 29 Oct 2021 04:20:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 51441 <at> debbugs.gnu.org (full text, mbox):
Hi,
Z572 via Guix-patches via writes:
> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
> "Return an HTTP request for the narinfo of PATH at CACHE-URL."
> (let* ((base (string->uri cache-url))
> (ref (build-relative-ref
> - #:path (string-append (store-path-hash-part path) ".narinfo")))
> + #:path (string-append (uri-path base) "/"
> + (store-path-hash-part path) ".narinfo")))
> (url (resolve-uri-reference ref base))
> (headers '((User-Agent . "GNU Guile"))))
> (build-request url #:method 'GET #:headers headers)))
> --
It seems that the root cause for the problem is that cache-url lacks a
trailing slash. Therefore the last path component is stripped from
`base` when we compute (resolve-uri-reference ref base). So I think
ensuring cache-url ends with a slash ("/") is a better approach.
--
Peng Mei Yu
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51441
; Package
guix-patches
.
(Fri, 29 Oct 2021 04:36:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 51441 <at> debbugs.gnu.org (full text, mbox):
Peng Mei Yu <pengmeiyu <at> riseup.net> writes:
> Hi,
>
> Z572 via Guix-patches via writes:
>
>> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
>> "Return an HTTP request for the narinfo of PATH at CACHE-URL."
>> (let* ((base (string->uri cache-url))
>> (ref (build-relative-ref
>> - #:path (string-append (store-path-hash-part path) ".narinfo")))
>> + #:path (string-append (uri-path base) "/"
>> + (store-path-hash-part path) ".narinfo")))
>> (url (resolve-uri-reference ref base))
>> (headers '((User-Agent . "GNU Guile"))))
>> (build-request url #:method 'GET #:headers headers)))
>> --
>
> It seems that the root cause for the problem is that cache-url lacks a
> trailing slash. Therefore the last path component is stripped from
> `base` when we compute (resolve-uri-reference ref base). So I think
> ensuring cache-url ends with a slash ("/") is a better approach.
Yes, you are right.
--
over
Information forwarded
to
guix-patches <at> gnu.org
:
bug#51441
; Package
guix-patches
.
(Wed, 10 Nov 2021 11:32:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 51441 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Can someone help review this patch? Thx a lot!.
--
Retrieve my PGP public key:
gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F
Zihao
[signature.asc (application/pgp-signature, inline)]
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Sat, 11 Dec 2021 23:35:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Z572 <873216071 <at> qq.com>
:
bug acknowledged by developer.
(Sat, 11 Dec 2021 23:35:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 51441-done <at> debbugs.gnu.org (full text, mbox):
Hi,
Peng Mei Yu <pengmeiyu <at> riseup.net> skribis:
> Z572 via Guix-patches via writes:
>
>> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
>> "Return an HTTP request for the narinfo of PATH at CACHE-URL."
>> (let* ((base (string->uri cache-url))
>> (ref (build-relative-ref
>> - #:path (string-append (store-path-hash-part path) ".narinfo")))
>> + #:path (string-append (uri-path base) "/"
>> + (store-path-hash-part path) ".narinfo")))
>> (url (resolve-uri-reference ref base))
>> (headers '((User-Agent . "GNU Guile"))))
>> (build-request url #:method 'GET #:headers headers)))
>> --
>
> It seems that the root cause for the problem is that cache-url lacks a
> trailing slash. Therefore the last path component is stripped from
> `base` when we compute (resolve-uri-reference ref base). So I think
> ensuring cache-url ends with a slash ("/") is a better approach.
Indeed. I’ve implemented your suggestion in
e68466de122d94ac3fa75aae234cd5fd89482a5a, and commit
cba0395c99005f94e4ccd6c058362af7443dab12 makes a related adjustment.
Note that we still need to update the ‘guix’ package so you can benefit
from the bug fix. In the meantime you have to pass that trailing slash.
Thank you, and sorry for the delay!
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 09 Jan 2022 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 102 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.