bug-guix
[Top][All Lists]
Advanced

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

bug#42983: "sudo -E guix pull" breaks ~/.config/guix/current for regular


From: Ludovic Courtès
Subject: bug#42983: "sudo -E guix pull" breaks ~/.config/guix/current for regular user
Date: Fri, 28 Aug 2020 15:41:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> The culprit, I think, is this:
>
> (define (ensure-default-profile)
>   (ensure-profile-directory)
>
>   ;; In 0.15.0+ we'd create ~/.config/guix/current-[0-9]*-link symlinks.  Move
>   ;; them to %PROFILE-DIRECTORY.
>   ;;
>   ;; XXX: Ubuntu's 'sudo' preserves $HOME by default, and thus the second
>   ;; condition below is always false when one runs "sudo guix pull".  As a
>   ;; workaround, skip this code when $SUDO_USER is set.  See
>   ;; <https://bugs.gnu.org/36785>.
>   (unless (or (getenv "SUDO_USER")
>               (string=? %profile-directory
>                         (dirname
>                          (canonicalize-profile %user-profile-directory))))
>     (migrate-generations %user-profile-directory %profile-directory))
>
> where
>
>   %profile-directory = "/var/guix/profiles/per-user/dannym"
>   %user-profile-directory = "/home/dannym/.config/guix/current" (which is a
> symlink to /var/guix/profiles/per-user/root/current-guix)

We could detect such inconsistencies and emit a warning/hint.  I’m
unsure just how far we need to go in trying to prevent users from
shooting themselves in the foot, though.  Thoughts?

> Ohh, yeah, sudo without "-E" works fine (sudo guix pull, too).

Yes.

Ludo’.





reply via email to

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