emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51441: closed ([PATCH] substitutes: keep base's uri-path for Properl


From: GNU bug Tracking System
Subject: bug#51441: closed ([PATCH] substitutes: keep base's uri-path for Properly construct URL.)
Date: Sat, 11 Dec 2021 23:35:01 +0000

Your message dated Sun, 12 Dec 2021 00:34:36 +0100
with message-id <87sfuy4sxf.fsf_-_@gnu.org>
and subject line Re: bug#51441: [PATCH] substitutes: keep base's uri-path for 
Properly construct URL.
has caused the debbugs.gnu.org bug report #51441,
regarding [PATCH] substitutes: keep base's uri-path for Properly construct URL.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
51441: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=51441
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] substitutes: keep base's uri-path for Properly construct URL. Date: Wed, 27 Oct 2021 21:53:55 +0800 User-agent: mu4e 1.6.6; emacs 28.0.50
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@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@karetnikov.org>
 ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
 ;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2021 Zheng Junjie <873216071@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

--- End Message ---
--- Begin Message --- Subject: Re: bug#51441: [PATCH] substitutes: keep base's uri-path for Properly construct URL. Date: Sun, 12 Dec 2021 00:34:36 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Hi,

Peng Mei Yu <pengmeiyu@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’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]