GNU bug report logs -
#57031
[PATCH] scripts: Show a hint the first time some commands are run as root.
Previous Next
Full log
Message #44 received at 57031 <at> debbugs.gnu.org (full text, mbox):
Hi,
On Thu, 27 Oct 2022 at 06:52, "\( via Guix-patches" via <guix-patches <at> gnu.org> wrote:
> On Wed Oct 26, 2022 at 7:14 PM BST, zimoun wrote:
>> > - (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 ’root-hint?’ argument? Is it useful or can we drop it?
>
> This allows us to disable root hints for ``guix package'' variants, so eg
> ``sudo guix show'' will not trigger the root hint.
Ah, I see. But then,
guix package --show=hello
would print the hint, no?
> ;;;; guix/scripts.scm
>
> (define (warn-if-root hint-name)
> (when (and (not (hint-given hint-name))
> (zero? (getuid)))
> (record-hint hint-name)
> (warning (G_ "this command is user-specific, so running it as root \
> > > +will affect only the 'root' user~%"))))
>
> ;;;; guix/scripts/package.scm
>
> (when root-hint?
> (warn-if-root 'package-root-hint))
>
> ;;;; guix/scripts/pull.scm
>
> (warn-if-root 'pull-root-hint)
Something like that SGTM.
Cheers,
simon
This bug report was last modified 2 years and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.