fetch2: Set maxsplit to match expected variables
A message that is not in the archive (sent off-list or not yet received): [email protected]
Bitbucket added a new feature that provides limited access to a specific repository using a Repository Access Tokens. This token comes in the form token-auth:key.
https://support.atlassian.com/bitbucket-cloud/docs/repository-access-tokens/
https://support.atlassian.com/bitbucket-cloud/docs/using-access-tokens/#Include-the-Repository-Access-Token-in-the-URL
The token can be used in the user parameter of SRC_URI as this parameter is in the form user=userid:password, and works correctly excluding the cases when the password contains a "=" symbol.
The error comes from the split logic, which doesn't manage the case when the value contains the symbol "=".
The proposed change guarantees that only two variables will be returned, splitted in "key" and "value" and the value can contain, especially in cases when it is a password, the "=" character.
As requested, we also add a test case , run the test with bitbake-selftest bb.tests.fetch. The result is successful.
Quoted 64 lines · Dit Kozmaj via lists.openembedded.org
From: Dit Kozmaj <[email protected]>
Set the maxsplit value to match the expected number of variables. This also avoids an unnecessary split as the parameters are in the form 'key=value'
and the 'value' could contain the '=' character.Signed-off-by Dit Kozmaj <[email protected]>--- bitbake/lib/bb/fetch2/__init__.py | 2 +- bitbake/lib/bb/tests/fetch.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)bitbake/lib/bb/fetch2/__init__.py +1
-1@@ -388,7 +388,7 @@ def decodeurl(url): if s: if not '=' in s: raise MalformedUrl(url, "The URL: '%s' is invalid: parameter %s does not specify a value (missing '=')" % (url, s)) - s1, s2 = s.split('=') + s1, s2 = s.split('=', 1) p[s1] = s2return type, host,
urllib.parse.unquote(path), user, pswd, pbitbake/lib/bb/tests/fetch.py +0
-0@@ -1197,6 +1197,7 @@ class URLHandle(unittest.TestCase): "cvs://anoncvs:[email protected]/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous',
collections.OrderedDict([('tag', 'V0-99-81'), ('module', 'familiar/dist/ipkg')])),"git://git.openembedded.org/bitbake;branch=@foo" : ('git', ' git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'}), "file://somelocation;someparam=1": ('file', '', 'somelocation','', '', {'someparam': '1'}),
+ "https://somesite.com/somerepo.git;user=anyUser:idtoken=1234" :
('https', 'somesite.com', '/somerepo.git', '', '', {'user':
'anyUser:idtoken=1234'}),
}
# we require a pathname to encodeurl but users can still pass such
urls to# decodeurl and we need to handle them -- 2.25.1-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#14887):
https://lists.openembedded.org/g/bitbake-devel/message/14887
Mute This Topic: https://lists.openembedded.org/mt/100350479/7542774
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-