diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org> | 2011-06-09 07:23:28 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-09 07:23:28 -0700 |
commit | 1faa9bddc2859c73ce8984b43eca816c30bdb5f1 (patch) | |
tree | c0cf0bd2f0f459e48997e6a8b68f4d933c21ed69 | |
parent | 786bb1096c704f03b6c677726ef0b9142a8d38a7 (diff) | |
download | portage-1faa9bddc2859c73ce8984b43eca816c30bdb5f1.tar.gz portage-1faa9bddc2859c73ce8984b43eca816c30bdb5f1.tar.bz2 portage-1faa9bddc2859c73ce8984b43eca816c30bdb5f1.zip |
use_reduce: disallow empty parens
This will fix bug #370565.
-rw-r--r-- | pym/portage/dep/__init__.py | 3 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_use_reduce.py | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 862154318..ba373241f 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -369,6 +369,9 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i if need_simple_token: raise InvalidDependString( _("expected: file name, got: '%s', token %s") % (token, pos+1)) + if len(mysplit) >= pos+2 and mysplit[pos+1] == ")": + raise InvalidDependString( + _("expected: dependency string, got: ')', token %s") % (pos+1,)) need_bracket = False stack.append([]) level += 1 diff --git a/pym/portage/tests/dep/test_use_reduce.py b/pym/portage/tests/dep/test_use_reduce.py index 7c7286ad8..b89752fb4 100644 --- a/pym/portage/tests/dep/test_use_reduce.py +++ b/pym/portage/tests/dep/test_use_reduce.py @@ -217,7 +217,7 @@ class UseReduce(TestCase): uselist = ["foo", "bar"], expected_result = [ "||", [ "A", "B" ] ]), UseReduceTestCase( - "A || ( ) foo? ( ) B", + "A || ( bar? ( C ) ) foo? ( bar? ( C ) ) B", expected_result = ["A", "B"]), UseReduceTestCase( "|| ( A ) || ( B )", @@ -350,7 +350,7 @@ class UseReduce(TestCase): opconvert = True, expected_result = [['||', 'A', 'B']]), UseReduceTestCase( - "A || ( ) foo? ( ) B", + "A || ( bar? ( C ) ) foo? ( bar? ( C ) ) B", opconvert = True, expected_result = ["A", "B"]), UseReduceTestCase( @@ -509,7 +509,7 @@ class UseReduce(TestCase): flat = True, expected_result = [ "||", "||", "A", "||", "B" ]), UseReduceTestCase( - "A || ( ) foo? ( ) B", + "A || ( bar? ( C ) ) foo? ( bar? ( C ) ) B", flat = True, expected_result = ["A", "||", "B"]), UseReduceTestCase( |