Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
Date: Mon, 20 Nov 2017 18:44:50
Message-Id: 1511203080.b4a444819986e6f4d987ec746dc00508190f1e3c.mgorny@gentoo
1 commit: b4a444819986e6f4d987ec746dc00508190f1e3c
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 19 16:56:50 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 20 18:38:00 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4a44481
7
8 portage.manifest: Fix mis-parsing Manifests with numerical checksums
9
10 Fix the regular expression used to parse Manifests not to fail horribly
11 when one of the checksums accidentally happens to be all-digits.
12
13 The previously used regular expression used to greedily take everything
14 up to the first number as filename. If one of the checksums happened to
15 be purely numeric, this meant that everything up to that checksum was
16 taken as filename, and the checksum itself was taken as file size. It
17 was also capable of accepting an empty filename.
18
19 The updated regular expression uses '\S+' to match filenames. Therefore,
20 the match is terminated on first whitespace character and filenames can
21 no longer contain spaces. Not that it could ever work reliably.
22
23 Spotted by Ulrich Müller.
24
25 Bug: https://bugs.gentoo.org/638148
26 Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
27
28 pym/portage/manifest.py | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31 diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
32 index 4ec20515e..4bca61e86 100644
33 --- a/pym/portage/manifest.py
34 +++ b/pym/portage/manifest.py
35 @@ -30,7 +30,7 @@ from portage.const import (MANIFEST2_HASH_DEFAULTS, MANIFEST2_IDENTIFIERS)
36 from portage.localization import _
37
38 _manifest_re = re.compile(
39 - r'^(' + '|'.join(MANIFEST2_IDENTIFIERS) + r') (.*)( \d+( \S+ \S+)+)$',
40 + r'^(' + '|'.join(MANIFEST2_IDENTIFIERS) + r') (\S+)( \d+( \S+ \S+)+)$',
41 re.UNICODE)
42
43 if sys.hexversion >= 0x3000000: