Message ID | 20240310033314.110796-1-privest@genetec.com |
---|---|
State | Accepted, archived |
Commit | 12f9738577934ad7c99f0770f1392a9d6050e7d6 |
Headers | show |
Series | bitbake: fetch2/git: Escape parentheses in git src name | expand |
Have you considered quoting the git clone paths in the command? Would there be side effects? Also perhaps a more robust set of allowed characters would be better than increasing the list of replace calls? Paulo Neves On 3/10/24 04:33, Philippe Rivest wrote: > From: Philippe Rivest > [<technophil98@gmail.com>](mailto:technophil98@gmail.com) > FIXES [YOCTO #15404] > > When using git fetcher on a repo with parentheses in its URL, the > invocation of the git clone command will fail. The clone directory > is not quoted thus the shell will return an error and won't execute > the command. > > (Bitbake rev: b5624ee5643d881afa004571a096a189ab5389b5) > > Cc: Philippe Rivest > [<privest@genetec.com>](mailto:privest@genetec.com) > Signed-off-by: Philippe Rivest > [<technophil98@gmail.com>](mailto:technophil98@gmail.com) > --- > bitbake/lib/bb/fetch2/git.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py > index b9dc576d47..6170da7fa6 100644 > --- a/bitbake/lib/bb/fetch2/git.py > +++ b/bitbake/lib/bb/fetch2/git.py > @@ -277,7 +277,7 @@ class Git(FetchMethod): > ud.unresolvedrev[name] = ud.revisions[name] > ud.revisions[name] = self.latest_revision(ud, d, name) > > - gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.').replace(' ','_')) > + gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.').replace(' ','_').replace('(', '_').replace(')', '_')) > if gitsrcname.startswith('.'): > gitsrcname = gitsrcname[1:] > > -- > 2.40.0 > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#15996): > https://lists.openembedded.org/g/bitbake-devel/message/15996 > Mute This Topic: > https://lists.openembedded.org/mt/104839313/4454782 > Group Owner: > bitbake-devel+owner@lists.openembedded.org > Unsubscribe: > https://lists.openembedded.org/g/bitbake-devel/unsub > [ > paulo@myneves.com > ] > -=-=-=-=-=-=-=-=-=-=-=-
I considered quoting the clone directory. However, since the base implementation used replace calls, I followed suit. Whenever there was a parenthesis in the repo name, the clone would fail with the original implementation. There should not be any side effects: no released version of Bitbake/git fetcher has support for parentheses in in the repo name. I agree that a replacement list/map is a more scalable solution, but might come with a higher risk of side effects. The same can be said for quoting the clone directory. Adding replace calls was a simple fix to a simple and narrow problem.
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index b9dc576d47..6170da7fa6 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -277,7 +277,7 @@ class Git(FetchMethod): ud.unresolvedrev[name] = ud.revisions[name] ud.revisions[name] = self.latest_revision(ud, d, name) - gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.').replace(' ','_')) + gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.').replace(' ','_').replace('(', '_').replace(')', '_')) if gitsrcname.startswith('.'): gitsrcname = gitsrcname[1:]