unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: elaexuotee--- via Bug reports for GNU Guix <bug-guix@gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: 40641@debbugs.gnu.org
Subject: bug#40641: Building from git breaks when /bin/sh isn't bash
Date: Fri, 17 Apr 2020 23:57:04 +0900	[thread overview]
Message-ID: <38M8QJ1PDKHCI.2ZBQF20W9BE03@wilsonb.com> (raw)
In-Reply-To: <20200415122149.j7b6bcgvrp5cpq5l@pelzflorian.localdomain>


[-- Attachment #1.1: Type: text/plain, Size: 1760 bytes --]

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> wrote:
> 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 think
I 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 a
foreign 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-built
make will correctly fallback to whichever sh is in the profile, so for `guix
environment guix' this effectively becomes $GUIX_ENVIRONMENT/bin/sh. For
example,

    $ 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 am
missing? Perhaps this change would break build scenaries I am not thinking of?

Cheers,
B. Wilson


[-- Attachment #1.2: 0001-build-Let-make-use-its-hard-coded-default-shell.patch --]
[-- Type: text/plain, Size: 866 bytes --]

From 6a5533fde0580a777a10f1155714f23a003003d9 Mon Sep 17 00:00:00 2001
From: "B. Wilson" <elaexuotee@wilsonb.com>
Date: Thu, 16 Apr 2020 17:02:06 +0900
Subject: [PATCH] build: Let make use its hard-coded default shell
To: guix-patches@gnu.org

* configure.ac: Set AM_SUBST_NOTMAKE([SHELL])
---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2020-04-17 16:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15  9:06 bug#40641: Building from git breaks when /bin/sh isn't bash elaexuotee--- via Bug reports for GNU Guix
2020-04-15 12:21 ` pelzflorian (Florian Pelz)
2020-04-17 14:57   ` elaexuotee--- via Bug reports for GNU Guix [this message]
2022-06-10  0:34     ` Maxim Cournoyer
2022-06-13 14:40       ` pelzflorian (Florian Pelz)
2022-06-14 16:09         ` Maxim Cournoyer
2022-06-21  0:20           ` elaexuotee--- via Bug reports for GNU Guix
2022-06-21  9:02             ` pelzflorian (Florian Pelz)
2022-07-04 11:22               ` elaexuotee--- via Bug reports for GNU Guix
     [not found]               ` <62c2cd89.1c69fb81.7ad72.92c8SMTPIN_ADDED_BROKEN@mx.google.com>
2022-07-07 21:52                 ` Maxim Cournoyer
2022-07-08  8:53                   ` pelzflorian (Florian Pelz)
2022-07-08  8:58                     ` pelzflorian (Florian Pelz)
2022-07-08  9:51                     ` elaexuotee--- via Bug reports for GNU Guix
2022-07-10  4:56                     ` Maxim Cournoyer
2022-07-10 10:13                       ` elaexuotee--- via Bug reports for GNU Guix
     [not found]                       ` <62caa649.1c69fb81.5b288.1112SMTPIN_ADDED_BROKEN@mx.google.com>
2022-07-10 19:55                         ` Maxim Cournoyer
2022-07-11 13:48                           ` Maxim Cournoyer
2022-07-19  4:14                             ` elaexuotee--- via Bug reports for GNU Guix
2022-07-21 15:29                               ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38M8QJ1PDKHCI.2ZBQF20W9BE03@wilsonb.com \
    --to=bug-guix@gnu.org \
    --cc=40641@debbugs.gnu.org \
    --cc=elaexuotee@wilsonb.com \
    --cc=pelzflorian@pelzflorian.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).