GNU bug report logs - #25258
Bashisms when building 0.11.0

Previous Next

Package: guix;

Reported by: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>

Date: Sat, 24 Dec 2016 07:53:01 UTC

Severity: normal

Done: Leo Famulari <leo <at> famulari.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25258 in the body.
You can then email your comments to 25258 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#25258; Package guix. (Sat, 24 Dec 2016 07:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 24 Dec 2016 07:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: bug-guix <at> gnu.org
Subject: Bashisms when building 0.11.0
Date: Sat, 24 Dec 2016 08:26:27 +0100
[Message part 1 (text/plain, inline)]
Hello,

Guix' testsuite uses the non-POSIX bashism `type -P guile` in
tests/guix-packages.sh which causes a test failure when using
Dash to provide /bin/sh instead of Bash. Additionally gnu/local.mk uses
brace expansion which is not part of POSIX and does not work on Dash.

When building Guix on Parabola GNU/Linux-libre modified to use Dash as
/bin/sh,[1] this causes the Guix build to fail. For building, the guix
0.11.0 package from AUR[2] was used. The attached “patch” allows for a
successful build but is not what we want.

Guix should probably not use bashisms in its Makefile includes and
either not use bashisms in its test suite or make sure the test suite is
executed explicitly with Bash and not /bin/sh.

Regards,
Florian Pelz

[1] https://wiki.archlinux.org/index.php/Dash#Use_DASH_as_.2Fbin.2Fsh
[2] https://aur.archlinux.org/packages/guix/

[guix-remove-bashisms.patch (text/x-patch, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#25258; Package guix. (Wed, 13 Feb 2019 01:47:01 GMT) Full text and rfc822 format available.

Message #8 received at 25258 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 25258 <at> debbugs.gnu.org
Subject: Re: bug#25258: Bashisms when building 0.11.0
Date: Tue, 12 Feb 2019 20:46:30 -0500
[Message part 1 (text/plain, inline)]
On Sat, Dec 24, 2016 at 08:26:27AM +0100, pelzflorian (Florian Pelz) wrote:
> Guix' testsuite uses the non-POSIX bashism `type -P guile` in
> tests/guix-packages.sh which causes a test failure when using
> Dash to provide /bin/sh instead of Bash. Additionally gnu/local.mk uses
> brace expansion which is not part of POSIX and does not work on Dash.
> 
> When building Guix on Parabola GNU/Linux-libre modified to use Dash as
> /bin/sh,[1] this causes the Guix build to fail. For building, the guix
> 0.11.0 package from AUR[2] was used. The attached “patch” allows for a
> successful build but is not what we want.
> 
> Guix should probably not use bashisms in its Makefile includes and
> either not use bashisms in its test suite or make sure the test suite is
> executed explicitly with Bash and not /bin/sh.

About two years have passed on this bug report without comment. Is it a
"wontfix"?
[signature.asc (application/pgp-signature, inline)]

Reply sent to Leo Famulari <leo <at> famulari.name>:
You have taken responsibility. (Sun, 22 Mar 2020 20:29:02 GMT) Full text and rfc822 format available.

Notification sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
bug acknowledged by developer. (Sun, 22 Mar 2020 20:29:02 GMT) Full text and rfc822 format available.

Message #13 received at 25258-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 25258-done <at> debbugs.gnu.org
Subject: Re: bug#25258: Bashisms when building 0.11.0
Date: Sun, 22 Mar 2020 16:28:32 -0400
On Tue, Feb 12, 2019 at 08:46:30PM -0500, Leo Famulari wrote:
> About two years have passed on this bug report without comment. Is it a
> "wontfix"?

Based on the lack of interest I've closed this bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Apr 2020 11:24:08 GMT) Full text and rfc822 format available.

bug unarchived. Request was from elaexuotee <at> wilsonb.com to control <at> debbugs.gnu.org. (Sat, 16 May 2020 04:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#25258; Package guix. (Sat, 16 May 2020 06:34:02 GMT) Full text and rfc822 format available.

Message #20 received at 25258 <at> debbugs.gnu.org (full text, mbox):

From: elaexuotee <at> wilsonb.com
To: 25258 <at> debbugs.gnu.org
Subject: Bashisms in make rules
Date: Sat, 16 May 2020 15:33:09 +0900
[Message part 1 (text/plain, inline)]
Resurrecting this, since it cause me significant grief, and is a simple
workaround which I believe is worth putting in the documentation. First, here
is a short summary of the problem:

Currently, some of our make rules contain bashisms. As of commit 408ae72c, this
ends up generating broken texinfo translations under doc/*.texi, eventually
failing with "@ref reference to nonexistent node..." errors.

From a pristine repository (e.g. after running `git clean -xfd'), running make
shows a bunch of errors from the broken rules, but since they happen to be
multi-line scripts, the errors fail to propogate up to make. Thus make leaves
around the broken texinfo files. The real kicker is that subsequent runs pick
up the broken files and make fails just as above, but without encountering or
showing the errors from the broken rules. This makes tracking down the error
significantly more painful and non-obvious.

Anyway, the source of the problem is a combination of our use of bashisms and
autoconf trying really hard to use the least-common-denominator shell.
Autoconf's configure script sets make's SHELL by first looking for /bin/sh and
only finding sh on PATH as a last resort. Thus, even when running under `guix
environment --pure guix' make will run with /bin/sh instead of
$GUIX_ENVIRONMENT/bin/sh.

On a Guix System this ends up running make with the sh of the system profile
which, at the moment, resolves to bash. However, on a foreign distribution,
/bin/sh often resolves to a non-bash shell; in particular, it is common these
days for it to be a symlink to dash. Hence, lots of pain.

Once we know the source of the error, the fix is simple. We can explicitly tell
make to run it's rules with bash:

    $ make SHELL=$(command -v bash)

In a guix environment, this should pick up the bash in $GUIX_ENVIRONMENT.
Better yet, we can do this once, by telling *configure* what shell to use:

    $ CONFIG_SHELL=$(command -v bash) ./configure

and all subsequent runs of make will Just Work from within the environment.

Does this make sense? Am I missing something obvious? If not, would it make
sense to include the above ./configure invocation in our documentation?

Ideally, we could modify Makefile.am or configure.ac in some way to
automatically fix the problem; however, if we want to support build exterior to
a guix build environment, I suspect the "most correct" course of action is to
simply remove our bashisms.

That said, we could tell automake to *not* explicity set make's SHELL by a
simple one-liner in `configure.ac':

    AM_SUBST_NOTMAKE([SHELL])

This will cause make to use it's baked-in default instead of the one autoconf
detects. Luckily, for guix builds make correctly references the profile's sh:

    $ strings $GUIX_ENVIRONMENT/bin/make | grep bin/sh
    /gnu/store/<hash>-bash-<version>/bin/sh

and non-guix make is likely to point to something relevant for that
distribution anyway. That said, I am sure automake and autoconf set make's
SHELL for a reason, so perhaps this solution is too heavy of a hammer.
Thoughts?

Anyway, this turned into a lot longer of an email than I anticipated. Thanks
for taking the time to read through it.
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#25258; Package guix. (Sun, 17 May 2020 16:43:01 GMT) Full text and rfc822 format available.

Message #23 received at 25258 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Legoll <vincent.legoll <at> gmail.com>
To: 25258 <at> debbugs.gnu.org
Subject: Re: Bashisms in make rules
Date: Sun, 17 May 2020 18:42:22 +0200
Hello,

Having done a few bashismectomies lately (in guix-install.sh), I
can sympathetize with you.

I don't know guix team's stance on that kind ow work (I still have not
polished my work enough for review). But it looks like you stumbled on
some painful items, that ought to be resolved one way or the other.

It would be nice to hear that those are actionable items that will
receive positive feedback before doing substantial work. (Looks like
I should have asked that earlier, before falling into the rabbit
hole...)

I personally think we should try to support using guix as widely as
possible/practical on foreign distros.

So, WDGCT (What Do Guix Core Think) ?

Thanks

-- 
Vincent Legoll




Information forwarded to bug-guix <at> gnu.org:
bug#25258; Package guix. (Sun, 17 May 2020 17:35:01 GMT) Full text and rfc822 format available.

Message #26 received at 25258 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Vincent Legoll <vincent.legoll <at> gmail.com>
Cc: 25258 <at> debbugs.gnu.org
Subject: Re: bug#25258: Bashisms in make rules
Date: Sun, 17 May 2020 19:34:51 +0200
[Message part 1 (text/plain, inline)]
Vincent,

Vincent Legoll 写道:
> I don't know guix team's stance on that kind ow work (I still 
> have not
> polished my work enough for review). But it looks like you 
> stumbled on
> some painful items, that ought to be resolved one way or the 
> other.

The only reason for Guix to have any shell code at all is to run 
in places where Guile isn't (yet) available.  Therefore it should 
be portable between GNU systems, or it might as well be Guile.  I 
don't believe GNU implies bash.

> It would be nice to hear that those are actionable items that 
> will
> receive positive feedback before doing substantial work. (Looks 
> like
> I should have asked that earlier, before falling into the rabbit
> hole...)

Big upz from me.  Thanks for being proactive :-)

The challenge is keeping new bashisms out, so sudo please try to 
include some automated tests.  Maybe you can use shellcheck; our 
test suite could use a GHC dependency.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Jun 2020 11:24:05 GMT) Full text and rfc822 format available.

Changed bug title to 'Bashisms in test suite cause 3 tests to fail when using a POSIX Bourne shell' from 'Bashisms when building 0.11.0' Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 11 Jul 2022 13:51:01 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.