diff mbox series

gitsm: Fix regression in gitsm submodule path parsing

Message ID 20221113104638.7939-1-pavel@zhukoff.net
State Accepted, archived
Commit 3ad27272c18f2bb9edd441f840167a3dabd5407b
Headers show
Series gitsm: Fix regression in gitsm submodule path parsing | expand

Commit Message

Pavel Zhukov Nov. 13, 2022, 10:46 a.m. UTC
Commit 0361ecf7eb82c386a9842cf1f3cb706c0a112e77 introduced regression
in submodules path parsing. As the result gitsm fetcher fails on each
submodule which name begins from the name of the parent repo which is
totally valid usecase [Yocto #14045] [1]
Fix the code to error out only if submodule's name is equal to parent
name but not if it's part of it.

[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=14045#c4

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
---
 lib/bb/fetch2/gitsm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Herbrechtsmeier Nov. 23, 2022, 10:25 a.m. UTC | #1
Hi Steve,

please cherry pick this commit for bitbake 2.0 and poky kirkstone to fix 
the introduced regression of cherry picked `gitsm: Error out if 
submodule refers to parent repo` commit.

Regards
   Stefan

Am 13.11.2022 um 11:46 schrieb Pavel Zhukov via lists.openembedded.org:
> Commit 0361ecf7eb82c386a9842cf1f3cb706c0a112e77 introduced regression
> in submodules path parsing. As the result gitsm fetcher fails on each
> submodule which name begins from the name of the parent repo which is
> totally valid usecase [Yocto #14045] [1]
> Fix the code to error out only if submodule's name is equal to parent
> name but not if it's part of it.
>
> [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=14045#c4
>
> Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
> ---
>   lib/bb/fetch2/gitsm.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
> index 25d5db0e..c5f7c03c 100644
> --- a/lib/bb/fetch2/gitsm.py
> +++ b/lib/bb/fetch2/gitsm.py
> @@ -115,7 +115,7 @@ class GitSM(Git):
>                       # This has to be a file reference
>                       proto = "file"
>                       url = "gitsm://" + uris[module]
> -            if "{}{}".format(ud.host, ud.path) in url:
> +            if url.endswith("{}{}".format(ud.host, ud.path)):
>                   raise bb.fetch2.FetchError("Submodule refers to the parent repository. This will cause deadlock situation in current version of Bitbake." \
>                                              "Consider using git fetcher instead.")
>   
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#14076): https://lists.openembedded.org/g/bitbake-devel/message/14076
> Mute This Topic: https://lists.openembedded.org/mt/94996241/6374899
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [stefan.herbrechtsmeier-oss@weidmueller.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
index 25d5db0e..c5f7c03c 100644
--- a/lib/bb/fetch2/gitsm.py
+++ b/lib/bb/fetch2/gitsm.py
@@ -115,7 +115,7 @@  class GitSM(Git):
                     # This has to be a file reference
                     proto = "file"
                     url = "gitsm://" + uris[module]
-            if "{}{}".format(ud.host, ud.path) in url:
+            if url.endswith("{}{}".format(ud.host, ud.path)):
                 raise bb.fetch2.FetchError("Submodule refers to the parent repository. This will cause deadlock situation in current version of Bitbake." \
                                            "Consider using git fetcher instead.")