
I've fixed this in System.Directory.copyFile, although there doesn't seem to be a foolproof way to do it: if you unlink before opening, there's a chance that someone else can create the file in between. Still, this appears to be what install(3) does.
Since there seem to be compelling reasons to want both "unlink" and "overwrite" behaviors available in the standard library, I suggest keeping the current copyFile semantics and moving the new "unlink" behavior to another function. The second function could be called "installFile". Then, Cabal should be changed to use "installFile" instead of "copyFile" (probably via a compatibility library). Summary of behavior differences: - effect on hard, soft links - effect on ACLs, permissions, ownership, inode number - effect on destinations without write permission Regards, Frederik -- http://ofb.net/~frederik/