1 |
On 11/19/2017 09:12 AM, Michał Górny wrote: |
2 |
> Fix the regular expression used to parse Manifests not to fail horribly |
3 |
> when one of the checksums accidentally happens to be all-digits. |
4 |
> |
5 |
> The previously used regular expression used to greedily take everything |
6 |
> up to the first number as filename. If one of the checksums happened to |
7 |
> be purely numeric, this meant that everything up to that checksum was |
8 |
> taken as filename, and the checksum itself was taken as file size. It |
9 |
> was also capable of accepting an empty filename. |
10 |
> |
11 |
> The updated regular expression uses '\S+' to match filenames. Therefore, |
12 |
> the match is terminated on first whitespace character and filenames can |
13 |
> no longer contain spaces. Not that it could ever work reliably. |
14 |
> |
15 |
> Spotted by Ulrich Müller. |
16 |
> |
17 |
> Bug: https://bugs.gentoo.org/638148 |
18 |
> --- |
19 |
> pym/portage/manifest.py | 2 +- |
20 |
> 1 file changed, 1 insertion(+), 1 deletion(-) |
21 |
> |
22 |
> diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py |
23 |
> index 4ec20515e..4bca61e86 100644 |
24 |
> --- a/pym/portage/manifest.py |
25 |
> +++ b/pym/portage/manifest.py |
26 |
> @@ -30,7 +30,7 @@ from portage.const import (MANIFEST2_HASH_DEFAULTS, MANIFEST2_IDENTIFIERS) |
27 |
> from portage.localization import _ |
28 |
> |
29 |
> _manifest_re = re.compile( |
30 |
> - r'^(' + '|'.join(MANIFEST2_IDENTIFIERS) + r') (.*)( \d+( \S+ \S+)+)$', |
31 |
> + r'^(' + '|'.join(MANIFEST2_IDENTIFIERS) + r') (\S+)( \d+( \S+ \S+)+)$', |
32 |
> re.UNICODE) |
33 |
> |
34 |
> if sys.hexversion >= 0x3000000: |
35 |
> |
36 |
|
37 |
Looks good, please merge. |
38 |
-- |
39 |
Thanks, |
40 |
Zac |