All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonin Godard" <antonin.godard@bootlin.com>
To: "Javier Tia" <javier.tia@linaro.org>,
	<bitbake-devel@lists.openembedded.org>
Cc: <docs@lists.yoctoproject.org>,
	"Mikko Rapeli" <mikko.rapeli@linaro.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH] doc: Mention `if [[ somecondition ]]` is not supported
Date: Thu, 27 Mar 2025 14:44:03 +0100	[thread overview]
Message-ID: <D8R3DBLE3C5T.12J03WL0YNGID@bootlin.com> (raw)
In-Reply-To: <20250320003358.977774-1-javier.tia@linaro.org>

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


  parent reply	other threads:[~2025-03-27 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-20  0:35 Javier Tia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D8R3DBLE3C5T.12J03WL0YNGID@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=javier.tia@linaro.org \
    --cc=mikko.rapeli@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.