RFD: deprecate permissions-related stuff in System.Directory

Henning Thielemann lemming at henning-thielemann.de
Thu Aug 30 07:53:24 EDT 2007


On Thu, 30 Aug 2007, Malcolm Wallace wrote:

> > > 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.

I remind that Simon originally suggested to separate OS dependend stuff.
That is, your implementation of 'which' perfectly works on UNIX but not on
Windows. However the general 'getPermission' function suggests that it
would work on every OS equally.


More information about the Libraries mailing list