Skip to content

Conversation

@ycongal-smile
Copy link
Contributor

When cooker shell is called from dash with SHELL=/bin/sh, it fails with

SHELL=/bin/sh /bin/dash -c "cooker shell qemux86-64 -- bitbake-getvar MACHINE" 
/bin/sh: 1: source: not found

(not that dash may not reset SHELL and if SHELL contains a more "nicer" SHELL (e.g. bash), cooker will use that and avoid the limitation of dash)
=> Use "." instead of "source". This is the first commit.

After that fix, the sourcing of oe-init-build-env must be adapted to the fact that dash does not handle arguments to the "." command.
=> Use the set <builddir> workaround given in oe-init-build-env. This is the second commit.

@ycongal-smile ycongal-smile marked this pull request as draft September 6, 2025 21:19
The "." command is more portable as it is defined in POSIX[0], whereas
the "source" command is a bash (and some other shells) extensions.

In particular, "source" is not supported by dash, the default /bin/sh on
Debian 12.

[0]: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#dot

Signed-off-by: Yoann Congal <[email protected]>
Dash does not support passing arguments to the "." command. The default
poky ./oe-init-build-env has this comment:
  # Normally this is called as '. ./oe-init-build-env <builddir>'
  #
  # This works in most shells (not dash), but not all of them pass the arguments
  # when being sourced.  To workaround the shell limitation use "set <builddir>"
  # prior to sourcing this script.

Implement the "set" workaround for dash support.

Also, change current working directory to match oe-init-build-env
expectation of being sourced from its base directory in dash.

Signed-off-by: Yoann Congal <[email protected]>
@ycongal-smile ycongal-smile marked this pull request as ready for review September 6, 2025 21:46
@ycongal-smile
Copy link
Contributor Author

Updated to clear CI checks: changed expected test output and formatting with ruff

@cpb- cpb- merged commit 32fe22e into cpb-:master Sep 8, 2025
2 checks passed
@cpb-
Copy link
Owner

cpb- commented Sep 8, 2025

Thanks Yoann.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants