GNU bug report logs - #34279
guix-install.sh: uses /bin/bash shebang

Previous Next

Package: guix;

Reported by: Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se>

Date: Fri, 1 Feb 2019 16:12:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

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 34279 in the body.
You can then email your comments to 34279 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#34279; Package guix. (Fri, 01 Feb 2019 16:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 01 Feb 2019 16:12:02 GMT) Full text and rfc822 format available.

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

From: Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se>
To: bug-guix <at> gnu.org
Subject: guix-install.sh: uses /bin/bash shebang
Date: Fri, 1 Feb 2019 16:35:56 +0100
This means ./guix-install.sh doesn't work on e.g. NixOS. :-)

Please use /usr/bin/env bash.

The manual workaround is obvious, but this is a thousand-papercuts bug.




Information forwarded to bug-guix <at> gnu.org:
bug#34279; Package guix. (Mon, 04 Feb 2019 21:27:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se>
Cc: 34279 <at> debbugs.gnu.org
Subject: Re: bug#34279: guix-install.sh: uses /bin/bash shebang
Date: Mon, 04 Feb 2019 22:26:03 +0100
[Message part 1 (text/plain, inline)]
Hi,

Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se> skribis:

> This means ./guix-install.sh doesn't work on e.g. NixOS. :-)
>
> Please use /usr/bin/env bash.

/usr/bin/env wouldn’t work on Guix System by default.  :-)

What about something like this:

[Message part 2 (text/x-patch, inline)]
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 8eb5214049..dc8de2fe92 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2017 sharlatan <sharlatanus <at> gmail.com>
 # Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
@@ -19,6 +19,13 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
+# We require Bash but for portability we'd rather not use /bin/bash or
+# /usr/bin/env in the shebang, hence this hack.
+if [ "x$BASH_VERSION" = "x" ]
+then
+    exec bash "$0" "$@"
+fi
+
 set -e
 
 [ "$UID" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
[Message part 3 (text/plain, inline)]
Thanks,
Ludo’.

Information forwarded to bug-guix <at> gnu.org:
bug#34279; Package guix. (Tue, 05 Feb 2019 01:43:01 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Claes Wallin <clacke <at> lysator.liu.se>, 34279 <at> debbugs.gnu.org
Subject: Re: bug#34279: guix-install.sh: uses /bin/bash shebang
Date: Mon, 04 Feb 2019 22:56:01 +0100
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se> skribis:
>
>> This means ./guix-install.sh doesn't work on e.g. NixOS. :-)
>>
>> Please use /usr/bin/env bash.
>
> /usr/bin/env wouldn’t work on Guix System by default.  :-)

“guix-install.sh” arguably would not primarily be executed on a Guix
system.

> +# We require Bash but for portability we'd rather not use /bin/bash or
> +# /usr/bin/env in the shebang, hence this hack.
> +if [ "x$BASH_VERSION" = "x" ]
> +then
> +    exec bash "$0" "$@"
> +fi
> +

Neat!

--
Ricardo





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 05 Feb 2019 11:05:02 GMT) Full text and rfc822 format available.

Notification sent to Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se>:
bug acknowledged by developer. (Tue, 05 Feb 2019 11:05:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se>
Cc: 34279-done <at> debbugs.gnu.org
Subject: Re: bug#34279: guix-install.sh: uses /bin/bash shebang
Date: Tue, 05 Feb 2019 12:04:44 +0100
Ludovic Courtès <ludo <at> gnu.org> skribis:

> What about something like this:
>
> diff --git a/etc/guix-install.sh b/etc/guix-install.sh
> index 8eb5214049..dc8de2fe92 100755
> --- a/etc/guix-install.sh
> +++ b/etc/guix-install.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  # GNU Guix --- Functional package management for GNU
>  # Copyright © 2017 sharlatan <sharlatanus <at> gmail.com>
>  # Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
> @@ -19,6 +19,13 @@
>  # You should have received a copy of the GNU General Public License
>  # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
>  
> +# We require Bash but for portability we'd rather not use /bin/bash or
> +# /usr/bin/env in the shebang, hence this hack.
> +if [ "x$BASH_VERSION" = "x" ]
> +then
> +    exec bash "$0" "$@"
> +fi

Pushed as f5fdc54d3a0845d0590c181d3bd6016f22765431.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Mar 2019 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 47 days ago.

Previous Next


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