Re: (expand-file-name "/..")
"Stephen J. Turnbull" <[email protected]>
| Newsgroups | gmane.emacs.xemacs.beta |
|---|---|
| Message-ID | <[email protected]> |
Marcus Harnisch writes: > I think you are getting the even/odd pattern. Beware of path names > that have parent references beyond root! This oscillating pattern is > particularly annoying when you traversing directory trees to find > project root directories or similar tasks. If (expand-file-name "/..") -> "/.." as currently[1], I see two ways that we could go. One is to assume that in fact there is a superroot (as on Windows, where there is a drive letter before the filesystem root, but nothing before that, so (expand-file-name "/../..") -> "/.." as well. The alternative would be to assume that it might be "turtles all the way down," so (expand-file-name "/../..") -> "/../..", (expand-file-name "/../../..") -> "/../../..", and so on. I suppose you prefer the former, but feel free to tell me otherwise. One thing we could potentially do would be to rethink the functionality, decide what The Right Thing is based on 25 years of experience with expand-file-name, implement that and call it "canonicalize-file-name". I'm not sure that would be all that beneficial, though, and I don't know that we have enough non-POSIX- filesytem-semantics expertise lying around to decide what to do with it. Another possibility would be to see if we can hijack URL canonicalization (which has well-known rules), but I suspect that doesn't help with Windows, since Windows network servers don't expose device names as far as I know. Footnotes: [1] For GNU Emacs compatibility.