New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Posix.Files.fileAccess fails inside OS X sandbox #18

merged 3 commits into from Nov 7, 2014


None yet
2 participants

neverpanic commented Sep 21, 2014


similar to what has been reported in, the same code fails when run inside OS X' sandboxing mechanism because access(2) sets errno to EPERM rather than EACCES when access is denied due to sandboxing rules rather than file modes.

As with the ticket referenced above, this breaks Cabal on OS X when used inside a sandbox (which is the case for every MacPorts port):

Configuring stm-2.4.2...
Flags chosen: base4=True
Dependency array -any: using array-
Dependency base ==4.*: using base-
Setup: /usr/bin/ar: permission denied

The top commit adds ePERM as another errno value to be handled gracefully. Since the same code exists in the ByteString variant of the interface, I've also changed it there (and ported the change from #8741, which was also missing). I took the liberty of removing the remaining tabs in this file, because there still were some in the block I changed.

I'm not sure whether this is the right place to open this ticket ( says it is, #8741 in GHC Trac suggests it isn't), so please let me know if I should take this patch elsewhere.

neverpanic added some commits Sep 21, 2014

Unify accepted errno flags for access
The ByteString variant of the access function didn't accept the same
flags as the non-ByteString one, but it makes sense that the OS doesn't
care about which one is being used and returns all error codes for both
Accept EPERM as valid error code for access(2)
This is useful on OS X when its sandboxing mechanism is used, because
that will set errno = EPERM when a file can't be written due to
sandboxing (as opposed to setting it to EACCES when file permissions
deny writing).

This comment has been minimized.


hvr commented Sep 21, 2014

patch is fine here :-)


This comment has been minimized.


neverpanic commented Nov 6, 2014

Shameless bump :)

hvr added a commit that referenced this pull request Nov 7, 2014

Merge pull request #18 from neverpanic/master
`System.Posix.Files.fileAccess` fails inside OS X sandbox

@hvr hvr merged commit f5a08a9 into haskell:master Nov 7, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed

This comment has been minimized.


hvr commented Nov 7, 2014


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment