[Haskell-cafe] Suggested additions to System.FilePath.Posix/Windows

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Sep 19 14:43:24 EDT 2009

On Sep 19, 2009, at 07:45 , Duncan Coutts wrote:
> On Thu, 2009-09-17 at 11:58 +0200, Marcus D. Gabriel wrote:
>>> -- | 'reduceFilePath' returns a pathname that is reduced to  
>>> canonical
>>> -- form equivalent to that of ksh(1), that is, symbolic link names  
>>> are
>>> -- treated literally when finding the directory name.  See @cd -L@  
>>> of
>>> -- ksh(1).  Specifically, extraneous separators @(\"/\")@, dot
>>> -- @(\".\")@, and double-dot @(\"..\")@ directories are removed.
> So it's like the existing System.Directory.canonicalizePath but it's
> pure and it does not do anything with symlinks. On the other hand
> because it's pure it can do something with non-local paths.
> Is there anything POSIX-specific about this? I don't see it.

It's making assumptions about the safety of eliding "..".  (What does \ 
\machine\share\..\ do?)  On the other hand that's also unsafe on POSIX  
in the presence of symlinks.  In general I consider path cleanup not  
involving validation against the filesystem to be risky.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090919/26123e19/PGP.bin

More information about the Haskell-Cafe mailing list