unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Glenn Morris <rgm@gnu.org>
Cc: 47298@debbugs.gnu.org
Subject: bug#47298: Emacs creates HOME if it does not exist
Date: Fri, 26 Mar 2021 12:18:20 +0300	[thread overview]
Message-ID: <YF2m3FiO3OUbqmIo@protected.localdomain> (raw)
In-Reply-To: <uo4kgzdr5n.fsf@fencepost.gnu.org>

* Glenn Morris <rgm@gnu.org> [2021-03-25 21:29]:
> Eli Zaretskii wrote:
> 
> >> From: Glenn Morris <rgm@gnu.org>
> >> Date: Sun, 21 Mar 2021 13:40:53 -0400
> >> 
> >> IMO the Emacs 26.3 behaviour is correct, and Emacs should not be
> >> creating HOME if it does not exist.
> >
> > I'm not sure I agree with you.  What do other programs do in this
> > situation?
> 
> Dunno.
> IMO applications should not be creating HOME, that is a system-level
> responsibility.

Emacs also does not create home directly, it creates its own
configuration directory appended to environment variable $HOME --
which in most cases is home directory of a user, but may not be. Home
directory of a user is located in /etc/passwd and $HOME is
customization that users still can do for other purpose.

If Emacs does not touch /etc/passwd or look for user's home there,
then is not creating user's home, it is creating its configuration
directory as appended to environment variable $HOME -- and other
applications do exactly the same!

Plethora of applications are creating their configurations in
~/.config -- so please look there, you will find all created
directories. 

Applications are then probably finding where is the config directory
by deriving it from $HOME environment variable or $XDG_CONFIG_HOME and
when $XDG_CONFIG_HOME is not there it is derived maybe from
XDG_CONFIG_HOME="$HOME/.config"

> Missing HOME indicates either a deliberate choice, or a system-level
> problem that the application should not try to fix (in most cases, it
> won't even have permission to do so) but should just report.

When application like Emacs runs, it does not "create home" as above
explained, but it wants to create its directory for future
functionality. Using $HOME environment variable is not same as user's
home directory, which is defined in /etc/passwd and need not be
defined in $HOME automatically -- though that is what systems do for
convenience.

I can enter in the system at /root point, it does not matter, $HOME is
where I have permission and my files. 

> > And if we don't create ~/.emacs.d, how can we save user's
> > customizations?
> 
> You don't, you give a warning.

Your assumption that Emacs changes or fiddles with user's home is
incorrect. It works (probably, me insecure) with $HOME variable which
is not equal to user's home, which is irrelevant to user's home
directory! 

I don't agree with this quite, as I use Emacs on Lineage OS, Android
OS, there are setups you do not know, and where this statement does
not apply. In fact there is no specific user's directory on such
systems and it depends of the access:

On the same system:

$ adb shell (but I am not root)
condor:/ $ echo $HOME
/

and I have no permissions to write in that directory, obviously it is
not real home, but I have $HOME.

Then different SSH application would give me different $HOME.

$ ssh motorolausb
$ echo $HOME
/data/data/com.termux/files/home

which is inconvenient, so I like changing $HOME variable to
/storage/emulated/0 as that is where Pictures, and Videos are located
as well, makes more sense to me.

> > That might mean we need to find other ways of isolating tests from
> > user customizations.
> 
> Your only alternative is to have the test machinery make a temporary but
> existing HOME and ensure it is deleted afterwards.
> But IMO that is a separate issue.
> Even if that change is made, I still don't believe Emacs should create HOME.

I think it should as all other applications follow that. Creating
$HOME is not same as creating user's home directory as specified in
/etc/passwd -- while similar, those things are not same, I have given
you example from Lineage OS system.

If the configuration directory cannot be created, no warning should be
issued as user is invoking Emacs most probably to edit text and there
is no need to confuse editing with configuration.

When configuration cannot be saved because the directory could not be
created, at the time point of not being able to save configuration,
that is where warning should be issued.

Jean





  reply	other threads:[~2021-03-26  9:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 17:40 bug#47298: Emacs creates HOME if it does not exist Glenn Morris
2021-03-21 19:03 ` Andreas Schwab
2021-03-22  6:55 ` Jean Louis
2021-03-22 17:29 ` Eli Zaretskii
2021-03-25 18:28   ` Glenn Morris
2021-03-26  9:18     ` Jean Louis [this message]
2022-06-25 15:28 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YF2m3FiO3OUbqmIo@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=47298@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).