diff mbox series

[v2] toaster.bbclass: fix toaster error caused by tabs in BBLAYERS

Message ID 20250611152422.4038356-1-osose.itua@savoirfairelinux.com
State New
Headers show
Series [v2] toaster.bbclass: fix toaster error caused by tabs in BBLAYERS | expand

Commit Message

Osose Itua June 11, 2025, 3:24 p.m. UTC
Users may unknowingly put tabs in BBLAYERS instead of spaces, and this is
interpreted as a literal "\t" at the start of the filepath which causes
_get_layer_dict() function to fail at finding the filepath.

Instead of using split(" "), which restricts it to split on just spaces
replace with split() as this handles spaces, tabs and newlines.

Min steps to reproduce:
- Clone the poky repo:
    git clone git://git.yoctoproject.org/poky
    cd poky
    source oe-init-build-env
- Insert tabs in the BBLAYERS variable in bblayers.conf
  - Note: tab needs to be in the recipe that is being built for the error to be observed
  - Ex: `	/home/<user>/src/poky/meta-skeleton \`
- Start toaster
  source toaster start
  bitbake hello

Error message:
FileNotFoundError: [Errno 2] No such file or directory: '\t/home/<user>/src/poky/meta-skeleton’

Fix by using split() instead of split(" ").

Suggested-by: Anakin Childerhose <anakin.childerhose@savoirfairelinux.com>
CC: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
---
changes in v2:
- Remove use of .replace("\t", "") from v1 patch in toaster_layerinfo_dumpdata()
- Use split() instead of split(" ") to handle spaces, tabs and newlines
---
 meta/classes/toaster.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 03c4f3a930..af7c457808 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -84,7 +84,7 @@  python toaster_layerinfo_dumpdata() {
 
     llayerinfo = {}
 
-    for layer in { l for l in bblayers.strip().split(" ") if len(l) }:
+    for layer in { l for l in bblayers.strip().split() if len(l) }:
         llayerinfo[layer] = _get_layer_dict(layer)