From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: file-relative-name and remote files Date: Fri, 28 Feb 2003 21:25:28 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <3E5A8D95.9090803@math.ku.dk> <3E5C8BAC.8000201@math.ku.dk> <3E5E1F42.3020705@math.ku.dk> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1046485605 4038 80.91.224.249 (1 Mar 2003 02:26:45 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 1 Mar 2003 02:26:45 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18owi4-000130-00 for ; Sat, 01 Mar 2003 03:26:44 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18owzk-0002Ua-00 for ; Sat, 01 Mar 2003 03:45:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18owhK-0003xY-04 for emacs-devel@quimby.gnus.org; Fri, 28 Feb 2003 21:25:58 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18owgt-0003ue-00 for emacs-devel@gnu.org; Fri, 28 Feb 2003 21:25:31 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18owgr-0003rJ-00 for emacs-devel@gnu.org; Fri, 28 Feb 2003 21:25:30 -0500 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18owgr-0003qm-00 for emacs-devel@gnu.org; Fri, 28 Feb 2003 21:25:29 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.10) id 18owgq-0005b6-00; Fri, 28 Feb 2003 21:25:28 -0500 Original-To: Lars Hansen In-reply-to: <3E5E1F42.3020705@math.ku.dk> (message from Lars Hansen on Thu, 27 Feb 2003 15:22:58 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12036 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12036 One more problem: The syntax to invoke the Tramp file handler is "\`/[^/:]+:". So the handler is not invoked in the call (expand-file-name "/emacs/../larsh@galois.math.ku.dk:."). The call returns "/larsh@galois.math.ku.dk:." but it should return "/larsh@galois.math.ku.dk:/home/l/larsh". I am not sure whether "/larsh@galois.math.ku.dk:." is correct, but it might be. I don't think it should return "/larsh@galois.math.ku.dk:/home/l/larsh" because that requires contacting the remote host, and it is better if expand-file-name does its work locally. Btw, if the part after the colon is not an absolute filename, that is interpreted as being relative to the remote home dir. What happens if I open a file "/foo:../bar"? Is that the same as "/foo:/../bar" and therefore the same as "/bar"? It isn't the same as "/foo:/../bar", just as "/foo:bar" is not equivalent to "/foo:/bar". Hmm, this raises the issue of what expand-file-name should do with "/foo:../..". I guess it must leave that unchanged, which means that the expand-file-name handler for these file names should be rather careful in what it does to simplify whatever part of the name comes after. It is not correct to simplify /X/../Y into /Y when /X is a remote prefix. This seems to have implications about file-relative-name. Suppose we ask for (file-relative-name "/a/b" "/foo@quux:../../") I think in this case there is no correct relative file name that it could return. The only correct value to return is an absolute file name in this case. This seems to prove that the proposed change in file-relative-name should be made.