Subject: Re: bug#57031: [PATCH] scripts: Show a hint the first time some commands are run as root.

From: "(" <[email-masked]>
Date: Sun, 11 Sep 2022 14:05:28 +0100

Hey Ludo,

On Mon Sep 5, 2022 at 10:11 PM BST, Ludovic Courtès wrote:
> One nitpick: Could you make moving the hint code from shell.scm to
> ui.scm a separate commit?

Sure!

> > +         (display-hint (G_ "`guix pull' is user-specific, not system-wide;
> > +running it as root will only affect the `root' user.")))
>
> Please use Texinfo markup in hints: @command{guix pull}, etc.  (Likewise
> for the second hint.)

Oh, I didn't realize you could do that.

> > +(define* (guix-package* opts #:key (root-hint? #f))
> >    "Run the 'guix package' command on OPTS, an alist resulting for command-line
> > -option processing with 'parse-command-line'."
> > +option processing with 'parse-command-line'.  If ROOT-HINT? is #T, a hint is
> > +shown on the first usage of this procedure that informs users about Guix's
> > +support for per-user package management."
> >    (with-error-handling
> > +    (when (and root-hint?
> > +               (not (hint-given? 'package-root-hint))
> > +               (= (getuid) 0))
>
> Unless I’m mistaken, ‘root-hint?’ is always true; should we just remove
> it?

No, it's not always true; we don't use `#:root-hint #t' in `guix search' and
`guix show', so that `sudo guix show foobar' doesn't trigger the root hint.

> BTW, when running ‘sudo guix install’, the hint is going to
> ~root/.cache/guix, right?

Probably -.o.-

    -- (