Skip to contentSkip to conversation

fetch2: Set maxsplit to match expected variables

PATCH Superseded [email protected] 2 participants 3 messages Jul 25, 2023 – Jul 26, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: Set maxsplit to match expected variables

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.

---
 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
index 3e6555bd67..79b289eaec 100644
@@ -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] = s2
 
     return type, host, urllib.parse.unquote(path), user, pswd, p
bitbake/lib/bb/tests/fetch.py +1 -0
index 61dd5cccaf..a261ad69d8 100644
@@ -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
Signature · 1 line
2.25.1
#1 lore raw

Hello,

Quoted 6 lines · Dit Kozmaj

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.

Quoted 6 lines
---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 bitbake/lib/bb/tests/fetch.py     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

This doesn't apply one master, which branch did you use? Can you rebase?

Quoted 38 lines
bitbake/lib/bb/fetch2/__init__.py +1 -1
index 3e6555bd67..79b289eaec 100644
@@ -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] = s2
 
     return type, host, urllib.parse.unquote(path), user, pswd, p
bitbake/lib/bb/tests/fetch.py +1 -0
index 61dd5cccaf..a261ad69d8 100644
@@ -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
Signature · 11 lines
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/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#2 lore raw

Hello, I was using the Dunfell branch.
I forget to move to the master branch to apply the patch. Sorry about that. However I send a new Patch v2 that applies on the master branch and obviously test it.

Thanks.

Quoted 78 lines · Alexandre Belloni

Hello,

Quoted 4 lines · Dit Kozmaj

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'

Quoted 8 lines

and the 'value' could contain the '=' character.

---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 bitbake/lib/bb/tests/fetch.py     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

This doesn't apply one master, which branch did you use? Can you rebase?

Review

Quoted 1 line
(quoted diff) +0 -0

b/bitbake/lib/bb/fetch2/__init__.py

bitbake/lib/bb/fetch2/__init__.py def decodeurl(url): · line 390

Quoted 7 lines

index 3e6555bd67..79b289eaec 100644

bitbake/lib/bb/fetch2/__init__.py +0 -0
@@ -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))

Review

Quoted 6 lines
bitbake/lib/bb/fetch2/__init__.py +1 -1
-                s1, s2 = s.split('=')
+                s1, s2 = s.split('=', 1)
                 p[s1] = s2
 
     return type, host, urllib.parse.unquote(path), user, pswd, p
(quoted diff) +0 -0

b/bitbake/lib/bb/tests/fetch.py

bitbake/lib/bb/tests/fetch.py class URLHandle(unittest.TestCase): · line 1197

Quoted 5 lines

index 61dd5cccaf..a261ad69d8 100644

bitbake/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')])),

bitbake/lib/bb/tests/fetch.py class URLHandle(unittest.TestCase): · line 1198

Quoted 1 line
bitbake/lib/bb/tests/fetch.py +0 -0
        "git://git.openembedded.org/bitbake;branch=@foo" : ('git', '

git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'}),

bitbake/lib/bb/tests/fetch.py class URLHandle(unittest.TestCase): · line 1199

Quoted 1 line
bitbake/lib/bb/tests/fetch.py +0 -0
        "file://somelocation;someparam=1": ('file', '', 'somelocation',

'', '', {'someparam': '1'}),

bitbake/lib/bb/tests/fetch.py class URLHandle(unittest.TestCase): · line 1200

Quoted 1 line
bitbake/lib/bb/tests/fetch.py +1 -0
+       "https://somesite.com/somerepo.git;user=anyUser:idtoken=1234" :

('https', 'somesite.com', '/somerepo.git', '', '', {'user':
'anyUser:idtoken=1234'}),

bitbake/lib/bb/tests/fetch.py class URLHandle(unittest.TestCase): · line 1202

Quoted 2 lines
bitbake/lib/bb/tests/fetch.py +0 -0
     }
     # we require a pathname to encodeurl but users can still pass such

urls to

Quoted 9 lines
bitbake/lib/bb/tests/fetch.py +0 -1
     # 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

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/100350479/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com