Re: [PATCH] emake: explicitly set SHELL
Florian Schmaus <[email protected]> Tue, 26 Jul 2022 09:03:18 +0200
| Newsgroups | gmane.linux.gentoo.portage.devel |
|---|---|
| Message-ID | <[email protected]> |
On 26.07.22 05:00, Sam James wrote: > > >> On 25 Jul 2022, at 16:28, Fabian Groffen <[email protected]> wrote: >> >> bin/ebuild-helpers/emake: force SHELL to be set >> >> On Prefix systems /bin/sh can be anything, including very ancient. So >> ensure we're running with bash, since that's what Gentoo Linux is >> expecting /bin/sh to be (by default, at least). >> >> Provide a fallback for the (near impossible) case that we use a bash >> that doesn't set BASH, or when we don't use bash at all. This is not >> expected, though, as we explicitly require bash throughout all Portage, >> so we don't really care about using a non-Prefixed one, for this really >> shouldn't happen. >> >> Signed-off-by: Fabian Groffen <[email protected]> >> >> diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake >> index 60718a2e4..21da85845 100755 >> --- a/bin/ebuild-helpers/emake >> +++ b/bin/ebuild-helpers/emake >> @@ -12,7 +12,7 @@ >> source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 >> >> cmd=( >> - ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE} >> + ${MAKE:-make} SHELL="${BASH:-/bin/bash}" ${MAKEOPTS} "$@" ${EXTRA_EMAKE} >> ) >> >> if [[ ${PORTAGE_QUIET} != 1 ]] ; then >> > > I don't think I agree with this as it is. Why not just ${EPREFIX}/bin/sh to avoid using > an ancient host sh? I was about to write the same (also using EPREFIX, but EBROOT seems what you want, as you figured). But then I wondered if "make SHELL=$BROOT/bin/sh" wouldn't override explicitly set SHELL values in Makefiles. Assume a package has SHELL = /bin/zsh in one of its Makefiles. Then emake would reset this to 'sh'. Which appears like it could cause build issues. If this is the case, then I am not sure what we can do about it. It appears fragile, if not impossible, to ask 'make' which value for SHELL it would assume, so that emake could adjust the path. Another option could be that affected packages define a variable in their ebuild, e.g. EMAKE_SHELL="zsh", which emake could extend with BROOT before passing the resulting value as SHELL to make. - Flow