* [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
@ 2025-03-20 0:33 Javier Tia
2025-03-25 10:04 ` [bitbake-devel] " Quentin Schulz
2025-03-27 13:44 ` Antonin Godard
0 siblings, 2 replies; 7+ messages in thread
From: Javier Tia @ 2025-03-20 0:33 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, Mikko Rapeli, Ilias Apalodimas
I keep forgetting using `if [[ somecondition ]]` is not supported.
Signed-off-by: Javier Tia <javier.tia@linaro.org>
---
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index 415fbf6d6..5474e154f 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
To call your modified version of the function as defined in your recipe,
call it as ``do_foo``.
+ .. note::
+
+ Conditional expression using ``[[ somecondition ]]`` is not supported.
+
With these conditions met, your single recipe can freely choose between
the original function as defined in the class file and the modified
function in your recipe. If you do not set up these conditions, you are
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [bitbake-devel] [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
2025-03-20 0:33 [PATCH] doc: Mention `if [[ somecondition ]]` is not supported Javier Tia
@ 2025-03-25 10:04 ` Quentin Schulz
2025-03-25 10:14 ` [docs] " Richard Purdie
2025-03-27 13:44 ` Antonin Godard
1 sibling, 1 reply; 7+ messages in thread
From: Quentin Schulz @ 2025-03-25 10:04 UTC (permalink / raw)
To: javier.tia, bitbake-devel; +Cc: docs, Mikko Rapeli, Ilias Apalodimas
On 3/20/25 1:33 AM, Javier Tia via lists.openembedded.org wrote:
> I keep forgetting using `if [[ somecondition ]]` is not supported.
>
> Signed-off-by: Javier Tia <javier.tia@linaro.org>
> ---
> doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> index 415fbf6d6..5474e154f 100644
> --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> @@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
> To call your modified version of the function as defined in your recipe,
> call it as ``do_foo``.
>
> + .. note::
> +
> + Conditional expression using ``[[ somecondition ]]`` is not supported.
> +
Do you know what the reason is for that limitation?
The example above this git context is not really implying `[[
somecondition ]]` would be valid though.
If I remember correctly, the shell functions are run by /bin/sh
interpreter, so it depends on which shell you have configured by default
in your system. Is it possible this is due to you being used to develop
with bash where this is possible and having your Yocto build run with a
different shell (e.g. dash, which doesn't seem to support that? c.f.
https://manned.org/dash.1)?
I think we should recommend people write POSIX-compliant shell functions
and tasks rather no?
Cheers,
Quentin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [docs] [bitbake-devel] [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
2025-03-25 10:04 ` [bitbake-devel] " Quentin Schulz
@ 2025-03-25 10:14 ` Richard Purdie
2025-03-25 17:30 ` Quentin Schulz
0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2025-03-25 10:14 UTC (permalink / raw)
To: quentin.schulz, javier.tia, bitbake-devel
Cc: docs, Mikko Rapeli, Ilias Apalodimas
On Tue, 2025-03-25 at 11:04 +0100, Quentin Schulz via lists.yoctoproject.org wrote:
>
>
> On 3/20/25 1:33 AM, Javier Tia via lists.openembedded.org wrote:
> > I keep forgetting using `if [[ somecondition ]]` is not supported.
> >
> > Signed-off-by: Javier Tia <javier.tia@linaro.org>
> > ---
> > doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> > index 415fbf6d6..5474e154f 100644
> > --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> > +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> > @@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
> > To call your modified version of the function as defined in your recipe,
> > call it as ``do_foo``.
> >
> > + .. note::
> > +
> > + Conditional expression using ``[[ somecondition ]]`` is not supported.
> > +
>
> Do you know what the reason is for that limitation?
>
> The example above this git context is not really implying `[[
> somecondition ]]` would be valid though.
>
> If I remember correctly, the shell functions are run by /bin/sh
> interpreter, so it depends on which shell you have configured by default
> in your system. Is it possible this is due to you being used to develop
> with bash where this is possible and having your Yocto build run with a
> different shell (e.g. dash, which doesn't seem to support that? c.f.
> https://manned.org/dash.1)?
>
> I think we should recommend people write POSIX-compliant shell functions
> and tasks rather no?
Bitbake parses the shell functions and our shell parser can't cope with
certain syntax unfortunately.
Cheers,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [docs] [bitbake-devel] [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
2025-03-25 10:14 ` [docs] " Richard Purdie
@ 2025-03-25 17:30 ` Quentin Schulz
2025-03-25 17:49 ` Richard Purdie
0 siblings, 1 reply; 7+ messages in thread
From: Quentin Schulz @ 2025-03-25 17:30 UTC (permalink / raw)
To: Richard Purdie, javier.tia, bitbake-devel
Cc: docs, Mikko Rapeli, Ilias Apalodimas
Hi Richard,
On 3/25/25 11:14 AM, Richard Purdie wrote:
> On Tue, 2025-03-25 at 11:04 +0100, Quentin Schulz via lists.yoctoproject.org wrote:
>>
>>
>> On 3/20/25 1:33 AM, Javier Tia via lists.openembedded.org wrote:
>>> I keep forgetting using `if [[ somecondition ]]` is not supported.
>>>
>>> Signed-off-by: Javier Tia <javier.tia@linaro.org>
>>> ---
>>> doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
>>> index 415fbf6d6..5474e154f 100644
>>> --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
>>> +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
>>> @@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
>>> To call your modified version of the function as defined in your recipe,
>>> call it as ``do_foo``.
>>>
>>> + .. note::
>>> +
>>> + Conditional expression using ``[[ somecondition ]]`` is not supported.
>>> +
>>
>> Do you know what the reason is for that limitation?
>>
>> The example above this git context is not really implying `[[
>> somecondition ]]` would be valid though.
>>
>> If I remember correctly, the shell functions are run by /bin/sh
>> interpreter, so it depends on which shell you have configured by default
>> in your system. Is it possible this is due to you being used to develop
>> with bash where this is possible and having your Yocto build run with a
>> different shell (e.g. dash, which doesn't seem to support that? c.f.
>> https://manned.org/dash.1)?
>>
>> I think we should recommend people write POSIX-compliant shell functions
>> and tasks rather no?
>
> Bitbake parses the shell functions and our shell parser can't cope with
> certain syntax unfortunately.
>
Ah, I see. This happens before the shell even runs the code. Do we
happen to have a list of things/syntax we cannot parse?
I think it therefore deserves a bigger place than a small note, maybe
e.g. a sub(sub...)section of limitations?
Cheers,
Quentin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [docs] [bitbake-devel] [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
2025-03-25 17:30 ` Quentin Schulz
@ 2025-03-25 17:49 ` Richard Purdie
0 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2025-03-25 17:49 UTC (permalink / raw)
To: Quentin Schulz, javier.tia, bitbake-devel
Cc: docs, Mikko Rapeli, Ilias Apalodimas
On Tue, 2025-03-25 at 18:30 +0100, Quentin Schulz wrote:
> Hi Richard,
>
> On 3/25/25 11:14 AM, Richard Purdie wrote:
> > On Tue, 2025-03-25 at 11:04 +0100, Quentin Schulz via lists.yoctoproject.org wrote:
> > >
> > >
> > > On 3/20/25 1:33 AM, Javier Tia via lists.openembedded.org wrote:
> > > > I keep forgetting using `if [[ somecondition ]]` is not supported.
> > > >
> > > > Signed-off-by: Javier Tia <javier.tia@linaro.org>
> > > > ---
> > > > doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
> > > > 1 file changed, 4 insertions(+)
> > > >
> > > > diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> > > > index 415fbf6d6..5474e154f 100644
> > > > --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> > > > +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> > > > @@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
> > > > To call your modified version of the function as defined in your recipe,
> > > > call it as ``do_foo``.
> > > >
> > > > + .. note::
> > > > +
> > > > + Conditional expression using ``[[ somecondition ]]`` is not supported.
> > > > +
> > >
> > > Do you know what the reason is for that limitation?
> > >
> > > The example above this git context is not really implying `[[
> > > somecondition ]]` would be valid though.
> > >
> > > If I remember correctly, the shell functions are run by /bin/sh
> > > interpreter, so it depends on which shell you have configured by default
> > > in your system. Is it possible this is due to you being used to develop
> > > with bash where this is possible and having your Yocto build run with a
> > > different shell (e.g. dash, which doesn't seem to support that? c.f.
> > > https://manned.org/dash.1)?
> > >
> > > I think we should recommend people write POSIX-compliant shell functions
> > > and tasks rather no?
> >
> > Bitbake parses the shell functions and our shell parser can't cope with
> > certain syntax unfortunately.
> >
>
> Ah, I see. This happens before the shell even runs the code. Do we
> happen to have a list of things/syntax we cannot parse?
There are open bugs. I did recently run into backgrounding not working
in the pseudo reproducer so I just used a separate script. Not sure we
want to support background processes though.
> I think it therefore deserves a bigger place than a small note, maybe
> e.g. a sub(sub...)section of limitations?
Patches welcome!
Cheers,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
2025-03-20 0:33 [PATCH] doc: Mention `if [[ somecondition ]]` is not supported Javier Tia
2025-03-25 10:04 ` [bitbake-devel] " Quentin Schulz
@ 2025-03-27 13:44 ` Antonin Godard
1 sibling, 0 replies; 7+ messages in thread
From: Antonin Godard @ 2025-03-27 13:44 UTC (permalink / raw)
To: Javier Tia, bitbake-devel; +Cc: docs, Mikko Rapeli, Ilias Apalodimas
Hi Javier,
On Thu Mar 20, 2025 at 1:33 AM CET, Javier Tia wrote:
> I keep forgetting using `if [[ somecondition ]]` is not supported.
>
> Signed-off-by: Javier Tia <javier.tia@linaro.org>
> ---
> doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> index 415fbf6d6..5474e154f 100644
> --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> @@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
> To call your modified version of the function as defined in your recipe,
> call it as ``do_foo``.
>
> + .. note::
> +
> + Conditional expression using ``[[ somecondition ]]`` is not supported.
> +
> With these conditions met, your single recipe can freely choose between
> the original function as defined in the class file and the modified
> function in your recipe. If you do not set up these conditions, you are
The documentation already says the following:
The scripts are executed by ``/bin/sh``, which may not be a bash
shell but might be something such as ``dash``. You should not use
Bash-specific script (bashisms).
I think [[ ]] is a bashism, or at least the POSIX shell spec clearly state to
not use it[1]. I'm not sure the BitBake documentation should list all the shell
syntax it does not support, as I expect there are quite a few.
The codeparser, however, could be modified to try and detect the usage of [[ ]]
and give a warning on such occurrences?
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_04
Antonin
--
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
@ 2025-03-20 0:35 Javier Tia
0 siblings, 0 replies; 7+ messages in thread
From: Javier Tia @ 2025-03-20 0:35 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, Mikko Rapeli, Ilias Apalodimas
I keep forgetting using `if [[ somecondition ]]` is not supported.
Signed-off-by: Javier Tia <javier.tia@linaro.org>
---
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index 415fbf6d6..5474e154f 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -1381,6 +1381,10 @@ To make use of this technique, you need the following things in place:
To call your modified version of the function as defined in your recipe,
call it as ``do_foo``.
+ .. note::
+
+ Conditional expression using ``[[ somecondition ]]`` is not supported.
+
With these conditions met, your single recipe can freely choose between
the original function as defined in the class file and the modified
function in your recipe. If you do not set up these conditions, you are
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-03-27 13:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-20 0:33 [PATCH] doc: Mention `if [[ somecondition ]]` is not supported Javier Tia
2025-03-25 10:04 ` [bitbake-devel] " Quentin Schulz
2025-03-25 10:14 ` [docs] " Richard Purdie
2025-03-25 17:30 ` Quentin Schulz
2025-03-25 17:49 ` Richard Purdie
2025-03-27 13:44 ` Antonin Godard
-- strict thread matches above, loose matches on Subject: below --
2025-03-20 0:35 Javier Tia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox