[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57031] [PATCH v2 2/2] scripts: Warn the first time pull or package
From: |
zimoun |
Subject: |
[bug#57031] [PATCH v2 2/2] scripts: Warn the first time pull or package is run as root. |
Date: |
Thu, 27 Oct 2022 10:23:19 +0200 |
Hi,
On Thu, 27 Oct 2022 at 06:52, "\( via Guix-patches" via <guix-patches@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