unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31522] [PATCH] guix-install.sh: Fix chk_require exiting without warning.
@ 2018-05-18 21:29 Maxim Cournoyer
  2018-05-19 20:47 ` bug#31522: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Cournoyer @ 2018-05-18 21:29 UTC (permalink / raw)
  To: 31522

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

Attached is a patch to fix a problem in the detection of missing
programs in the guix-install.sh Bash script.

Maxim

[-- Attachment #2: 0001-guix-install.sh-Fix-chk_require-exiting-without-warn.patch --]
[-- Type: text/x-patch, Size: 1041 bytes --]

From 726d05a99529823d94c3fff1fa8619953e384b44 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 18 May 2018 10:51:29 -0400
Subject: [PATCH] guix-install.sh: Fix chk_require exiting without warning.

* etc/guix-install.sh (chk_require): Because of the set -e option, Bash was
exiting when the command `command -v "$c" &>/dev/null' was running on its
own. Instead, we now test the command and accumulate warning messages in a
single statement by chaining the command with a logical OR.
---
 etc/guix-install.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 78cd7580b..d9f195509 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -86,9 +86,7 @@ chk_require()
     _debug "--- [ $FUNCNAME ] ---"
 
     for c in ${cmds[@]}; do
-        command -v "$c" &>/dev/null
-        [ "$?" -eq "1" ] &&
-            warn+=("$c")
+        command -v "$c" &>/dev/null || warn+=("$c")
     done
 
     [ "${#warn}" -ne 0 ] &&
-- 
2.17.0


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

* bug#31522: [PATCH] guix-install.sh: Fix chk_require exiting without warning.
  2018-05-18 21:29 [bug#31522] [PATCH] guix-install.sh: Fix chk_require exiting without warning Maxim Cournoyer
@ 2018-05-19 20:47 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2018-05-19 20:47 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 31522-done

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> From 726d05a99529823d94c3fff1fa8619953e384b44 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Date: Fri, 18 May 2018 10:51:29 -0400
> Subject: [PATCH] guix-install.sh: Fix chk_require exiting without warning.
>
> * etc/guix-install.sh (chk_require): Because of the set -e option, Bash was
> exiting when the command `command -v "$c" &>/dev/null' was running on its
> own. Instead, we now test the command and accumulate warning messages in a
> single statement by chaining the command with a logical OR.

Applied, thanks!  :-)

Ludo'.

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

end of thread, other threads:[~2018-05-19 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18 21:29 [bug#31522] [PATCH] guix-install.sh: Fix chk_require exiting without warning Maxim Cournoyer
2018-05-19 20:47 ` bug#31522: " 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).