emacs-devel
[Top][All Lists]
Advanced

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

Re: file-relative-name and remote files


From: Lars Hansen
Subject: Re: file-relative-name and remote files
Date: Mon, 03 Mar 2003 11:22:30 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020826

Richard Stallman wrote:

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.
I do not agree. Let me try to explain why.

One might describe ".." as "the parent directory". This makes good sense when files make up a tree, because in that case each file (except the root) has exactly one parent. However, as I mentioned earlier, files do not in general make up a tree, they make up a more general graph. A file might have more than one parent. An example is the file

 /foo:x

This file should be thought of as "the file x on the remote computer" as well as "the file "/foo:x" on the local computer. The file has (at least) two parents: The parent of x on the remote computer and the parent of "/foo:x" on the local computer, i.e. the root on the local computer.

The fact that a file can have more than one parent is *not* special for the construct above. On a unix like system we have links. Consider the following example:

 galois:~/> mkdir y
 galois:~/> cd y
 galois:~/y/> mkdir x
 galois:~/y/> cd x
 galois:~/y/x/> ln -s ../x

Now the file x has two parents: y and itself! How does the system then decide what ".." should refer to? Take a look:

 galois:~/y/x/> cd x
 galois:~/y/x/x/> cd ..
 galois:~/y/x/> cd ..
 galois:~/y/>

We have a path to x, and ".." refers to the parent in that path. In the first "cd .." above ".." means x, in the second it means y.

In my opinion we should use the same strategy with remote files. Just as in the example above there is more than one path from a computer to the file y in my home directory on galois:

 /address@hidden:y
 /address@hidden:/home/l/larsh/y

In the first case ".." should refer to the root on the local machine, in the second case it should refer to the directory /home/l/larsh on the remote machine.

Thus I think that "/foo:../.." should refer to the root on the local machine (just like "/foo:bar/.." for any choice of "bar"). If you want to access files above the home directory on the remote machine, you should choose a path via the root on the remote machine.







reply via email to

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