
On Mon, 2009-02-23 at 00:46 +0100, Henning Thielemann wrote:
On Fri, 20 Feb 2009, Duncan Coutts wrote:
I have complained before about the System.Directory file permissions API, and how it relates to copyFile.
Let me give an example of where the existing copyFile API is too limited. Perhaps this will help us think about what an improved API might be.
...
So for Unix the mapping is:
setUserReadable True/False chmod u+r / u-r setUserWritable True/False chmod u+w / u-w
setOtherReadable True/False chmod go+r / go-r setOtherWritable True/False chmod go+w / go-w
It's not hard to predict that 'Other' will be too coarse for some applications, although I haven't an example. However, maybe we should have a new package which provides common functions for Unix and Windows as needed by Cabal. I expect that the 3 cases of permission transfer that you described for Cabal will also occur in other applications. From this package a general API for System.Directory may evolve.
Certainly 'Other' is too coarse in general, but I fear there is not much that is more fine grained that is also portable and useful. Is there a useful abstraction that covers Windows ACLs (and legacy file attributes) and POSIX ACLs and classic Unix permission bits? There might be but I'm not hopeful. POSIX ACLs subsume the Unix permission bits but the Windows ACL model is rather different. My guess is that something around the granularity of owner/other is what we can get in a portable API and more detailed things just have to be platform-specific. We need both. Duncan