all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: $USERPROFILE for $HOME on W32
Date: Fri, 26 Nov 2004 17:03:51 -0500	[thread overview]
Message-ID: <873bywuw2n.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <01c4d3f9$Blat.v2.2.2$ab0ba100@zahav.net.il> (Eli Zaretskii's message of "Fri, 26 Nov 2004 22:50:11 +0200")

>> Obviously I don't understand what you mean by "before" and "after" dumping.
>> When I build on my GNU/Linux system, before dump HOME=/u/monnier, and after
>> dump HOME=/u/fernanda, /u/monnier/, /u/root, /u/guest, ...

> On the same system as the one where it was dumped and when invoked by
> the same user, it will stay /u/monnier/.

Not necessarily.  My HOME dir might get moved at some point.

>> That would screw up anyone who runs an Emacs he hasn't built himself.
>> I.e. 99% of the users.  I think we'd know about it by now.

> You lost me here: on a Posix system, the value of HOME known to Emacs
> does not change in the midst of the session startup.  It is set
> outside of Emacs and never changes during the Emacs session.

No: *you* lost me here.  Of course HOME typically never changes during
a session.  But you were talking about "before dumping" and "after dumping",
which is a whole other kettle of fish.

> So such changes are never experienced by Emacs users on Posix systems.

Probably.  I'm pretty sure I tried to change HOME in a running Emacs
a couple times (I change my HOME like that occasionally to try and confine
some operations to a particular subdir, or to get a program to ignore (and
to not change) my config), but I must admit that I can't remember how it
affected this Emacs session.

>> This has nothing to do with single-user or not.  On Unix we are also
>> guaranteed that the uid will not change under us while running Emacs.
>> And yet, everytime we do getpwnam, we rebuilt its value to obey the current
>> value of $HOME, in case the user changed it with (setenv "HOME" foo).
>> Read the source.

> Wait a minute, I always thought setenv only modifies the value of the
> variable for the subprocesses, not the value seen by Emacs.

Sorry I got confused, that's in the VMS-only code.

> It modifies process-environment, but does not call setenv or putenv in
> C to modify the environment of the Emacs process, right?  So (setenv
> "HOME" foo) should not matter for the value of pw_dir, right?

> Hmm... that probably means that, since your suggestion is based on
> using setenv, it is not going to work, i.e. it will not change the
> value of HOME as known to Emacs itself.  Am I missing something?

You might be completely right.  As I said it sucks to develop blindfolded.
So if someone could actually try the fucking damn patch and help me fix it
instead of waste my time about details, ...
Or even write a counter patch.

>> And BTW, W32 is not very different w.r.t single or multi user.  The GUI
>> makes it difficult to have more than one person logged in at the same time,
>> but other than that it's basically just the same.

> Not as far as getpwuid is concerned: the code is written to support
> only one user ID: the one we saw at Emacs startup.  Read the source.

That's not what I meant.  I meant that 2 users can use the same Emacs
executable (tho in two different processes), just as under Unix.
The lack of support for "other uid" has only minimal impact: basically it
prevents ~<user> from working and that's about it.  Big deal.

> i.e. some of the init_* functions.  In the case in point, we need to
> set HOME very early, because the C part of the session initialization
> needs to see the same value of HOME as the Lisp code and all the rest
> of the session will.

Why would it matter?
Here's a sample session under GNU/Linux.

        % (unset HOME; emacs)
        M-x ielm
	*** Welcome to IELM ***  Type (describe-mode) for help.
	ELISP> (expand-file-name "~/")
	"/"
	ELISP> (setenv "HOME" "/u/monnier")
	"/u/monnier"
	ELISP> (expand-file-name "~/")
	"/u/monnier/"
	ELISP> 

HOME is not nearly as important as you'd think.  The only place where it is
needed before reading .emacs seems to be in order to read ~/.Xresources and
~/.Xauthority (although I'd argue that we should only open the X display
after reading the .emacs file).

Anyway, feel free to provide an alternative patch.


        Stefan

  reply	other threads:[~2004-11-26 22:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-22  6:26 $USERPROFILE for $HOME on W32 Stefan Monnier
2004-11-22  8:44 ` Jason Rumney
2004-11-22 13:04   ` Stefan Monnier
2004-11-25 16:00   ` Stefan Monnier
2004-11-25 16:34     ` Jason Rumney
2004-11-25 16:54       ` Stefan
2004-11-25 21:52         ` Eli Zaretskii
2004-11-25 22:46           ` Jason Rumney
2004-11-26 10:32             ` Eli Zaretskii
2004-11-25 16:57     ` Andreas Schwab
2004-11-25 17:45       ` Stefan
2004-11-25 17:49         ` Andreas Schwab
2004-11-25 21:45         ` Eli Zaretskii
2004-11-26 20:56           ` Eli Zaretskii
2004-11-26 23:42             ` Andreas Schwab
2004-11-27  9:33               ` Eli Zaretskii
2004-11-27 13:26                 ` Andreas Schwab
2004-11-27 16:40                   ` Eli Zaretskii
2004-11-27 17:46                     ` Andreas Schwab
2004-11-25 22:04     ` Eli Zaretskii
2004-11-25 23:43       ` Stefan Monnier
2004-11-26 10:29         ` Eli Zaretskii
2004-11-26 14:47           ` Stefan Monnier
2004-11-26 20:50             ` Eli Zaretskii
2004-11-26 22:03               ` Stefan Monnier [this message]
2004-11-27 11:36                 ` Eli Zaretskii
2004-12-06 23:17   ` Lennart Borgman
2004-11-22 15:46 ` Eli Zaretskii
2004-11-22 16:47   ` Stefan Monnier
2004-11-23 11:49     ` Eli Zaretskii
2004-11-23  8:30   ` Jason Rumney
2004-11-23 11:32     ` Eli Zaretskii
2004-11-23 20:47       ` Jason Rumney
2004-11-23 20:57         ` Eli Zaretskii
2004-11-24  8:17 ` John Paul Wallington

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

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

  git send-email \
    --in-reply-to=873bywuw2n.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.