summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-09-18 22:59:13 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-18 23:08:29 +0200
commitee25048e51dd45ad91a1ad4b0f25f4013843c52b (patch)
treec330de56da9c91aa58665a8dc6a0447a901372b8
parent45fbc15a48d04cf9deaa5d40658846426cc94845 (diff)
downloadpatches-ee25048e51dd45ad91a1ad4b0f25f4013843c52b.tar
patches-ee25048e51dd45ad91a1ad4b0f25f4013843c52b.tar.gz
pull: Work around Ubuntu's 'sudo'.
Partly fixes <https://bugs.gnu.org/36785>. Reported by Julien Lepiller <julien@lepiller.eu>. * guix/scripts/pull.scm (ensure-default-profile): Do not call 'migrate-generations' when "SUDO_USER" is set.
-rw-r--r--guix/scripts/pull.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 54bbaddf30..4b03cea2e3 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -293,8 +293,15 @@ true, display what would be built without actually building it."
;; In 0.15.0+ we'd create ~/.config/guix/current-[0-9]*-link symlinks. Move
;; them to %PROFILE-DIRECTORY.
- (unless (string=? %profile-directory
- (dirname (canonicalize-profile %user-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))
;; Make sure ~/.config/guix/current points to /var/guix/profiles/….