RFD: deprecate permissions-related stuff in System.Directory

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Aug 30 06:14:08 EDT 2007


> > I have a perfectly OK use of getPermissions: in hmake, there is a
> > routine that scans the PATH variable looking for an executable with
> > a given name.  Basically, it is a Haskell implementation of the unix
> > 'which' command.  There is no actual use of the executable, just a
> > test to report/reject the candidate pathname.
> 
> You wouldn't be losing much by using doesFileExist rather than 
> getPermissions.

But on unix, it would be totally incorrect to return a file of the right
name but with the wrong permissions.  This is what my Haskell `which`
originally did, and it bit me hard on a couple of occasions, hence the
extra check.

> On Windows it turns out to be really hard if not 
> impossible to check for execute permission - the only reliable way is
> to  actually try to execute the file.

Mounting a FAT filesystem on unix (or indeed any filesystem via Samba)
also makes all files appear to be executable.  These are just broken
platforms, and I don't think they should hold us hostage or dictate our
preferred API.

I'm not saying that the current API is perfect - it could certainly be
improved.  But I'm just pointing out that there are valid use-cases for
what we have currently.  If you have concrete suggestions for a new API,
I would certainly be interested.

Regards,
    Malcolm


More information about the Libraries mailing list