GNU bug report logs - #57016
[PATCH] scripts: Bail out when running pull/package commands as root.

Previous Next

Package: guix-patches;

Reported by: "(" <paren <at> disroot.org>

Date: Sat, 6 Aug 2022 11:43:01 UTC

Severity: normal

Tags: patch

Done: "(" <paren <at> disroot.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 57016 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: "(" <paren <at> disroot.org>, 57016 <at> debbugs.gnu.org
Subject: Re: [bug#57016] [PATCH] scripts: Bail out when running pull/package
 commands as root.
Date: Sat, 6 Aug 2022 13:47:36 +0200
[Message part 1 (text/plain, inline)]
On 06-08-2022 13:41, ( via Guix-patches via wrote:
> +(define (assert-not-root override-flag)
> +  "Throw an error if Guix was invoked by root.  This allows us to
> +inform new users that it is usually a mistake to run commands such
> +as `guix package' as root.  OVERRIDE-FLAG should be a flag that can
> +be used with the invoked command to override this requirement."
> +  (when (= (getuid) 0)
> +    (leave (G_ "this command should not be run as root
> +
> +Note: Running this command as root will only affect the `root' user,
> +not the entire system, due to Guix's support for per-user package
> +management.  Use `~a' to continue regardless.~%")
> +           override-flag)))

Looks like a nice safety net, but maybe this would better use the 'hint' 
mechanism for consistency in error messages?

Greetings,
Maxime.

[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

This bug report was last modified 2 years and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.