From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 07 06:58:08 2024 Received: (at submit) by debbugs.gnu.org; 7 Feb 2024 11:58:08 +0000 Received: from localhost ([127.0.0.1]:55807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXgZ5-00060y-BU for submit@debbugs.gnu.org; Wed, 07 Feb 2024 06:58:08 -0500 Received: from lists.gnu.org ([2001:470:142::17]:55708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXgQ7-0005lV-VU for submit@debbugs.gnu.org; Wed, 07 Feb 2024 06:48:52 -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 ) id 1rXgPo-0006GY-EN for bug-guix@gnu.org; Wed, 07 Feb 2024 06:48:32 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXgPm-0005bQ-KN for bug-guix@gnu.org; Wed, 07 Feb 2024 06:48:32 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id EEC7A240027 for ; Wed, 7 Feb 2024 12:48:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707306507; bh=GjfGVdbbYRfYFQU++uRsKaRaRkuSjT1DumzBVvpu5q0=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type: Content-Transfer-Encoding:From; b=lvdwiw2PitY7jf+/KHSxuZUyq9P45sSpXK/jHM8oTYV2K7PnuMWtl+mkwOVVNBvSB BlkBvfvK7lcau6zeEXv1sl5mGVmho56xdhD3mQffJFqYA3cLK5YNhe+u2NEczmKexv xXMRa1mb3KymbWqDR6TvBeNssEsjRAY05nlAYjcNswXcF3c3NC9lYbAlu8kE8Aqyw+ ApDC643w625QwFP81NcNLmQ6quCxwg1e3v1rUKfrAiDUqGWn8g08zEZyLhBR8knX3h McN/TgilkJBM2DvpyFsW9I1zhjWMsCr5CdvZf2en9FVTRJbBXgSTbSuE68h9G8am0B UN4tUCAvXDOGg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TVJKQ2lvjz6tw6 for ; Wed, 7 Feb 2024 12:48:26 +0100 (CET) Message-ID: Date: Wed, 7 Feb 2024 11:48:25 +0000 MIME-Version: 1.0 Content-Language: en-US To: bug-guix@gnu.org From: Michal Atlas Subject: system reconfigure ignores incorrect --on-error flag value Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.65; envelope-from=michal_atlas+gnu@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 07 Feb 2024 06:58:07 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) In the guix/scripts/system.scm file we do not check the value while parsing the flag: --8<---------------cut here---------------start------------->8--- (option '("on-error") #t #f         (lambda (opt name arg result)           (alist-cons 'on-error (string->symbol arg)                       result))) --8<---------------cut here---------------end--------------->8--- and then blindly pass it to load*: --8<---------------cut here---------------start------------->8--- (load* file %user-module #:on-error (assoc-ref opts 'on-error)) --8<---------------cut here---------------end--------------->8--- and load* uses it in a case that only gets called when an actual error occurs and treats the correct symbols but has a default clause that silently ignores values other than debug and backtrace: --8<---------------cut here---------------start------------->8--- (case on-error ((debug) ...) ((backtrace) ...) (else #t)) --8<---------------cut here---------------end--------------->8--- meaning that for example a typo such as `--on-error=stacktrace`, gets treated as if the flag was not passed at all. Minimum replication: --8<---------------cut here---------------start------------->8--- guix system build <(echo x) --on-error=stacktrace guix system build <(echo x) --on-error=backtrace --8<---------------cut here---------------end--------------->8--- I'm not sure where the check should be done, nor what would be an acceptable way to not duplicate the list of valid values between guix/ui.scm and guix/scripts/system.scm