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: Wed, 04 Mar 2015 20:06:20 +0200 Message-ID: <83a8zsprhf.fsf@gnu.org> References: <83r3ta4fwk.fsf@gnu.org> <837fuzse3n.fsf@gnu.org> <83fv9mqeh9.fsf@gnu.org> <83y4neosuj.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 1425492404 1058 80.91.229.3 (4 Mar 2015 18:06:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Mar 2015 18:06:44 +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 Wed Mar 04 19:06:36 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 1YTDgo-0007YD-Oq for ged-emacs-devel@m.gmane.org; Wed, 04 Mar 2015 19:06:34 +0100 Original-Received: from localhost ([::1]:45724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTDgn-0006eZ-NL for ged-emacs-devel@m.gmane.org; Wed, 04 Mar 2015 13:06:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTDgj-0006eS-Dl for emacs-devel@gnu.org; Wed, 04 Mar 2015 13:06:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTDgg-0002V3-51 for emacs-devel@gnu.org; Wed, 04 Mar 2015 13:06:29 -0500 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:44890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTDgf-0002Uv-OJ for emacs-devel@gnu.org; Wed, 04 Mar 2015 13:06:26 -0500 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NKP00L008NWIR00@mtaout27.012.net.il> for emacs-devel@gnu.org; Wed, 04 Mar 2015 20:00:57 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NKP00A778PKJLD0@mtaout27.012.net.il>; Wed, 04 Mar 2015 20:00:57 +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.183 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:183647 Archived-At: > From: Michal Nazarewicz > Cc: petewil@google.com, emacs-devel@gnu.org > Date: Tue, 03 Mar 2015 22:03:38 +0100 >=20 > > Btw, I'd like to reiterate something I already suggested near the > > beginning: just error out if "-u USER" is used on DOS/Windows. I > > think this should put all this issue to rest, and avoid unneeded > > complexity, FAQs, etc. >=20 > OK. I was looking at the code with an assumption that it=E2=80= =99s desired to > have =E2=80=98-u USER=E2=80=99 working in some way. If that is not= the case, much of > what I wrote is irrelevant. I doubt if this "feature" gets any use at all on non-Posix systems. The code is there, and does its job, so we could leave it alone. But if we want to clean this up, I say let's error out when "-u USER" is used on systems where that makes no sense at all, or is impossible. > Still, for the third point, if no init file has been loaded, > `expand-file-name' is *not* used on `user-init-file' which ends up = being > something like "~/.emacs" (i.e. not an absolute path but one which = needs > expanding). Since you=E2=80=99ve suggested this is undesired, we s= hould start > expanding the path. Yes, probably. OTOH, I don't think I've ever heard any complains wit= h such a situation. > >>> 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 whic= h case > >>> the warning will be incorrectly skipped. >=20 > >> This also happens on UNIX-like systems. >=20 > On Tue, Mar 03 2015, Eli Zaretskii wrote: > > Of course, it does. So what? >=20 > If the situation you=E2=80=99ve described is incorrect, then it nee= ds to be > fixed for *NIX. If it is correct, why are you mentioning it? As a reminder that ~USER/ will not magically expand into ~/ on these systems, since the code was specifically tweaked to behave like Posix systems do. > >> The below untested patch does that plus stops Emacs from attempt= ing to > >> load init file if `init-file-user' is =E2=80=98invalid=E2=80= =99, i.e. contains ~, /, : > >> or \n. >=20 > > Why? >=20 > So=E2=80=A6 why are we checking if user name is valid if we then ju= st gonna read > the files anyway? What=E2=80=99s the point of this: >=20 > (if (string-match "[~/:\n]" init-file-user) > =09 (display-warning 'initialization > =09=09=09 (format "Invalid user name %s" > =09=09=09=09 init-file-user) > =09=09=09 :error) It's a warning. I was asking why treat it as a fatal error.