GNU bug report logs - #17946
Try LOGNAME in addition to USER

Previous Next

Package: guix;

Reported by: Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com>

Date: Sat, 5 Jul 2014 12:38:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17946 in the body.
You can then email your comments to 17946 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#17946; Package guix. (Sat, 05 Jul 2014 12:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 05 Jul 2014 12:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com>
To: bug-guix <at> gnu.org
Subject: Try LOGNAME in addition to USER
Date: Sat, 05 Jul 2014 15:36:44 +0300
Cron jobs may set the LOGNAME environment variable but no USER,
e.g. under Debian 7 (wheezy).  In that case 'guix package' fails to
use $localstatedir/guix/profiles/per-user/$user.  From a quick grep I
couldn't find more places in Guix where USER is used, so here's a
patch that just does it straightforwardly in two places in
scripts/package.scm, but perhaps a more generic solution would be good
for the future.


===File
/home/tub/media/src/guix/0001-Try-LOGNAME-in-addition-to-USER.patch===
From 902267cf99aacaea994cc95b77551f0d2bd35836 Mon Sep 17 00:00:00 2001
From: Taylan Ulrich B <taylanbayirli <at> gmail.com>
Date: Sat, 5 Jul 2014 15:28:50 +0300
Subject: [PATCH] Try LOGNAME in addition to USER.

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.
---
 guix/scripts/package.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index f930b00..2e626f3 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")))
 
@@ -797,7 +798,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)
-- 
1.8.4

============================================================

Taylan




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sat, 05 Jul 2014 13:13:01 GMT) Full text and rfc822 format available.

Notification sent to Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com>:
bug acknowledged by developer. (Sat, 05 Jul 2014 13:13:02 GMT) Full text and rfc822 format available.

Message #10 received at 17946-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com>
Cc: 17946-done <at> debbugs.gnu.org
Subject: Re: bug#17946: Try LOGNAME in addition to USER
Date: Sat, 05 Jul 2014 15:12:48 +0200
Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com> skribis:

> Cron jobs may set the LOGNAME environment variable but no USER,
> e.g. under Debian 7 (wheezy).  In that case 'guix package' fails to
> use $localstatedir/guix/profiles/per-user/$user.  From a quick grep I
> couldn't find more places in Guix where USER is used, so here's a
> patch that just does it straightforwardly in two places in
> scripts/package.scm, but perhaps a more generic solution would be good
> for the future.

Good catch.  I agree we’ll need to factorize that eventually.

> From 902267cf99aacaea994cc95b77551f0d2bd35836 Mon Sep 17 00:00:00 2001
> From: Taylan Ulrich B <taylanbayirli <at> gmail.com>
> Date: Sat, 5 Jul 2014 15:28:50 +0300
> Subject: [PATCH] Try LOGNAME in addition to USER.
>
> 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.

Pushed after tweaking the commit log.

Thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 03 Aug 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.