Building from git breaks when /bin/sh isn't bash

OpenSubmitted by elaexuotee.
Details
2 participants
  • elaexuotee
  • pelzflorian (Florian Pelz)
Owner
unassigned
Severity
normal
E
E
elaexuotee wrote on 15 Apr 2020 11:06
(address . bug-guix@gnu.org)
2O2NKRGHD2OZD.30CKDJBOP4LE3@wilsonb.com
When building from git, ./bootstrap ends up generating (via automake) severalMakefiles that set SHELL = /bin/sh. However, some targets contain rules thatmake use of bashisms. This leads to breakage when /bin/sh is something otherthan bash.
In particular, I am building from a foreign distro which links /bin/sh to dash.Currently, this ends up breaking the build, the details of which I reportedto guix-devel in [0].
As a workaround, at the moment we have to force make's SHELL to point to bash.The cleanest way to do this is probably as follows:
$ make SHELL=$(command -v sh)
since from within guix environment --pure guix, sh ends up pointing to bash.Just for clarity, here is how this looks for me, currently:
$ git rev-parse HEAD 2708ae3d69b54d8323ca84fd9a7fb108a6ee96ba $ guix environment --pure guix $ readlink -f $(command -v sh) /gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7/bin/bash
[0]:https://lists.gnu.org/archive/html/guix-devel/2020-04/msg00232.html
Attachment: signature.asc
P
P
pelzflorian (Florian Pelz) wrote on 15 Apr 2020 14:21
(address . elaexuotee@wilsonb.com)(address . 40641@debbugs.gnu.org)
20200415122149.j7b6bcgvrp5cpq5l@pelzflorian.localdomain
On Wed, Apr 15, 2020 at 06:06:25PM +0900, elaexuotee--- via Bug reports for GNU Guix wrote:
Toggle quote (9 lines)> When building from git, ./bootstrap ends up generating (via automake) several> Makefiles that set SHELL = /bin/sh. However, some targets contain rules that> make use of bashisms. This leads to breakage when /bin/sh is something other> than bash.> > In particular, I am building from a foreign distro which links /bin/sh to dash.> Currently, this ends up breaking the build, the details of which I reported> to guix-devel in [0].
https://bugs.gnu.org/25258 is related. Your workaround may be more welcome.
Regards,Florian
E
E
elaexuotee wrote on 17 Apr 2020 16:57
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 40641@debbugs.gnu.org)
38M8QJ1PDKHCI.2ZBQF20W9BE03@wilsonb.com
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> wrote:
Toggle quote (16 lines)> On Wed, Apr 15, 2020 at 06:06:25PM +0900, elaexuotee--- via Bug reports for GNU Guix wrote:> > When building from git, ./bootstrap ends up generating (via automake) several> > Makefiles that set SHELL = /bin/sh. However, some targets contain rules that> > make use of bashisms. This leads to breakage when /bin/sh is something other> > than bash.> > > > In particular, I am building from a foreign distro which links /bin/sh to dash.> > Currently, this ends up breaking the build, the details of which I reported> > to guix-devel in [0].> > <https://bugs.gnu.org/25258> is related. Your workaround may be more welcome.> > Regards,> Florian

Florian,
Thanks for the pointer. I ended up doing a little bit of sleuthing and thinkI figured out a relatively clean fix---a simple one-liner in configure.ac.Attached is a proof-of-concept patch against master (974bf81776).
Currently, autoconf sets make's shell to whatever it thinks is best. On aforeign distribution, this often ends up something external to guix profile.However, when this isn't bash, we run into problems.
The patch's idea is to let make use its hard-coded default shell. A guix-builtmake will correctly fallback to whichever sh is in the profile, so for `guixenvironment guix' this effectively becomes $GUIX_ENVIRONMENT/bin/sh. Forexample,
$ echo '$(info $(SHELL))' | make -f - /gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7/bin/sh make: *** No targets. Stop.
I belive this should do the Right Thing. However, is there anything I ammissing? Perhaps this change would break build scenaries I am not thinking of?
Cheers,B. Wilson
From 6a5533fde0580a777a10f1155714f23a003003d9 Mon Sep 17 00:00:00 2001From: "B. Wilson" <elaexuotee@wilsonb.com>Date: Thu, 16 Apr 2020 17:02:06 +0900Subject: [PATCH] build: Let make use its hard-coded default shellTo: guix-patches@gnu.org
* configure.ac: Set AM_SUBST_NOTMAKE([SHELL])--- configure.ac | 4 ++++ 1 file changed, 4 insertions(+)
Toggle diff (17 lines)diff --git a/configure.ac b/configure.acindex 6a6a020585..dbb06f2258 100644--- a/configure.ac+++ b/configure.ac@@ -11,6 +11,10 @@ AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.14 gnu silent-rules subdir-objects \ color-tests parallel-tests -Woverride -Wno-portability]) +# Use make's hard-coded default shell. The make in a guix profile+# defaults to the Right Thing, e.g. $GUIX_ENVIRONMENT/bin/sh+AM_SUBST_NOTMAKE([SHELL])+ # Enable silent rules by default. AM_SILENT_RULES([yes]) -- 2.26.1
Attachment: signature.asc
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 40641@debbugs.gnu.org