diff mbox series

toaster.bbclass: fix toaster error caused by tabs in BBLAYERS

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

Commit Message

Osose Itua June 10, 2025, 9:42 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.

Replace any tabs found with an empty string to resolve this.

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 removing tabs and replacing them with empty strings.

Suggested-by: Anakin Childerhose <anakin.childerhose@savoirfairelinux.com>
Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
---
 meta/classes/toaster.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie June 10, 2025, 10:08 p.m. UTC | #1
On Tue, 2025-06-10 at 17:42 -0400, Osose Itua via lists.openembedded.org wrote:
> 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.
> 
> Replace any tabs found with an empty string to resolve this.
> 
> 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 removing tabs and replacing them with empty strings.
> 
> Suggested-by: Anakin Childerhose <anakin.childerhose@savoirfairelinux.com>
> Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
> ---
>  meta/classes/toaster.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
> index 03c4f3a930..fab22fd0b9 100644
> --- a/meta/classes/toaster.bbclass
> +++ b/meta/classes/toaster.bbclass
> @@ -80,7 +80,7 @@ python toaster_layerinfo_dumpdata() {
>          return layer_info
>  
>  
> -    bblayers = e.data.getVar("BBLAYERS")
> +    bblayers = e.data.getVar("BBLAYERS").replace("\t", "")
>  
>      llayerinfo = {}
>  

I suspect you should replace with " " just in case they've used it as a
delimiter. Looking at the class, why is the code using split(" ")
instead of split() which would probably handle this more nicely?

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 03c4f3a930..fab22fd0b9 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -80,7 +80,7 @@  python toaster_layerinfo_dumpdata() {
         return layer_info
 
 
-    bblayers = e.data.getVar("BBLAYERS")
+    bblayers = e.data.getVar("BBLAYERS").replace("\t", "")
 
     llayerinfo = {}