* bug#4674: 23.1; UNC paths and file-relative-directory
@ 2009-10-08 13:54 Richard Copley
2010-12-04 12:55 ` bug#4673: " Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Richard Copley @ 2009-10-08 13:54 UTC (permalink / raw)
To: bug-gnu-emacs
The function `file-relative-directory' has logic to detect when the
two given paths are part of two separate directory trees, and to
return the absolute file name in such cases. That logic does not catch
the case when the two given paths are UNC paths on different servers.
For example, on my present network (where there are computers named
IOBATES and KERES), the form (file-relative-name "//iobates/e/temp"
"//keres/e/temp") returns "../../../iobates/e/temp", which is not a
valid relative path to "//iobates/e/temp" from "//keres/e/temp". This
is therefore a bug.
As a workaround, I have the following piece of advice in my
site-start. However I'm not sure that it is wise to mess with remote
file handling in this way.
(defadvice file-remote-p (around unc-host-and-share activate)
"For UNC paths, return the first two components."
(let ((file (ad-get-arg 0)))
(save-match-data
(if (and (eq system-type 'windows-nt)
(string-match "\\`\\(//[^:/\\\\]+/[^:/\\\\]+\\)" file))
(setq ad-return-value (match-string 1 file))
ad-do-it))))
In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
of 2009-07-30 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: ENG
value of $XMODIFIERS: nil
locale-coding-system: cp1252
default-enable-multibyte-characters: t
Major mode: Fundamental
Minor modes in effect:
tooltip-mode: t
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
global-auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-: ( f i l e - r e l a t i v e - n a m e SPC " / /
i o b a t e s / e / t e m p " SPC " / / k e r e s /
e / t e m p " ) <return> M-x r e p o r t - e m a c
s - b u g <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
"../../../iobates/e/temp"
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#4673: bug#4674: 23.1; UNC paths and file-relative-directory
2009-10-08 13:54 bug#4674: 23.1; UNC paths and file-relative-directory Richard Copley
@ 2010-12-04 12:55 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2010-12-04 12:55 UTC (permalink / raw)
To: Richard Copley, 4674-done, 4673-done
> Date: Thu, 8 Oct 2009 14:54:38 +0100
> From: Richard Copley <rcopley@gmail.com>
> Cc:
>
> The function `file-relative-directory' has logic to detect when the
> two given paths are part of two separate directory trees, and to
> return the absolute file name in such cases. That logic does not catch
> the case when the two given paths are UNC paths on different servers.
> For example, on my present network (where there are computers named
> IOBATES and KERES), the form (file-relative-name "//iobates/e/temp"
> "//keres/e/temp") returns "../../../iobates/e/temp", which is not a
> valid relative path to "//iobates/e/temp" from "//keres/e/temp". This
> is therefore a bug.
Thanks, I fixed this now on the Emacs-23 branch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-04 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-08 13:54 bug#4674: 23.1; UNC paths and file-relative-directory Richard Copley
2010-12-04 12:55 ` bug#4673: " Eli Zaretskii
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).