Bug 15404

Summary: git fetcher: Git clone invocation fails when URL contains parentheses
Product: [Build System, Metadata & Runtime] BitBake Reporter: Philippe Rivest <privest>
Component: bitbakeAssignee: Randy MacLeod <randy.macleod>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher, randy.macleod
Version: 2.0.3   
Target Milestone: 5.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Proposed patch to escape parentheses in git fetcher none

Description Philippe Rivest 2024-02-16 16:06:42 UTC
Created attachment 5015 [details]
Proposed patch to escape parentheses in git fetcher

# Summary:

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.

# To reproduce:

1. Create a recipe using git fetcher with a repo containing parentheses. (example SRC_URI: "git://mygit.com/my%28repo%29name;protocol=https;rev=22c569f770d8b5594dc5661f99a92e7a0c042d26")

2. Run bitbake my-recipe

# Actual result (from log.do_fetch):

```
DEBUG: Fetcher accessed the network with the command LANG=C git clone --bare --mirror 'https://mygit.com/my(repo)name' /data/privest/YoctoProject/build/downloads//git2/my(repo)name --progress
/bin/sh: 1: Syntax error: "(" unexpected
```

# Expected result:

Should clone the repo successfully.
A solution would be to escape parentheses from the srcname. See the attached patch.

# Build Configuration: 

BB_VERSION           = "2.0.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-22.04"
meta
meta-poky            = "kirkstone:0b39955d14600257a6eafc211fd68a933c69a0e9"
meta-yocto-bsp       = "kirkstone:0b39955d14600257a6eafc211fd68a933c69a0e9"
Comment 1 Randy MacLeod 2024-02-22 15:39:21 UTC
It's a simple patch. Philippe, can you send the patch to the email list?
Comment 2 Philippe Rivest 2024-03-10 03:34:51 UTC
(In reply to Randy MacLeod from comment #1)
> It's a simple patch. Philippe, can you send the patch to the email list?

A properly formatted patch was sent to the bitbake-devel@lists.openembedded.org mailing list. Thank you!
Comment 3 Randy MacLeod 2024-03-14 15:08:13 UTC
Thanks Philippe.
Richard expects to merge this to master soon and I'll add a link when he does that.
Comment 4 Randy MacLeod 2024-10-17 20:24:27 UTC
Fixed by:
https://git.openembedded.org/bitbake/commit/?id=12f9738577934ad7c99f0770f1392a9d6050e7d6

bitbake on master
❯ git branch -a --contains 12f9738577934ad7c99f0770f1392a9d6050e7d6
* master
  remotes/origin/2.10
  remotes/origin/2.8
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Thanks Philippe!