From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@uni-duisburg.de (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Re: file-relative-name and remote files Date: Thu, 27 Feb 2003 18:02:22 +0100 Organization: University of Duisburg, Germany Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <84r89td5cx.fsf@lucy.is.informatik.uni-duisburg.de> References: <3E5C8BAC.8000201@math.ku.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1046366948 23162 80.91.224.249 (27 Feb 2003 17:29:08 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 27 Feb 2003 17:29:08 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18oRpP-0005wh-00 for ; Thu, 27 Feb 2003 18:28:15 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18oS6P-0008DX-00 for ; Thu, 27 Feb 2003 18:45:49 +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 18oRVq-0007Yz-07 for emacs-devel@quimby.gnus.org; Thu, 27 Feb 2003 12:08:02 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18oRVZ-0007Y2-00 for emacs-devel@gnu.org; Thu, 27 Feb 2003 12:07:45 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18oRVY-0007Xh-00 for emacs-devel@gnu.org; Thu, 27 Feb 2003 12:07:44 -0500 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18oRQQ-00072J-00 for emacs-devel@gnu.org; Thu, 27 Feb 2003 12:02:27 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18oRQ8-0003ry-00 for ; Thu, 27 Feb 2003 18:02:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18oRQ6-0003rd-00 for ; Thu, 27 Feb 2003 18:02:06 +0100 Original-Lines: 43 Original-X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50 (i686-pc-linux-gnu) Cancel-Lock: sha1:mJvmVaf+PpRRakdcw8PP3uB2LvQ= 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:12006 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12006 Richard Stallman writes: > I see that (expand-file-name "/larsh@galois.math.ku.dk:/../emacs") > returns "/larsh@galois.math.ku.dk:/../emacs". That is surprising; > I expected it to return "/emacs". > > It would probably be easy to change this, and that change would > probably fix the whole problem. But was this done intentionally? > Does it serve a specific purpose? > > If we don't change this behavior, then we do need to change > file-relative-name. In my mind, filenames are a forest, rather than a tree. For me, the name of a remote file is firmly separated into two parts: one part that specifies the host, and another part that specifies the file on that host. So opening the file /larsh@galois.math.ku.dk:/../emacs should behave the same as logging in to the host galois, then opening the file /../emacs there. If galois is a Unix host, then /../emacs should be the same as /emacs. Therefore, (expand-file-name "/larsh@galois.math.ku.dk:/../emacs") should evaluate to "/larsh@galois.math.ku.dk:/emacs". (It seems that Tramp has a bug in that it fails to remove the "/.." part.) I could not imagine in my wildest dreams that one could use relative file names (in particular, using "..") to cross host boundaries. Does this explain where the current behavior comes from? (Modulo that bug where expand-file-name fails to remove "..".) But I see that it is wrong to assume that filenames are a forest. Instead, it is right to assume they are a tree. I will change expand-file-name so that "/foo:/../bar" is handled correctly. 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"? -- A preposition is not a good thing to end a sentence with.