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

From: Leo Famulari <[email-masked]>
Date: Sat, 22 Aug 2020 12:22:41 -0400

On Sat, Aug 22, 2020 at 12:27:50PM +0200, Danny Milosavljevic wrote:
> Paul <[email-masked]> reported on IRC that his guix behaved strangely.  Upon
> investigation we found that the following happens (on a Guix system), when logged
> in as regular user (not root):
> 
> $ readlink ~/.config/guix/current
> /var/guix/profiles/per-user/dannym/current-guix
> $ sudo -E guix pull
> $ readlink ~/.config/guix/current
> /var/guix/profiles/per-user/root/current-guix

What is expected to happen in this case? Why would one want to use an
unprivileged environment with privileges to do `guix pull`, which is a
per-user operation?