emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] trunk r116230: Fix bug #16558 with w32-shell-execute o


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] trunk r116230: Fix bug #16558 with w32-shell-execute on remote file names.
Date: Wed, 05 Feb 2014 18:07:59 +0200

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Wed, 05 Feb 2014 09:10:46 -0500
> 
> >> (if (file-name-absolute-p file) <use file>
> >> (let ((dir (file-name-directory file)))
> >> (if (null dir) <use file>
> >> (if (faccess dir) <use (expand-file-name file)>
> >> <use file>))))
> > Yes, except that the primitives you use here only work on file names,
> > and might go bananas when presented with something else, e.g. a URL.
> 
> AFAIK all magic file-name handlers will do something reasonable with
> the above (file-name-absolute-p file) and (file-name-directory file).

Not really:

  (file-name-directory "http://foo.com/wherever/index.html";)
    => "http://foo.com/wherever/";

  (file-name-absolute-p "http://foo.com/wherever/index.html";)
    => nil

Moreover, no one said that any particular DOCUMENT that is passed to
this function will have an Emacs file handler.

> But we could also let-bind file-name-handlers-alist to nil around those
> calls (or use lower level code which does something similar).

We do the latter.  I don't think the former is a good idea, because I
think at least expand-file-name should allow its handler to run,
e.g. for use cases like cygwin-mount.

> We don't need to call the Elisp primitives since we really only care
> about the system-level's notion of absolute file name and file name
> separator.

Right; and we don't.

> - we don't check file-name-handlers

Why is that a good idea?  If a file name has a handler, any success in
faccess etc. can only be a (rare) coincidence.

> - we only check (faccess dir) rather than (faccess file), and only if
>   there's a "dir".

What is "dir" here?

> - we don't bother with any of it if the file is already absolute.

See above: deciding whether it is absolute is not easy.  I'm afraid we
will need most of expand-file-name's code for that anyway.



reply via email to

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