[Haskell-cafe] File path programme

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu Jan 27 12:53:52 EST 2005


Robert Dockins <robdockins at fastmail.fm> writes:

> More than you would think, if you follow the conventions of modern
> unix shells. eg, "foo/.." is always equal to ".",

For the OS it's not the same if foo is a non-local symlink.

Shells tend to resolve symlinks themselves on cd, and "cd .." means
to remove the last component of the unexpanded current directory,
which may be different from the directory listed by "ls ..".

> (rather than doing a chdir on the ".." hardlink, which does strange
> things in the presence of symlinks). The operation is sufficently
> useful that I think it should be included. It lets us know, for
> example, that "/bar/../foo/tmp" and "/foo/tmp" refer to the same
> file, without resorting to any IO operations.

I disagree. The point is they are *not* the same file.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-Cafe mailing list