Re: (expand-file-name "/..")

Marcus Harnisch <[email protected]>
Newsgroups gmane.emacs.xemacs.beta
Message-ID <[email protected]>
Marcus Harnisch <[email protected]> writes:

> "Stephen J. Turnbull" <[email protected]> writes:
>
>> If you want to pursue this, I think you need to ask on emacs-devel.
>
> Not worth bothering. A docstring fix would be sufficient.

Not that I changed my mind about this (actually doing some
experimenting to find a suitable doc string amendment), but just for
the record:

  (expand-file-name "/../foo/")
  => "/../foo/"

  (expand-file-name "/../../foo/")
  => "/foo/"

  (expand-file-name "/../../../foo/")
  => "/../foo/"

  (expand-file-name "/../../../../foo/")
  => "/foo/"


  (expand-file-name "/foo/../")
  => "/"

  (expand-file-name "/foo/../../")
  => "/../"

  (expand-file-name "/foo/../../../")
  => "/"

  (expand-file-name "/foo/../../../../")
  => "/../"


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.

Kindly
Marcus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.