Skip to contentSkip to conversation

bitbake: fetch2: fix handling of `\` in file:// SRC_URI

PATCH In review Andrei Gherzan 3 participants 7 messages Aug 23, 2021 – Aug 31, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bitbake: fetch2: fix handling of `\` in file:// SRC_URI

From: Leif Middelschulte <[email protected]>

Using backslashes in file:// URIs was broken.
Either the resolver would fail or the subsequent cp command. Try to avoid this by putting the filenames into quotes.

Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8161

(Bitbake rev: aa857fa2e9cf3b0e43a9049b04ec4b0b3c779b11)

---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +1 -1
index dc99914cd9..ece07f611c 100644
@@ -1525,7 +1525,7 @@ class FetchMethod(object):
                     if urlpath.find("/") != -1:
                         destdir = urlpath.rsplit("/", 1)[0] + '/'
                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPRH %s %s' % (file, destdir)
+                cmd = 'cp -fpPRH "%s" "%s"' % (file, destdir)
 
         if not cmd:
             return
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 Use the label provided when formating a dos partition

From: jbouchard <[email protected]>

Previously the bootimg-pcbios wic plugin was not respecting the --label option provided from the wks file. The plugin was setting the label to 'boot'. With this fix, the --label option is use. If no option are specified, then the default is 'boot'.

(From OE-Core rev: 0fd7a73c1bd2486b7a022f0f69bbcb2e0d9cb141)

---
 scripts/lib/wic/plugins/source/bootimg-pcbios.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/lib/wic/plugins/source/bootimg-pcbios.py +4 -2
index f2639e7004..32e47f1831 100644
@@ -186,8 +186,10 @@ class BootimgPcbiosPlugin(SourcePlugin):
         # dosfs image, created by mkdosfs
         bootimg = "%s/boot%s.img" % (cr_workdir, part.lineno)
 
-        dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \
-                    (part.fsuuid, bootimg, blocks)
+        label = part.label if part.label else "boot"
+
+        dosfs_cmd = "mkdosfs -n %s -i %s -S 512 -C %s %d" % \
+                    (label, part.fsuuid, bootimg, blocks)
         exec_native_cmd(dosfs_cmd, native_sysroot)
 
         mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)
Signature · 1 line
2.31.1
#2 lore raw
In reply to Andrei Gherzan
Quoted 10 lines · Andrei Gherzan

From: Leif Middelschulte <[email protected]>

Using backslashes in file:// URIs was broken.
Either the resolver would fail or the subsequent cp command. Try to avoid this by putting the filenames into quotes.

Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8161

(Bitbake rev: aa857fa2e9cf3b0e43a9049b04ec4b0b3c779b11)

Patches for bitbake should be sent to: [email protected]

I tried applying this patch, but found that it caused errors on the autobuilder:

https://errors.yoctoproject.org/Errors/Build/129189/

Steve

Quoted 25 lines
---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +1 -2
index dc99914cd9..ece07f611c 100644
@@ -1525,7 +1525,7 @@ class FetchMethod(object):
                     if urlpath.find("/") != -1:
                         destdir = urlpath.rsplit("/", 1)[0] + '/'
                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPRH %s %s' % (file, destdir)
+                cmd = 'cp -fpPRH "%s" "%s"' % (file, destdir)
 
         if not cmd:
             return
--

2.31.1

#3 lore raw
Quoted 10 lines · Steve Sakoman
Quoted 9 lines · Andrei Gherzan

From: Leif Middelschulte <[email protected]>

Using backslashes in file:// URIs was broken.
Either the resolver would fail or the subsequent cp command. Try to avoid this by putting the filenames into quotes.

Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8161

Quoted 8 lines
Quoted 1 line

(Bitbake rev: aa857fa2e9cf3b0e43a9049b04ec4b0b3c779b11)

Patches for bitbake should be sent to: [email protected]

I tried applying this patch, but found that it caused errors on the autobuilder:

https://errors.yoctoproject.org/Errors/Build/129189/

We dropped wildcard support in master but that is still present in dunfell. That means we can't quote things as we are relying on expansion of the wildcards for some SRC_URIs. This could be difficult to fix with the compatibility constraints of an older release funfortunately :/.

Cheers,

Richard

#4 lore raw
Quoted 17 lines · Richard Purdie
Quoted 16 lines · Steve Sakoman
Quoted 10 lines · Andrei Gherzan

From: Leif Middelschulte <[email protected]>

Using backslashes in file:// URIs was broken.
Either the resolver would fail or the subsequent cp command. Try to avoid this by putting the filenames into quotes.

Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8161

(Bitbake rev: aa857fa2e9cf3b0e43a9049b04ec4b0b3c779b11)

Patches for bitbake should be sent to: [email protected]

I tried applying this patch, but found that it caused errors on the autobuilder:

Quoted 7 lines
Quoted 2 lines

https://errors.yoctoproject.org/Errors/Build/129189/

We dropped wildcard support in master but that is still present in dunfell. That means we can't quote things as we are relying on expansion of the wildcards for some SRC_URIs. This could be difficult to fix with the compatibility constraints of an older release funfortunately :/.

Got it now. That's going to be painful indeed. I can't think of an easy way out of this either.

Andrei

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Hey,

Quoted 21 lines · Andrei Gherzan
Quoted 20 lines · Richard Purdie
Quoted 18 lines · Steve Sakoman
Quoted 10 lines · Andrei Gherzan

From: Leif Middelschulte <[email protected]>

Using backslashes in file:// URIs was broken.
Either the resolver would fail or the subsequent cp command. Try to avoid this by putting the filenames into quotes.

Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8161

(Bitbake rev: aa857fa2e9cf3b0e43a9049b04ec4b0b3c779b11)

Patches for bitbake should be sent to: [email protected]

I tried applying this patch, but found that it caused errors on the autobuilder:

https://errors.yoctoproject.org/Errors/Build/129189/

Quoted 7 lines
Quoted 4 lines

We dropped wildcard support in master but that is still present in dunfell. That means we can't quote things as we are relying on expansion of the wildcards for some SRC_URIs. This could be difficult to fix with the compatibility constraints of an older release funfortunately :/.

Got it now. That's going to be painful indeed. I can't think of an easy way out of this either.

Can you guys think of a way forward with this? Or shall we just drop it and consider it unsupported?

Andrei

#7 lore raw
Quoted 29 lines · Andrei Gherzan

Hey,

Quoted 26 lines · Andrei Gherzan
Quoted 24 lines · Richard Purdie
Quoted 10 lines · Steve Sakoman
Quoted 9 lines · Andrei Gherzan

From: Leif Middelschulte <[email protected]>

Using backslashes in file:// URIs was broken.
Either the resolver would fail or the subsequent cp command. Try to avoid this by putting the filenames into quotes.

Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8161

Quoted 8 lines
Quoted 1 line

(Bitbake rev: aa857fa2e9cf3b0e43a9049b04ec4b0b3c779b11)

Patches for bitbake should be sent to: [email protected]

I tried applying this patch, but found that it caused errors on the autobuilder:

https://errors.yoctoproject.org/Errors/Build/129189/

We dropped wildcard support in master but that is still present in dunfell. That means we can't quote things as we are relying on expansion of the wildcards for some SRC_URIs. This could be difficult to fix with the compatibility constraints of an older release funfortunately :/.

Quoted 4 lines
Quoted 2 lines

Got it now. That's going to be painful indeed. I can't think of an easy way out of this either.

Can you guys think of a way forward with this? Or shall we just drop it and consider it unsupported?

The only idea I had was to see if wildcards were in the name and only quote it if not. I'm not sure we ever have had backslashes working though so it has always been unsupported until the fix in master afaict.

Cheers,

Richard