Re: [PATCH] emake: explicitly set SHELL

Fabian Groffen <[email protected]> Tue, 26 Jul 2022 09:20:58 +0200
Newsgroups gmane.linux.gentoo.portage.devel
Organization Gentoo Foundation, Inc.
Message-ID <[email protected]>
--6eWqS8DIErGOlcZG
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 26-07-2022 09:03:18 +0200, Florian Schmaus wrote:
> 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
> >>
[snip]
> >>
> >> 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=3D(
> >> -	${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
> >> +	${MAKE:-make} SHELL=3D"${BASH:-/bin/bash}" ${MAKEOPTS} "$@" ${EXTRA_=
EMAKE}
> >> )
> >>
> >> if [[ ${PORTAGE_QUIET} !=3D 1 ]] ; then
> >>
> >=20
> > I don't think I agree with this as it is. Why not just ${EPREFIX}/bin/s=
h to avoid using
> > an ancient host sh?
>=20
> I was about to write the same (also using EPREFIX, but EBROOT seems what=
=20
> you want, as you figured).
>=20
> But then I wondered if "make SHELL=3D$BROOT/bin/sh" wouldn't override=20
> explicitly set SHELL values in Makefiles. Assume a package has
>=20
> SHELL =3D /bin/zsh
>=20
> in one of its Makefiles. Then emake would reset this to 'sh'. Which=20
> appears like it could cause build issues.
>=20
> If this is the case, then I am not sure what we can do about it. It=20
> appears fragile, if not impossible, to ask 'make' which value for SHELL=
=20
> it would assume, so that emake could adjust the path. Another option=20
> could be that affected packages define a variable in their ebuild, e.g.=
=20
> EMAKE_SHELL=3D"zsh", which emake could extend with BROOT before passing=
=20
> the resulting value as SHELL to make.

So, I can also envision we drop this patch, and I see if I can patch
make(1) to use $EPREFIX/bin/sh instead of /bin/sh by default.  Not sure,
but this would retain the behaviour Portage is doing now for non-Prefix,
and would get the behaviour we want in Prefix.

On an alternative note, there is CONFIG_SHELL (used for setting which shell
to use with configure), which I think in many cases bleeds through to
make, but should there be a MAKE_SHELL perhaps as well?  Then the
default would be pretty much ok.

(We never ran into any problems forcing SHELL to bash in Prefix, but
perhaps that's not a representative test for the whole of Gentoo.)

Thanks,
Fabian

--=20
Fabian Groffen
Gentoo on a different level

--6eWqS8DIErGOlcZG
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEELUvHd/Gtp7LaU1vuzpXahU5EQpMFAmLfldoACgkQzpXahU5E
QpMG0ggAkBx4n6mZ9oVbsCd46MfiCGvrodFzoWBPrSEKs4jxpRmvn/AGTHAbN7G0
19i1XKFPcqDNy4lBHVFuqseSIHjBG5uqkAQnUR0q7ahL8pwsIH0gz9cwTobiiwqs
PRGBNXdqmD6KNaeI8R5NLVHikyo4GVqQgN35dUvvM9h7YDj1hwmpvEaasUqyP7br
BvPW46jpXSU+o351Exq6RgFVln9njR2SL3KhjR8l0eHvNdUgL7SIkitfQMZtZii6
UJDG6ZMJB3p9AHIEw5uFSyAt9SWSgwkOCc+p4WlyX1+YqxW0aKPwOchTxSm9Ocg2
RmQxKSpyFO1r2w10m68LHO4IPPBCwA==
=qvat
-----END PGP SIGNATURE-----

--6eWqS8DIErGOlcZG--