From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user") Date: Tue, 03 Mar 2015 20:09:56 +0200 Message-ID: <83y4neosuj.fsf@gnu.org> References: <83r3ta4fwk.fsf@gnu.org> <837fuzse3n.fsf@gnu.org> <83fv9mqeh9.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1425406234 20494 80.91.229.3 (3 Mar 2015 18:10:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Mar 2015 18:10:34 +0000 (UTC) Cc: petewil@google.com, emacs-devel@gnu.org To: Michal Nazarewicz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 03 19:10:25 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YSrGw-0000gH-PX for ged-emacs-devel@m.gmane.org; Tue, 03 Mar 2015 19:10:22 +0100 Original-Received: from localhost ([::1]:40245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSrGv-0001LA-SK for ged-emacs-devel@m.gmane.org; Tue, 03 Mar 2015 13:10:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSrGi-0001KA-Qz for emacs-devel@gnu.org; Tue, 03 Mar 2015 13:10:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSrGe-0000VO-PF for emacs-devel@gnu.org; Tue, 03 Mar 2015 13:10:08 -0500 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:39463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSrGe-0000SZ-Gu for emacs-devel@gnu.org; Tue, 03 Mar 2015 13:10:04 -0500 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NKN00J00E1KOC00@mtaout24.012.net.il> for emacs-devel@gnu.org; Tue, 03 Mar 2015 20:02:05 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NKN00CKKE3HNI70@mtaout24.012.net.il>; Tue, 03 Mar 2015 20:02:05 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.180 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183608 Archived-At: > From: Michal Nazarewicz > Cc: petewil@google.com, emacs-devel@gnu.org > Date: Tue, 03 Mar 2015 18:48:24 +0100 >=20 > > It's a lie, and one that's tricky to untangle: you need to know t= hat > > to get a _real_ file name, you need to run it through > > expand-file-name. If you don't, things will subtly fail, e.g., i= f you > > compare this with some other file name. >=20 > This is already a problem on *all* systems and it happens if user i= nit > file is not found. If you run =E2=80=98emacs -u foo=E2=80=99 on GN= U/Linux, you=E2=80=99ll end > up with `user-init-file" equal to "~foo/.emacs". I don't understand how what you say is a contradiction to what I said= . > > Another important piece of the puzzle is that if USER is not > > recognized as a valid user by the getpwnam emulation on > > MS-Windows/MS-DOS, you get this: > > > > (expand-file-name "~USER") =3D> /current/directory/~USER > > > > And it is possible to have a literal "~USER" directory, in which = case > > the warning will be incorrectly skipped. >=20 > This also happens on UNIX-like systems. Of course, it does. So what? > Based on all that, I think the most consistent option is to: >=20 > 1) always check if ~USER/ directory exists for the =E2=80=98User fo= o has no home > directory=E2=80=99 warning; >=20 > 2) user ~USER/.emacs and ~USER/_emacs on MS-Windows; and >=20 > 3) use `expand-file-name' when setting `user-init-file' if init fil= e has > not been loaded. Sorry, I cannot follow the logic that led to these 3 conclusions. Please explain. (And don't we already do all that?) > The below untested patch does that plus stops Emacs from attempting= to > load init file if `init-file-user' is =E2=80=98invalid=E2=80=99, i.= e. contains ~, /, : > or \n. Why?