Subject: Re: [bug#57016] [PATCH] scripts: Bail out when running pull/package commands as root.

From: Maxime Devos <[email-masked]>
Date: Sat, 6 Aug 2022 13:47:36 +0200

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.