[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is the default $HOME /homeless-shelter?

From: Clément Lassieur
Subject: Re: Why is the default $HOME /homeless-shelter?
Date: Mon, 18 Nov 2019 13:15:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Jesse,

Jesse Gibbons <address@hidden> writes:

> On Sun, 2019-11-17 at 22:39 +0100, Ludovic Courtès wrote:
>> Hi!
>> Because it’s always been this way!  :-)
>> This is inherited from Nix.  The rationale is that there’s no home
>> directory in build environments, and perhaps Eelco Dolstra and others
>> back then found that setting ‘HOME’ to a non-existing directory broke
>> fewer builds that leaving it unset.
>> HTH,
>> Ludo’.

> Is this documented or speculation? What packages could break if $HOME is set
> to somewhere in /tmp?
> Considering these packages are usually written without knowing GuixSD
> exists, if a package install script depends on HOME I would think it would
> try to use $HOME as a directory expecting it to exist. Since it is
> /homeless-shelter by default, and /homeless-shelter does not exist on a
> default GuixSD install, we observe that most of the packages that depend on
> HOME need to be modified to set HOME, and the location of the new HOME is
> often inconsistently decided.
> If it is documented, I will admit defeat.
> If the reason Nix doesn't set HOME isn't documented, I think I will try
> setting HOME to a subdirectory of /tmp taking the target's hash and name
> into account. If that doesn't break anything, I think I will send a patch
> for core-updates. I would expect the patch to trigger a mass rebuild of
> every package. Hopefully that can be tested rigorously before core-updates
> is merged into master, and we will no longer need to change HOME when an
> install script depends on it.
> If anyone objects, please respond sooner rather than later.

It is documented there:

--8<---------------cut here---------------start------------->8---
HOME is set to /homeless-shelter to prevent programs from using
/etc/passwd or the like to find the user's home directory, which could
cause impurity. Usually, when HOME is set, it is used as the location of
the home directory, even if it points to a non-existent path.
--8<---------------cut here---------------end--------------->8---

and there:

--8<---------------cut here---------------start------------->8---
$HOME is not your home directory, and /homeless-shelter doesn't exist at
all. We force packages not to depend on $HOME during the build process.
--8<---------------cut here---------------end--------------->8---

and there:

--8<---------------cut here---------------start------------->8---
Set HOME to a non-existing path to prevent certain programs from using
/etc/passwd (or NIS, or whatever) to locate the home directory (for
example, wget looks for ~/.wgetrc).  I.e., these tools use /etc/passwd
if HOME is not set, but they will just assume that the settings file
they are looking for does not exist if HOME is set but points to some
non-existing path.
--8<---------------cut here---------------end--------------->8---

There's even a commit to complain if that directory exists:

--8<---------------cut here---------------start------------->8---
if (pathExists(homeDir))
    throw Error(format("directory `%1%' exists; please remove it") % homeDir);
--8<---------------cut here---------------end--------------->8---


reply via email to

[Prev in Thread] Current Thread [Next in Thread]