Message ID | 20221214155603.29381-2-maxim.cournoyer@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3D6B027BBE9; Wed, 14 Dec 2022 15:57:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 84C5E27BBEB for <patchwork@mira.cbaines.net>; Wed, 14 Dec 2022 15:57:48 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1p5U85-0001Au-3R; Wed, 14 Dec 2022 10:57:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1p5U7z-00018w-N2 for guix-patches@gnu.org; Wed, 14 Dec 2022 10:57:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1p5U7z-0006Dn-5O for guix-patches@gnu.org; Wed, 14 Dec 2022 10:57:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1p5U7z-0004bI-1L for guix-patches@gnu.org; Wed, 14 Dec 2022 10:57:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60069] [PATCH 2/2] guix-install.sh: Directly exit in case of errors in chk_require. Resent-From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 14 Dec 2022 15:57:02 +0000 Resent-Message-ID: <handler.60069.B.167103338417657@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60069 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60069@debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com> X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167103338417657 (code B ref -1); Wed, 14 Dec 2022 15:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Dec 2022 15:56:24 +0000 Received: from localhost ([127.0.0.1]:40036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1p5U7M-0004aj-AT for submit@debbugs.gnu.org; Wed, 14 Dec 2022 10:56:24 -0500 Received: from lists.gnu.org ([209.51.188.17]:40692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@gmail.com>) id 1p5U7J-0004aW-4J for submit@debbugs.gnu.org; Wed, 14 Dec 2022 10:56:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <maxim.cournoyer@gmail.com>) id 1p5U7I-0000Pw-Rg for guix-patches@gnu.org; Wed, 14 Dec 2022 10:56:20 -0500 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <maxim.cournoyer@gmail.com>) id 1p5U7H-0005aw-9d for guix-patches@gnu.org; Wed, 14 Dec 2022 10:56:20 -0500 Received: by mail-qt1-x82b.google.com with SMTP id fz10so2800590qtb.3 for <guix-patches@gnu.org>; Wed, 14 Dec 2022 07:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r1e7GD9O2+hfD7OLoW8NerYiWInDFB5EbjU5xiHA/w8=; b=eAC9CsjU+4SXqay2a+y8/ziKameiGIy9B/Pb3DS5yQ0C9ITog4Ofi1DAfPzaAL1hyC iKlc47IkQWjFlxU6BMJ0iF+GOjau7M2enEMXodXe3ldRUvvqY7otH5RYIfiLc1M+EVwl MN692sw0Ecw8wn6hT4mFUwSaGJQz36XOiyZ7dlL1d6LaYlrh7cV/p+ChkHxBPsHIZ1t5 sGGVDAz9JqVTt8Z0so4vYTmpTWggmvRHATjrynxwHE44CkX7X1onXfhev+8mq9XyeRS9 9LZZfL1Gm3uhAZkeY8WwkBSXcdI7xRnDxaayZPuCSB7fazeNaz3I1FS63/n3/1wCYs5r lDjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r1e7GD9O2+hfD7OLoW8NerYiWInDFB5EbjU5xiHA/w8=; b=VT2q7/qHdnpqjy0Ya67wYq1LH6pbrteDyxzScIh4HrLIn+LGrCtWR2IE616+3+6/PP z7Qk45RYK+0PIvEBmOFiXi7uMcIAgyOquohFU5dY8XJglUO9USz1khG3URgDnHemcF9v o9ocUzN8jVUl05JJuqLUt8mwr9WKCUcaM29KnPc35o5c5j6a9taXJ45XfctsWZlTq3xM f/oPIDqwguMuDw593RyLhN45jyqWbe9RTHz5H3d+dX9CD0HAcZsEzEi3Fn2ZJ+QkKBal jqSZcrdvZs8hLSo03ijTuK8llJvDAwKhQwQQ4VRnNdyc5PX3q6c5245dmn9oFfpwPN5P evvQ== X-Gm-Message-State: ANoB5plhXiAdZ+MWk3YlL3sEmtka8gLo821Z3kb63AmIKVUQVihUC8m7 vfc3fMhUhEkkLRVTDWVe6yWyJqEPvQWiAA== X-Google-Smtp-Source: AA0mqf6uRwO1InbTRP97WvgEsbf2Iecwrno9NYY/R+nGTX9CFEQ6eaqzt0Q41E+yWV26BZjebSz1Rw== X-Received: by 2002:ac8:545a:0:b0:3a8:649:8d0a with SMTP id d26-20020ac8545a000000b003a806498d0amr27485103qtq.30.1671033378078; Wed, 14 Dec 2022 07:56:18 -0800 (PST) Received: from localhost.localdomain ([2607:fad8:4:3::1006]) by smtp.gmail.com with ESMTPSA id k10-20020ac8074a000000b00397b1c60780sm1829150qth.61.2022.12.14.07.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 07:56:17 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Wed, 14 Dec 2022 10:56:03 -0500 Message-Id: <20221214155603.29381-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221214155603.29381-1-maxim.cournoyer@gmail.com> References: <20221214155603.29381-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::82b; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x82b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#60068,1/2] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment variable.
|
|
Commit Message
Maxim Cournoyer
Dec. 14, 2022, 3:56 p.m. UTC
* etc/guix-install.sh (chk_require): Directly exit in case of errors in chk_require, instead of relying on 'set -e'. --- etc/guix-install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Comments
Maxim Cournoyer 写道: > - [ "${#warn}" -ne 0 ] && > - { _err "${ERR}Missing commands: ${warn[*]}."; > - return 1; } > - > + [ "${#warn}" -ne 0 ] && die "Missing commands: ${warn[*]}." > + I did not run this, but will it not itself trigger -e when the test is false? Kind regards, T G-R
Hi Tobias, Tobias Geerinckx-Rice <me@tobias.gr> writes: > Maxim Cournoyer 写道: >> - [ "${#warn}" -ne 0 ] && >> - { _err "${ERR}Missing commands: ${warn[*]}."; >> - return 1; } >> - + [ "${#warn}" -ne 0 ] && die "Missing commands: >> ${warn[*]}." >> + > > I did not run this, but will it not itself trigger -e when the test > is false? This apparently falls in the special casing by Bash of what is considered a failure when using 'set -e'; here's a test: --8<---------------cut here---------------start------------->8--- $ cat test.sh #!/usr/bin/env bash set -e [ false ] && echo "hey, we made it!" --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- $ ./test.sh hey, we made it! --8<---------------cut here---------------end--------------->8--- I hope this answers your question.
Hi, Maxim Cournoyer <maxim.cournoyer@gmail.com> writes: > Hi Tobias, > > Tobias Geerinckx-Rice <me@tobias.gr> writes: > >> Maxim Cournoyer 写道: >>> - [ "${#warn}" -ne 0 ] && >>> - { _err "${ERR}Missing commands: ${warn[*]}."; >>> - return 1; } >>> - + [ "${#warn}" -ne 0 ] && die "Missing commands: >>> ${warn[*]}." >>> + >> >> I did not run this, but will it not itself trigger -e when the test >> is false? > > This apparently falls in the special casing by Bash of what is > considered a failure when using 'set -e'; here's a test: > > $ cat test.sh > #!/usr/bin/env bash > > set -e > > [ false ] && echo "hey, we made it!" > > $ ./test.sh > hey, we made it! The above example was bogus and unnecessary; looking at it more closely, the test would return true when the 'warn' array contains 1 or more items (missing commands), which would cause the die command to be invoked and the script to exit. The first test handling isn't modified, so it'll chain though the second part the same as it does now. I hope that's a better explanation.
diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 06730f7e3f..0ca12f8b66 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -137,10 +137,8 @@ chk_require() command -v "$c" &>/dev/null || warn+=("$c") done - [ "${#warn}" -ne 0 ] && - { _err "${ERR}Missing commands: ${warn[*]}."; - return 1; } - + [ "${#warn}" -ne 0 ] && die "Missing commands: ${warn[*]}." + _msg "${PAS}verification of required commands completed" }