From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: $USERPROFILE for $HOME on W32 Date: Fri, 26 Nov 2004 09:47:50 -0500 Message-ID: <87llcobs1i.fsf-monnier+emacs@gnu.org> References: <87vfbycsgj.fsf-monnier+emacs@gnu.org> <87mzx69bkn.fsf-monnier+emacs@gnu.org> <01c4d33a$Blat.v2.2.2$dbe68ca0@zahav.net.il> <01c4d3a2$Blat.v2.2.2$f32d2000@zahav.net.il> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1101480812 15694 80.91.229.6 (26 Nov 2004 14:53:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 26 Nov 2004 14:53:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 26 15:53:26 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CXhOz-0007sN-00 for ; Fri, 26 Nov 2004 15:48:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CXhYF-0005XS-8R for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2004 09:58:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CXhY7-0005UM-9v for emacs-devel@gnu.org; Fri, 26 Nov 2004 09:58:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CXhY6-0005Te-AN for emacs-devel@gnu.org; Fri, 26 Nov 2004 09:58:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CXhY6-0005Sp-0R for emacs-devel@gnu.org; Fri, 26 Nov 2004 09:58:14 -0500 Original-Received: from [209.226.175.25] (helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CXhO3-0005qi-K3; Fri, 26 Nov 2004 09:47:51 -0500 Original-Received: from alfajor ([67.68.216.58]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20041126144750.HWBV2026.tomts5-srv.bellnexxia.net@alfajor>; Fri, 26 Nov 2004 09:47:50 -0500 Original-Received: by alfajor (Postfix, from userid 1000) id F1ED7D73CB; Fri, 26 Nov 2004 09:47:50 -0500 (EST) Original-To: Eli Zaretskii In-Reply-To: <01c4d3a2$Blat.v2.2.2$f32d2000@zahav.net.il> (Eli Zaretskii's message of "Fri, 26 Nov 2004 12:29:26 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30388 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30388 >> > Lisp means, e.g., that temacs will have different ideas about HOME >> > etc. than the dumped Emacs, which I think might confuse someone some >> >> Huh? Of course HOME is different before and after the dump. >> How could it be otherwise? > We are emulating a Posix system where HOME's value is something > determined outside Emacs. If you set HOME in init_environment, it > will be the same before and after dumping, as it is on a Posix system, > since init_environment is called unconditionally in the W32 port, and > called very early in the initialization process, way before the Lisp > interpreter is started and any application-level code runs. 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, ... > The way you suggested to do it, not only will it be different before > and after the dumping, but it also changes its value in the middle of > loadup, because startup.el is loaded after many other Lisp files. Huh? The code is not run when startup.el is loaded. It's run when we call normal-top-level. > Such a change is unexpected by any reasonable Emacs hacker, and could > cost someone several hours of useless ``debugging'', or even real bugs > if some preloaded Lisp file references HOME's value. 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. > Why insist on doing that when there's a cleaner way? For that matter, is > there any reason at all to favor doing this in Lisp? I don't think I've > heard even a single reason in favor; did I miss something? I find it much easier to write (file-writable-p "~/.emacs"). And I know it will not dump a core, even if I mess up badly. >> > This change means that we run this code every time getpwuid is called. >> Right. Just as we do it on Unix (except on Unix we only do it for HOME >> and not for SHELL). > Unix is a different matter. The W32 port emulates a single user, so > the values are guaranteed to be constant. The right way to impement > such emulations is to use static variables initialized only once. 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. 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. > It's just one of several minor reasons. I never said your suggestion > was a catastrophe, only that there's a slightly better way. But if > what I said, and the fact that Jason also preferred doing that in C, > don't convince you, then probably nothing will; I give up. My opinion is that something should be done in C only if it can't be done in elisp, or if it's inconvenient to do it in elisp, or if doing it in elisp is too costly performancewise. I don't think any of those 3 cases applies here. Stefan