From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oJu+FMC6WWM0JAAAbAwnHQ (envelope-from ) for ; Thu, 27 Oct 2022 00:54:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4PyzFMC6WWMCxQAAauVa8A (envelope-from ) for ; Thu, 27 Oct 2022 00:54:56 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1C6C439375 for ; Thu, 27 Oct 2022 00:54:56 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onpHg-0007FB-4q; Wed, 26 Oct 2022 18:54:04 -0400 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 1onpHf-0007Ek-0u for guix-patches@gnu.org; Wed, 26 Oct 2022 18:54:03 -0400 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 ) id 1onpHe-0001Sb-Fl for guix-patches@gnu.org; Wed, 26 Oct 2022 18:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1onpHe-0002jZ-3z for guix-patches@gnu.org; Wed, 26 Oct 2022 18:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57031] [PATCH v2 2/2] scripts: Warn the first time pull or package is run as root. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Oct 2022 22:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57031 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57031@debbugs.gnu.org Cc: "\(" X-Debbugs-Original-To: "( via Guix-patches via" , 57031@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166682478910387 (code B ref -1); Wed, 26 Oct 2022 22:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Oct 2022 22:53:09 +0000 Received: from localhost ([127.0.0.1]:55477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1onpGn-0002hS-B5 for submit@debbugs.gnu.org; Wed, 26 Oct 2022 18:53:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:49216) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1onpGl-0002hF-MW for submit@debbugs.gnu.org; Wed, 26 Oct 2022 18:53:08 -0400 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 1onpGl-0005Ok-FP for guix-patches@gnu.org; Wed, 26 Oct 2022 18:53:07 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onpGj-0001OC-MF for guix-patches@gnu.org; Wed, 26 Oct 2022 18:53:07 -0400 Received: by mail-wr1-x435.google.com with SMTP id w14so4670877wru.8 for ; Wed, 26 Oct 2022 15:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JV1yqY6C+F7cj3clF1shYHjJCMupUjrla+Weq/KAS50=; b=jQ2ve+ISYfHroaw9Hhm33gIH9W7c0mDUx1cY0F31iGCB3fgGDu9vGHcWsk/evSk65c l9i49WXDH+hdPU3yRk/FhiDjgxNmLtKNLVvnnD+jElAWNw7Q3+JLUJcyCdx3Q7i8K0cF nepoXvtt8cbvo5W3SvfV9k5/Vf7KpETGWt/YethLYFhlLMy0axxLf2r+XkemxgrRdYN3 svg2DhEOeEgD5PgQpGVO+6o4S4gxgdBkGXZOCEEI0YSPnzHZB/ZMW+cEBDIxG1UWZ4Fm uiQFRmUYhRAgtBAVlV5Y72qKD92mw8ZUERavUEIFXnI8YBnoOLdQ2FYlZ/TTr6DBndDz PFbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JV1yqY6C+F7cj3clF1shYHjJCMupUjrla+Weq/KAS50=; b=Pc19CdogxjSsuHTM6yANjEwdkAxj0DZA1vjwli2gmSwwhLon6jgwAJo6vwqGRVuMFf /sYOwCrgsmpHmYRlp4eyJOt9YuYmEe8u9mbA3DnEqPZcAuTPH1xj+MNzOFH6GcdOwKKR rP0t1SVImjda22iAqClWNTtKNPxhEa/MqrSwPzkZsRVxO45cG+N8L9bkpHVDcWLd51NT kLWFB8pXJhMgEg290Pk5bgqC8BtaAF0oA3KCv1W8rXuaj0qp6zG+y3h5z6oxoTpsebbD z9m7ePdonaS/u0vdcYygIztWcZm8vy/2F5pIos0yEi8cfVlBTt72vk86K3/PkIG3fmZI CI7g== X-Gm-Message-State: ACrzQf1iKff1DUWHabHgfyskTG5oaPd3eQUoprcDOBZnX/sWoi8iA4RK LyGV54J74ukwpoIDBoD3GpU= X-Google-Smtp-Source: AMsMyM5gLubu45+Be+t6IC3STO0hpRQKnuPUJqa9En85SJq1JqU+ssrLLP4z7H7d6JBu6P2uVM/ihQ== X-Received: by 2002:adf:f68a:0:b0:236:6e9b:dc91 with SMTP id v10-20020adff68a000000b002366e9bdc91mr13168774wrp.207.1666824782074; Wed, 26 Oct 2022 15:53:02 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b002345cb2723esm6195458wrq.17.2022.10.26.15.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 15:53:01 -0700 (PDT) From: zimoun In-Reply-To: <20220911195941.8442-2-paren@disroot.org> References: <20220911195941.8442-1-paren@disroot.org> <20220911195941.8442-2-paren@disroot.org> Date: Wed, 26 Oct 2022 20:14:49 +0200 Message-ID: <86lep2jvty.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, 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=no 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Guix-patches" Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666824896; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=JV1yqY6C+F7cj3clF1shYHjJCMupUjrla+Weq/KAS50=; b=N+i/VqUs8WaNtyBGrRJ1DNmcJ+bH/gU6ESI3K7PHb0ILM6pF6A+i1hVNCr2o4ssq2svoJn zqjqqGg4FJGVAdash3KX4keDFP/g7n3FPSS4bhTgEe0L4O6vogavzqra0dAgKsoWxZkgxD 9U9QCFY3yLgpvy0qSd0SQH1tF+LMIPLozrMtBt1IuaQgcS8camSc5UH3I6joq+GG+BML88 VhcEjHyDnwaO6z5JinyTtm0V+Dps4UuaKDlfPbZKDFeXQwVAsMPm457wwAsLsFQh415hW2 bB18R4XeX3sWyabWSBss59WMohI762q10118mPkxk+Lnw2ta6LMaYkO5EQBYLA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666824896; a=rsa-sha256; cv=none; b=kyB890FZ0FS/YE+OgzEcb7Sgj/gJsmMlCb4iajW+4fRSkYgEms0a50FcjDDZGWaftmb8wq OWDm81FBz003tyi65lrUgoX8OtJjtobjseqYgwTS7U6LCsOqnQArGJrA8Vkit4MP0nm1sa e1HVFscMzd0QH0v6z8Nk0aOR/xVRmu+xXXHSOEfL1CfA1JUuDsELNDh7wskDR3DWR+J9ux 9LUqG79AmIN2WbCEwfrsn/xRtY7jYVCp5RDotg8rnZRvLngPkBKqGDxiqB1yUgdi+nuHqY Cl5fyKF5MvU8SeyC7IP98rQ2sdNpjQ/cj5tAH3QzVx0TAKeL+bQ2R+cvDcSgqw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=jQ2ve+IS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.48 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=jQ2ve+IS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1C6C439375 X-Spam-Score: 6.48 X-Migadu-Scanner: scn0.migadu.com X-TUID: JTxoI4iPutTw Hi, On Sun, 11 Sep 2022 at 20:59, "\( via Guix-patches" via wrote: > * guix/scripts/pull.scm (guix-pull): Warn the first time it's being > run as root. > * guix/scripts/package.scm (guix-package*): Likewise if the new > `root-hint?' argument is `#t'. > (guix-package): Use `#:root-hint? #t' in invocation of `guix-package*'. > * guix/scripts/install.scm (guix-install): Likewise. > * guix/scripts/remove.scm (guix-remove): Likewise. > * guix/scripts/remove.scm (guix-upgrade): Likewise. > > A pretty common beginner mistake, it seems, is assuming that since > every other package manager you've used requires root for installing, > removing, and upgrading packages, Guix must too. > > This commit tries to make it harder to make such an assumption, by > making commands such as `pull`, `package`, and `upgrade` display > a warning the first time they are run as root. This patch LGTM aside=E2=80=A6 > - (guix-package* opts)) > + (guix-package* opts #:root-hint? #t)) [...] > - (guix-package* opts)) > + (guix-package* opts #:root-hint? #t)) [...] > -(define (guix-package* opts) > +(define* (guix-package* opts #:key (root-hint? #f)) Why this =E2=80=99root-hint?=E2=80=99 argument? Is it useful or can we dro= p it? > + (when (and root-hint? > + (not (hint-given? 'package-root-hint)) > + (zero? (getuid))) > + (record-hint 'package-root-hint) > + (warning (G_ "this command is user-specific, so running it as root= \ > +will affect only the 'root' user~%"))) [...] > + (when (and (not (hint-given? 'pull-root-hint)) > + (zero? (getuid))) > + (record-hint 'pull-root-hint) > + (warning (G_ "this command is user-specific, so running it as root= \ > +will affect only the 'root' user~%"))) It looks pretty similar. Is it possible to avoid the duplication? Cheers, simon