[Top][All Lists]

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


From: Stefan Monnier
Subject: Re: $USERPROFILE for $HOME on W32
Date: Fri, 26 Nov 2004 17:03:51 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

>> 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")
        ELISP> (expand-file-name "~/")

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.


reply via email to

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