summary refs log tree commit diff
diff options
context:
space:
mode:
authorTaylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>2014-07-05 15:36:44 +0300
committerLudovic Courtès <ludo@gnu.org>2014-07-05 15:09:43 +0200
commit6879fe235cd4366d57433d4154bed530ce60d874 (patch)
tree094a0368d82080643b12ab25cb952b983666925c
parent3e39b916b614b3aa62ffde37cbe9208273dc78f1 (diff)
downloadguix-6879fe235cd4366d57433d4154bed530ce60d874.tar.gz
guix package: Try $LOGNAME in addition to $USER.
Fixes <http://bugs.gnu.org/17946>.

Notoriously, cron jobs may set LOGNAME only and not USER.  See
e.g. crontab(5) under Debian 7 (wheezy).

* guix/scripts/package.scm (%profile-directory)
(guix-package): Also try LOGNAME if USER is unset.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/scripts/package.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index af86808fb5..1c3209f905 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -59,7 +59,8 @@
 
 (define %profile-directory
   (string-append %state-directory "/profiles/"
-                 (or (and=> (getenv "USER")
+                 (or (and=> (or (getenv "USER")
+                                (getenv "LOGNAME"))
                             (cut string-append "per-user/" <>))
                      "default")))
 
@@ -808,7 +809,9 @@ more information.~%"))
                 %profile-directory)
         (format (current-error-port)
                 (_ "Please change the owner of `~a' to user ~s.~%")
-                %profile-directory (or (getenv "USER") (getuid)))
+                %profile-directory (or (getenv "USER")
+                                       (getenv "LOGNAME")
+                                       (getuid)))
         (rtfm))))
 
   (define (process-actions opts)