[Haskell-cafe] Re: File path programme
Sven.Panne at aedion.de
Mon Jan 31 14:51:57 EST 2005
Peter Simons wrote:
> Sven Panne writes:
> > Hmmm, I'm not really sure what "equivalence" for file
> > paths should mean in the presence of hard/symbolic links,
> > (NFS-)mounted file systems, etc.
> Well, there is a sort-of canonic version for every path; on
> most Unix systems the function realpath(3) will find it.
OK, but even paths which realpath normalizes to different things might
be the same (hard links!). This might be OK for some uses, but not for
> My interpretation is that two paths are equivalent iff they
> point to the same target. [...]
This would mean that they are equal iff stat(2) returns the same device/inode
pair for them. But this leaves other questions open:
* Do we have something stat-like on every platform?
* What does this mean for network file systems, e.g. in the presence of
the same files/directories exported under different NFS mounts? I don't
have enough books/manual pages at hand to answer this currently...
* What does this mean if the file path doesn't refer to an existing
IMHO we can provide something like realpath in the IO monad, but shouldn't
define any equality via it.
More information about the Haskell-Cafe