All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] recipetool: create: fix port number parsing issue
@ 2018-04-01 21:15 liu.ming50
  0 siblings, 0 replies; only message in thread
From: liu.ming50 @ 2018-04-01 21:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

A flaw was found when I run:
$ recipetool create "ssh://git@xxx.xxx:7999/xxx.git"

the url turned out to be: "git://git@xxx.xxx/7999/xxx.git;protocol=ssh"
after parsing, the port number was parsed as part of the path, this is
definitely wrong and lead to fetching failures.

This issue could be fixed in reformat_git_uri, by filtering out port
numbers when formatting ":".

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 scripts/lib/recipetool/create.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 2fc9e0a..a371028 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -383,8 +383,10 @@ def reformat_git_uri(uri):
         # which causes decodeurl to fail getting the right host and path
         if len(host.split(':')) > 1:
             splitslash = host.split(':')
-            host = splitslash[0]
-            path = '/' + splitslash[1] + path
+            # Port number should not be split from host
+            if not re.match('^[0-9]+$', splitslash[1]):
+                host = splitslash[0]
+                path = '/' + splitslash[1] + path
         #Algorithm:
         # if user is defined, append protocol=ssh or if a protocol is defined, then honor the user-defined protocol
         # if no user & password is defined, check for scheme type and append the protocol with the scheme type
-- 
2.7.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-01 21:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01 21:15 [PATCH] recipetool: create: fix port number parsing issue liu.ming50

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.