unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Sent <richard@freakingpenguin.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 70148@debbugs.gnu.org, zimon.toutoune@gmail.com
Subject: [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system
Date: Sun, 02 Jun 2024 10:33:56 -0400	[thread overview]
Message-ID: <87ikyre7mz.fsf@freakingpenguin.com> (raw)
In-Reply-To: <87a5k3n0eg.fsf@gnu.org> ("Ludovic Courtès"'s message of "Sun, 02 Jun 2024 11:45:27 +0200")

Hi Ludo!

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

> ‘local’, [[, and arrays are probably Bash-specific.  However this is a
> #!/bin/sh script, and some systems such as Debian use Dash as /bin/sh.
> So I’m afraid the script would break on such systems.
>
> WDYT?  Do you think we can avoid those features?

Right, I did notice that. A strictly 100% POSIX-compliant shell doesn't
support local, arrays, or [[]] constructs. From my understanding Dash
supports 1 and /maybe/ 3, but not 2.

However, the script already contains provisions to enter bash even if launched
using a POSIX-complaint shell. See this at the beginning:

--8<---------------cut here---------------start------------->8---
if [ "x$BASH_VERSION" = "x" ]
then
    exec bash "$0" "$@"
fi
--8<---------------cut here---------------end--------------->8---

This construct is a little bit odd to me. At the time it was added ( by
you ;) ) because /usr/bin/env did not exist on Guix System [1], but
that's been added since [2]. Perhaps we should change the shebang to
#!/usr/bin/env bash.

(Also looks like the comment you wrote re. bash was spliced away from
the code.)

--8<---------------cut here---------------start------------->8---
# We require Bash but for portability we'd rather not use /bin/bash or
# /usr/bin/env in the shebang, hence this hack.

# Environment variables
.......
if [ "x$BASH_VERSION" = "x" ]
.......
--8<---------------cut here---------------end--------------->8---

The script is already using all 3 of these constructs too.

[1]: https://issues.guix.gnu.org/34279
[2]: https://issues.guix.gnu.org/35910

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.




  reply	other threads:[~2024-06-03  4:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 16:14 [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements Richard Sent
2024-05-04 16:49 ` Ludovic Courtès
2024-05-04 22:44   ` Richard Sent
2024-05-22 14:08     ` Simon Tournier
2024-05-25 13:59       ` Ludovic Courtès
2024-05-29  0:36 ` [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system Richard Sent
2024-06-02  9:45   ` Ludovic Courtès
2024-06-02 14:33     ` Richard Sent [this message]
2024-06-04 10:11       ` bug#70148: " Ludovic Courtès

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=87ikyre7mz.fsf@freakingpenguin.com \
    --to=richard@freakingpenguin.com \
    --cc=70148@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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).