From patchwork Sun May 22 13:54:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yarl baudig X-Patchwork-Id: 39570 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2469A27BBEA; Sun, 22 May 2022 15:23:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 E687827BBE9 for ; Sun, 22 May 2022 15:23:10 +0100 (BST) Received: from localhost ([::1]:58200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsmUA-00058M-4w for patchwork@mira.cbaines.net; Sun, 22 May 2022 10:23:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsmU2-000588-Ae for guix-patches@gnu.org; Sun, 22 May 2022 10:23:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nsmU2-0004eh-2W for guix-patches@gnu.org; Sun, 22 May 2022 10:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nsmU1-0008Eu-Ol for guix-patches@gnu.org; Sun, 22 May 2022 10:23:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55577] [PATCH] Check substitute --help or --version options early Resent-From: yarl-baudig@mailoo.org Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 22 May 2022 14:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55577 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55577@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165322935531632 (code B ref -1); Sun, 22 May 2022 14:23:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 May 2022 14:22:35 +0000 Received: from localhost ([127.0.0.1]:46109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsmTZ-0008E6-E6 for submit@debbugs.gnu.org; Sun, 22 May 2022 10:22:35 -0400 Received: from lists.gnu.org ([209.51.188.17]:48634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsm2k-00072P-4B for submit@debbugs.gnu.org; Sun, 22 May 2022 09:54:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsm2j-0003k8-SX for guix-patches@gnu.org; Sun, 22 May 2022 09:54:49 -0400 Received: from msg-1.mailo.com ([213.182.54.11]:60282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsm2h-0000bK-Af for guix-patches@gnu.org; Sun, 22 May 2022 09:54:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailoo.org; s=mailo; t=1653227682; bh=kZlhmz2mrVMmu0n1r5XDX/M/8sWpUwu3O9YtblxgQb4=; h=X-EA-Auth:From:To:Date:Subject:MIME-Version:X-Mailer:Message-ID: Content-Type:Content-Transfer-Encoding; b=U4ZGy/CrTIHOTzvgrnvL1ZKWEjc3kUR+8NaWPrqWxeQBoDeDJKvDInLQ4a56ZKuIB li8T0e5+g+JB3xaGfjMwZPlD9vlBiM2jLR5pJsa2p74nwXrLmrCK1Hp4QztS2IUUru iI0kJ2bzasEV6o+jnxrdo3A6uIZgG7vIDXCestRw= Received: by www-7.mailo.com with http webmail; Sun, 22 May 2022 15:54:42 +0200 (CEST) X-EA-Auth: MFdw7ab51SW+aSaw1OCN3yMzwJdv2/lPYU4hKopUPGYLWIkcb2z3/Sy1gkGVXj0TIcnpTFwVW/9z0DieV4t4FNjOq1nG87gW From: yarl-baudig@mailoo.org Date: Sun, 22 May 2022 15:54:42 +0200 (CEST) X-Priority: 3 MIME-Version: 1.0 X-Mailer: COMS/EA21.01/r20220415 Message-ID: Received-SPF: pass client-ip=213.182.54.11; envelope-from=yarl-baudig@mailoo.org; helo=msg-1.mailo.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, 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-Mailman-Approved-At: Sun, 22 May 2022 10:22:32 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Running `guix archive --authorize` sets /etc/guix/acl to 600 via with-atomic-file-output via mkstemp!. Then running `guix substitute --help/--version` fails on "permission denied". While "guix substitute" is an internal tool, the options --help and --version exist and you should be able to run those from the command line. * guix/scripts/substitute.scm: earlier check for --help or --version. --- guix/scripts/substitute.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 908a8334a8..c5f5d23b47 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -704,6 +704,14 @@ (define-command (guix-substitute . args) (category internal) (synopsis "implement the build daemon's substituter protocol") + (match args + ((or ("-V") ("--version")) + (show-version-and-exit "guix substitute")) + ((or ("-h") ("--help") ()) + (show-help) + (exit 0)) + (_ #t)) + (define print-build-trace? (match (or (find-daemon-option "untrusted-print-extended-build-trace") (find-daemon-option "print-extended-build-trace")) @@ -775,10 +783,6 @@ (define reply-port #:print-build-trace? print-build-trace?) (loop)))))) - ((or ("-V") ("--version")) - (show-version-and-exit "guix substitute")) - ((or ("-h") ("--help")) - (show-help)) (opts (leave (G_ "~a: unrecognized options~%") opts))))))