unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: petewil@google.com, emacs-devel@gnu.org
Subject: Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user")
Date: Wed, 04 Mar 2015 20:06:20 +0200	[thread overview]
Message-ID: <83a8zsprhf.fsf@gnu.org> (raw)
In-Reply-To: <xa1ta8ztssid.fsf@mina86.com>

> From: Michal Nazarewicz <mina86@mina86.com>
> Cc: petewil@google.com, emacs-devel@gnu.org
> Date: Tue, 03 Mar 2015 22:03:38 +0100
> 
> > 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.
> 
> OK.  I was looking at the code with an assumption that it’s desired to
> have ‘-u USER’ 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’ve suggested this is undesired, we should start
> expanding the path.

Yes, probably.  OTOH, I don't think I've ever heard any complains with
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") => /current/directory/~USER
> >>>
> >>> And it is possible to have a literal "~USER" directory, in which case
> >>> the warning will be incorrectly skipped.
> 
> >> This also happens on UNIX-like systems.
> 
> On Tue, Mar 03 2015, Eli Zaretskii wrote:
> > Of course, it does.  So what?
> 
> If the situation you’ve described is incorrect, then it needs 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 attempting to
> >> load init file if `init-file-user' is ‘invalid’, i.e. contains ~, /, :
> >> or \n.
> 
> > Why?
> 
> So… why are we checking if user name is valid if we then just gonna read
> the files anyway?  What’s the point of this:
> 
>       (if (string-match "[~/:\n]" init-file-user)
> 	  (display-warning 'initialization
> 			   (format "Invalid user name %s"
> 				   init-file-user)
> 			   :error)

It's a warning.  I was asking why treat it as a fatal error.




      reply	other threads:[~2015-03-04 18:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28  0:06 [PATCH] for review - Allow expansion of "~" (as opposed to "~user") Pete Williamson
2015-02-28  8:08 ` Eli Zaretskii
2015-03-02  9:44   ` Michal Nazarewicz
2015-03-02 13:50     ` Eli Zaretskii
2015-03-02 20:37       ` Michal Nazarewicz
2015-03-03 15:37         ` Eli Zaretskii
2015-03-03 17:48           ` Michal Nazarewicz
2015-03-03 18:09             ` Eli Zaretskii
2015-03-03 18:20               ` Eli Zaretskii
2015-03-03 18:22                 ` Pete Williamson
2015-03-03 18:36                   ` Eli Zaretskii
2015-03-03 18:38                     ` Pete Williamson
2015-03-03 21:01                       ` Michal Nazarewicz
2015-03-03 21:03               ` Michal Nazarewicz
2015-03-04 18:06                 ` Eli Zaretskii [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83a8zsprhf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mina86@mina86.com \
    --cc=petewil@google.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).