From mboxrd@z Thu Jan 1 00:00:00 1970 From: Taylan Ulrich Bayirli/Kammer Subject: bug#17946: Try LOGNAME in addition to USER Date: Sat, 05 Jul 2014 15:36:44 +0300 Message-ID: <87wqbsc78j.fsf@taylan.uni.cx> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3PEK-0003Z3-FN for bug-guix@gnu.org; Sat, 05 Jul 2014 08:38:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X3PEB-0002It-9N for bug-guix@gnu.org; Sat, 05 Jul 2014 08:38:12 -0400 Received: from debbugs.gnu.org ([140.186.70.43]:52327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3PEB-0002Io-60 for bug-guix@gnu.org; Sat, 05 Jul 2014 08:38:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X3PEA-0005JH-Hy for bug-guix@gnu.org; Sat, 05 Jul 2014 08:38:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3PDO-0003XL-8Z for bug-guix@gnu.org; Sat, 05 Jul 2014 08:37:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X3PDF-0001fB-5u for bug-guix@gnu.org; Sat, 05 Jul 2014 08:37:14 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:52953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3PDE-0001dA-V8 for bug-guix@gnu.org; Sat, 05 Jul 2014 08:37:05 -0400 Received: by mail-wi0-f176.google.com with SMTP id n3so13924934wiv.3 for ; Sat, 05 Jul 2014 05:37:04 -0700 (PDT) Received: from taylan.uni.cx ([85.100.205.21]) by mx.google.com with ESMTPSA id l5sm90690009wif.22.2014.07.05.05.37.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Jul 2014 05:37:03 -0700 (PDT) List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: 17946@debbugs.gnu.org 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 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