Skip to contentSkip to conversation

autotools: Give in and force CONFIG_SHELL to bash

PATCH In review Richard Purdie 1 participant 2 messages Jan 27, 2020 – Jan 30, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 autotools: Give in and force CONFIG_SHELL to bash

At present, CONFIG_SHELL becomes /bin/sh if its bash and /bin/bash if not. This isn't deterministic and leads to changes in ptest packages which include Makefiles.

At first glance you'd think we'd hardcode to /bin/sh since most system shells are sane.

Sadly the dash vs. bash leads to quoting differences in configure.

The bash default is probably the safest option since configure tries to find bash and this is what most systems would end up using.

The end result is a more consisent build environment.

---
 meta/classes/autotools.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/autotools.bbclass +1 -1
index 3d22ad02557..6c2a33ac72f 100644
@@ -90,7 +90,7 @@ oe_runconf () {
 	cfgscript=`python3 -c "import os; print(os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.'))"`/$cfgscript_name
 	if [ -x "$cfgscript" ] ; then
 		bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
-		if ! ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then
+		if ! ${CACHED_CONFIGUREVARS} CONFIG_SHELL=/bin/bash $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@"; then
 			bbnote "The following config.log files may provide further information."
 			bbnote `find ${B} -ignore_readdir_race -type f -name config.log`
 			bbfatal_log "configure failed"
Signature · 1 line
2.20.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 16 lines · Rich Persaud
Quoted 14 lines · Richard Purdie

At present, CONFIG_SHELL becomes /bin/sh if its bash and /bin/bash if not. This
isn't deterministic and leads to changes in ptest packages which include Makefiles.

At first glance you'd think we'd hardcode to /bin/sh since most system shells are sane.

Sadly the dash vs. bash leads to quoting differences in configure.

The bash default is probably the safest option since configure tries to find bash
and this is what most systems would end up using.

Quoted 6 lines
Quoted 1 line

The end result is a more consisent build environment.

Since every OE user is currently forced to depend on host tool binaries, could we limit such dependency to a bootstrap phase where bitbake generates native versions of HOSTTOOLS (including bash) before building product binaries?

On this specific issue, I very much doubt the build would work without bash as so many scripts require it. We're just force it to a value rather than having it pick /bin/sh on some systems (where it is bash) and /bin/bash on others.

The aim is we can generate all the hosttools with "bitbake buildtools- tarball" or "bitbake buildtools-extended-tarball" (includes gcc). Those work today, we don't have an automatic extraction and preface to the build phase as yet but that is next on my development list once we have the build reproducibility issues track down and resolved.

So I think what you're asking for is nearly there, we just have manual setup right now?

Cheers,

Richard