emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user")


From: Eli Zaretskii
Subject: Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user")
Date: Wed, 04 Mar 2015 20:06:20 +0200

> From: Michal Nazarewicz <address@hidden>
> Cc: address@hidden, address@hidden
> 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 via email to

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