Gentoo Archives: gentoo-portage-dev

From: Fabian Groffen <grobian@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] emake: explicitly set SHELL
Date: Tue, 26 Jul 2022 07:21:04
Message-Id: Yt+V2jkj+vI3QXqJ@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] emake: explicitly set SHELL by Florian Schmaus
1 On 26-07-2022 09:03:18 +0200, Florian Schmaus wrote:
2 > On 26.07.22 05:00, Sam James wrote:
3 > >> On 25 Jul 2022, at 16:28, Fabian Groffen <grobian@g.o> wrote:
4 > >>
5 > >> bin/ebuild-helpers/emake: force SHELL to be set
6 > >>
7 [snip]
8 > >>
9 > >> diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
10 > >> index 60718a2e4..21da85845 100755
11 > >> --- a/bin/ebuild-helpers/emake
12 > >> +++ b/bin/ebuild-helpers/emake
13 > >> @@ -12,7 +12,7 @@
14 > >> source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
15 > >>
16 > >> cmd=(
17 > >> - ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
18 > >> + ${MAKE:-make} SHELL="${BASH:-/bin/bash}" ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
19 > >> )
20 > >>
21 > >> if [[ ${PORTAGE_QUIET} != 1 ]] ; then
22 > >>
23 > >
24 > > I don't think I agree with this as it is. Why not just ${EPREFIX}/bin/sh to avoid using
25 > > an ancient host sh?
26 >
27 > I was about to write the same (also using EPREFIX, but EBROOT seems what
28 > you want, as you figured).
29 >
30 > But then I wondered if "make SHELL=$BROOT/bin/sh" wouldn't override
31 > explicitly set SHELL values in Makefiles. Assume a package has
32 >
33 > SHELL = /bin/zsh
34 >
35 > in one of its Makefiles. Then emake would reset this to 'sh'. Which
36 > appears like it could cause build issues.
37 >
38 > If this is the case, then I am not sure what we can do about it. It
39 > appears fragile, if not impossible, to ask 'make' which value for SHELL
40 > it would assume, so that emake could adjust the path. Another option
41 > could be that affected packages define a variable in their ebuild, e.g.
42 > EMAKE_SHELL="zsh", which emake could extend with BROOT before passing
43 > the resulting value as SHELL to make.
44
45 So, I can also envision we drop this patch, and I see if I can patch
46 make(1) to use $EPREFIX/bin/sh instead of /bin/sh by default. Not sure,
47 but this would retain the behaviour Portage is doing now for non-Prefix,
48 and would get the behaviour we want in Prefix.
49
50 On an alternative note, there is CONFIG_SHELL (used for setting which shell
51 to use with configure), which I think in many cases bleeds through to
52 make, but should there be a MAKE_SHELL perhaps as well? Then the
53 default would be pretty much ok.
54
55 (We never ran into any problems forcing SHELL to bash in Prefix, but
56 perhaps that's not a representative test for the whole of Gentoo.)
57
58 Thanks,
59 Fabian
60
61 --
62 Fabian Groffen
63 Gentoo on a different level

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] emake: explicitly set SHELL Fabian Groffen <grobian@g.o>