unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34279: guix-install.sh: uses /bin/bash shebang
@ 2019-02-01 15:35 Claes Wallin
  2019-02-04 21:26 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Claes Wallin @ 2019-02-01 15:35 UTC (permalink / raw)
  To: 34279

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34279: guix-install.sh: uses /bin/bash shebang
  2019-02-01 15:35 bug#34279: guix-install.sh: uses /bin/bash shebang Claes Wallin
@ 2019-02-04 21:26 ` Ludovic Courtès
  2019-02-04 21:56   ` Ricardo Wurmus
  2019-02-05 11:04   ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-02-04 21:26 UTC (permalink / raw)
  To: Claes Wallin (韋嘉誠); +Cc: 34279

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

Hi,

Claes Wallin (韋嘉誠) <clacke@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:


[-- Attachment #2: Type: text/x-patch, Size: 805 bytes --]

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@gmail.com>
 # Copyright © 2018 Ricardo Wurmus <rekado@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; }

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


Thanks,
Ludo’.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#34279: guix-install.sh: uses /bin/bash shebang
  2019-02-04 21:26 ` Ludovic Courtès
@ 2019-02-04 21:56   ` Ricardo Wurmus
  2019-02-05 11:04   ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2019-02-04 21:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Claes Wallin, 34279


Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Claes Wallin (韋嘉誠) <clacke@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34279: guix-install.sh: uses /bin/bash shebang
  2019-02-04 21:26 ` Ludovic Courtès
  2019-02-04 21:56   ` Ricardo Wurmus
@ 2019-02-05 11:04   ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-02-05 11:04 UTC (permalink / raw)
  To: Claes Wallin (韋嘉誠); +Cc: 34279-done

Ludovic Courtès <ludo@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@gmail.com>
>  # Copyright © 2018 Ricardo Wurmus <rekado@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’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-05 11:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-01 15:35 bug#34279: guix-install.sh: uses /bin/bash shebang Claes Wallin
2019-02-04 21:26 ` Ludovic Courtès
2019-02-04 21:56   ` Ricardo Wurmus
2019-02-05 11:04   ` Ludovic Courtès

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).