Gentoo Archives: gentoo-portage-dev

From: Ulrich Mueller <ulm@g.o>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o, Mike Gilbert <floppym@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Escape percent-signs in filename when fetching from mirrors
Date: Sun, 31 May 2020 15:37:26
Message-Id: ur1v0nmja@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Escape percent-signs in filename when fetching from mirrors by Zac Medico
1 >>>>> On Sun, 31 May 2020, Zac Medico wrote:
2
3 > In order to ensure that the filename will not have an extra level of quoting
4 > in the mirror path, we'll have to do something like this wherever we
5 > translate a uri in SRC_URI to a filename:
6
7 > diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py
8 > index 08af17bcd..99d8ab720 100644
9 > --- a/lib/portage/dbapi/porttree.py
10 > +++ b/lib/portage/dbapi/porttree.py
11 > @@ -1547,7 +1547,7 @@ def _parse_uri_map(cpv, metadata, use=None):
12 > myuris.pop()
13 > distfile = myuris.pop()
14 > else:
15 > - distfile = os.path.basename(uri)
16 > + distfile = unquote(os.path.basename(uri))
17 > if not distfile:
18 > raise portage.exception.InvalidDependString(
19 > ("getFetchMap(): '%s' SRC_URI has no file " + \
20
21 I think that unescaping is correct, but you'll need a subsequent sanity
22 check to make sure that the resulting filename doesn't contain any
23 characters that aren't allowed in the Manifest.
24
25 Namely, "excluding the backwards slash (\) and characters classified as
26 control characters or as whitespace" (GLEP 74).
27
28 Ulrich

Attachments

File name MIME type
signature.asc application/pgp-signature