From mboxrd@z Thu Jan 1 00:00:00 1970 From: zimoun Subject: Re: guix gc doesn't seem to clean old guix revision Date: Mon, 2 Dec 2019 22:51:32 +0100 Message-ID: References: <87h82u32v3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:38429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibtbg-0007FZ-He for guix-devel@gnu.org; Mon, 02 Dec 2019 16:51:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibtbf-0005Cw-Fx for guix-devel@gnu.org; Mon, 02 Dec 2019 16:51:48 -0500 In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: YOANN P Cc: "guix-devel@gnu.org" Hi, On Mon, 2 Dec 2019 at 21:55, YOANN P wrote: > > I do not understand: running without any $USER is kind of very special > > edge case. > > It is not special at all, $USER is only set when using a login shell. > So if you script some guix commands (who doesn't use a login shell), > it broke as it broke with my tests. You have right about $USER. But it is not so common because the case has not been encountered too much already. ;-) > There is a user, this is just that the shell used is not a login shell. > Since $USER/$HOME are only set when using a login shell, it is > better to use `whoami` in place of $USER and expand ~$(whoami) > in place of $HOME in scripts to be sure to have the right values even > when using a non-login shell or to avoid errors if $USER was override. You are proposing to avoid the call to '(or (getenv "USER") (getenv "LOGNAME"))' in guix/profiles.scm and guix/store.scm and instead to rely on the command "whoami" from the coreutils package, right? Other said, instead of falling in the "default" case in %profile-directory, call the whoami command, right? Is whoami exposed in Guile? Thank you for the explanations. All the best, simon