-
Notifications
You must be signed in to change notification settings - Fork 849
Description
Hi there,
I've recently taken over maintainership of unix-compat, and I intend to push out a unix-2.8-compatible release as soon as I can. One remaining issue is what to make of the System.PosixCompat.User module, as the UserEntry type has changed.
Here is the first PR that attempts to graft over the differences: https://github.com/jacobstanley/unix-compat/pull/60/files
And here is my preferred solution, to delete the System.PosixCompat.User module entirely, based on the observation that System.PosixCompat.User doesn't seem useful at all, as all functions either return dummy data or throw exceptions: jacobstanley/unix-compat#62
However, I see that stack and yi-core actually use this module. For example:
Lines 888 to 899 in 835318b
| -- | Check whether the current user (determined with 'getEffectiveUserId') is | |
| -- the owner for the given path. | |
| -- | |
| -- Will always pure 'True' on Windows. | |
| isOwnedByUser :: MonadIO m => Path Abs t -> m Bool | |
| isOwnedByUser path = liftIO $ | |
| if osIsWindows | |
| then pure True | |
| else do | |
| fileStatus <- getFileStatus (toFilePath path) | |
| user <- getEffectiveUserID | |
| pure (user == fileOwner fileStatus) |
This code looks dubious to me: it claims to always return True on Windows, yet I believe it instead always throws an exception on Windows, which may be getting swallowed somewhere else.
But there are other uses, too, in Stack/Docker.hs. So, could you please consider the effect of deleting System.PosixCompat.User on the stack codebase, and let me know if that is a reasonable option, or if you'd rather see a different approach to unix-2.8 support?
Thanks.