From: Zac Medico Date: Sat, 20 Sep 2008 16:55:27 +0000 (-0000) Subject: More SRC_URI validation. X-Git-Tag: v2.2_rc9~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=487802e2ce713ffda70f2911670772dad9c5e7d8;p=portage.git More SRC_URI validation. svn path=/main/trunk/; revision=11526 --- diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 67e7955d4..33c8b52f2 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -68,6 +68,10 @@ def _src_uri_validate(cpv, eapi, src_uri): raise portage.exception.InvalidDependString( ("getFetchMap(): '%s' SRC_URI '/' character in " + \ "file name: '%s'") % (cpv, x)) + if x[-1] == "?": + raise portage.exception.InvalidDependString( + ("getFetchMap(): '%s' SRC_URI arrow missing " + \ + "right operand") % (cpv,)) uri = None operator = None diff --git a/pym/portage/tests/dep/test_src_uri.py b/pym/portage/tests/dep/test_src_uri.py index 3b9f08052..84c9f29b6 100644 --- a/pym/portage/tests/dep/test_src_uri.py +++ b/pym/portage/tests/dep/test_src_uri.py @@ -16,6 +16,9 @@ class SrcUri(TestCase): ( "1", "http://foo/bar -> blah.tbz2" , False ), ( "2", "http://foo/bar -> blah.tbz2" , True ), ( "2", "foo? ( http://foo/bar -> blah.tbz2 )" , True ), + ( "2", "http://foo/bar -> foo? ( ftp://foo/a )" , False ), + ( "2", "http://foo/bar -> bar.tbz2 foo? ( ftp://foo/a )" , True ), + ( "2", "http://foo/bar blah.tbz2 ->" , False ), ( "2", "-> http://foo/bar blah.tbz2 )" , False ), ( "2", "http://foo/bar ->" , False ), ( "2", "foo? ( http://foo/bar -> ) blah.tbz2" , False ),