GNU bug report logs - #70148
[PATCH] guix-install.sh: Add daemonize to requirements.

Previous Next

Package: guix-patches;

Reported by: Richard Sent <richard <at> freakingpenguin.com>

Date: Tue, 2 Apr 2024 16:23:01 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Richard Sent <richard <at> freakingpenguin.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 70148 <at> debbugs.gnu.org, zimon.toutoune <at> 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
Hi Ludo!

Ludovic Courtès <ludo <at> 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.




This bug report was last modified 353 days ago.

Previous Next


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