[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#57016] [PATCH] scripts: Bail out when running pull/package commands

From: Maxime Devos
Subject: [bug#57016] [PATCH] scripts: Bail out when running pull/package commands as root.
Date: Sat, 6 Aug 2022 13:47:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

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?


Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]