Gentoo Archives: gentoo-portage-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Ulrich Mueller <ulm@g.o>, Zac Medico <zmedico@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Improve handling of percent-signs in SRC_URI
Date: Sun, 31 May 2020 20:36:22
Message-Id: CAJ0EP42Wb7GZLKMYHT_rc6uCgp4ivGQ_FaCV+dBGkjnF_EoWGQ@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH] Improve handling of percent-signs in SRC_URI by Zac Medico
1 On Sun, May 31, 2020 at 4:32 PM Zac Medico <zmedico@g.o> wrote:
2 >
3 > On 5/31/20 1:24 PM, Ulrich Mueller wrote:
4 > >>>>>> On Sun, 31 May 2020, Zac Medico wrote:
5 > >
6 > >> We've also got these other basename calls in fetch.py:
7 > >
8 > >>> diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py
9 > >>> index 28e7caf53..56b375d58 100644
10 > >>> --- a/lib/portage/package/ebuild/fetch.py
11 > >>> +++ b/lib/portage/package/ebuild/fetch.py
12 > >>> @@ -730,9 +730,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
13 > >>> else:
14 > >>> for myuri in myuris:
15 > >>> if urlparse(myuri).scheme:
16 > >>> - file_uri_tuples.append((os.path.basename(myuri), myuri))
17 > >>> + file_uri_tuples.append((urlunquote(os.path.basename(myuri)), myuri))
18 > >>> else:
19 > >>> - file_uri_tuples.append((os.path.basename(myuri), None))
20 > >>> + file_uri_tuples.append((urlunquote(os.path.basename(myuri)), None))
21 > >
22 > >> The case with no scheme is not a URI, so we need to decide whether
23 > >> or not to unquote, and we should make _parse_uri_map behavior
24 > >> consistent for this case.
25 > >
26 > > I think that this follows from PMS, section 8.2 [1]:
27 > >
28 > > | The following elements are recognised in at least one class of
29 > > | specification. All elements must be surrounded on both sides by
30 > > | whitespace, except at the start and end of the string.
31 > > |
32 > > | [...]
33 > > | - A URI, in the form proto://host/path. Permitted in SRC_URI and
34 > > | HOMEPAGE. In EAPIs listed in table 8.4 as supporting SRC_URI arrows,
35 > > | may optionally be followed by whitespace, then ->, then whitespace,
36 > > | then a simple filename when in SRC_URI. For SRC_URI behaviour, see
37 > > | section 8.2.10.
38 > > | - A flat filename. Permitted in SRC_URI.
39 > >
40 > > So if it isn't an URI then it is a "flat filename" which IMHO is to be
41 > > interpreted literally without any unquoting.
42 > >
43 > > Ulrich
44 > >
45 > > [1] https://projects.gentoo.org/pms/7/pms.html#x1-690008.2
46 > >
47 >
48 > This interpretation sounds good to me.
49
50 Agreed.