-
Notifications
You must be signed in to change notification settings - Fork 10
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
reconsider removal of System.PosixCompat.User #3
Comments
Which removed System.PosixCompat.User. See haskell-pkg-janitors/unix-compat#3 Sponsored-by: Noam Kremen on Patreon
I'm not sure reintroducing the module is the correct solution here. If I understand correctly, this seems more like a missing feature of cabal. |
@joeyh wrote:
Is it this code here? @mitchellwrosen wrote:
Note that for a new feature in cabal to become effective one has to allow several years (as one usually cannot assume the latest |
I suppose that is true. Suppose, though, that It seems to me that the suggestion to add the module at that point, just so it can then be ignored with some careful CPP, would be the "ill-considered" move here ;) Any suggestions besides adding it back? |
Interestingly, when @bringert added
So maybe the intention was from the beginning that these operations are available statically (= at compile-time) on all OSs, but dynamically (= at runtime) only on Unix. |
I don't remember exactly why I created this, but I seem to recall that the intention was as @andreasabel suggests, for some use case similar to what @joeyh describes. |
My understanding is the purpose of this package is to assist Haskell package authors write cross-platform code with as little CPP as possible. Probably most of these users are more familiar with the unix APIs, and want their code to "just work" on Windows without having to own a Windows box or VM to test on. That's also what's implied by the package description (emphasis mine):
So, if indeed this module was added to support @joeyh's use case some 16 years ago, I think it should have come with a big disclaimer: WARNING: this module is almost certainly NOT useful to you. It does NOT provide portable implementations of API you see. It exists ONLY because cabal does not currently allow you to conditionally depend on a package in a Because as of version 0.6, the last version that shipped with this module exposed, the description was:
That, to me, sounds like "we've added this module because it exists in Are there any other suggestions besides adding the module back? It really seems better to me that users depend on That cabal doesn't let you do that in a Setup.hs is unfortunate, but I'm sure there's another way to accomplish this, possibly involving a makefile or some such. Right? Or am I mistaken? I certainly could be. |
I might even suggest another package like |
|
@andreasabel good sleuthing, that is the code in question |
Note that other parts of unix-compat also contain such stubs, for example createSymbolicLink. I don't use those, but I assume there is some use case for them. I think my experience is it's a mixed bag to provide these -- I have had to take care to not use things like createSymbolicLink on Windows, even though the code would compile. A unix-incompat would pose its own challange for me, because I keep git-annex buildable on Debian stable, which includes unix-compat but of course not yet unix-incompat. And the Custom-Setup block does not seem to allow using flags or some other mechanism to select between the old unix-compat and unix-incompat. My suggestion would be to revert this change for now and split the package at a more measured pace if possible. (Although waiting for Debian stable to include something is a bit of an ask I know.) |
Rather than splitting the package, why not move the problimatic functions into new modules in unix-compat? eg System.PosixCompat.User.Unportable |
Indeed; no complete inspection and overhaul was performed in the I feel, for the same reasons as stated above, this package ought not to export
If there are use cases for them, let's please identify them and write them down! We've discovered one so far: cabal does not support conditional dependencies in
Out of curiosity, how long might a new package like |
Generally it takes a couple of years. |
I see. Well, to summarize my thoughts: I'm not personally keen on reintroducing the module here. The motivating use case as I understand it is too narrow. To reiterate, I feel:
However, I'm not the sole maintainer here. Just a janitor, and one who's particularly uninterested in whatever happens to
@joeyh, you are also a janitor with commit bits. Please don't take my protestations as gatekeeping; if you put together a new release of |
A compiling git-annex is a narrow use-case for you? I beg your pardon? |
git-annex needs the removed System.PosixCompat.User module haskell-pkg-janitors/unix-compat#3
There's a workaround for conditionals in |
@Profpatsch Thanks for your concern, could you provide a suggestion to move forward? |
git-annex needs the removed System.PosixCompat.User module haskell-pkg-janitors/unix-compat#3
git-annex needs the removed System.PosixCompat.User module haskell-pkg-janitors/unix-compat#3
Abstracting code into a separate package and depending on that package is exactly what we've been doing. unix-compat was that package. |
Yeah, just put the module back to unbreak the ecosystem. Things can be reverted. |
While I'd agree with reverting this, one thing I'd forgotten is that cabal v2 doesn't support Setup files running any post-install hooks apparently. Which means there is much less scope for setup files to do things that need unix-compat. Not that there's no scope left, but in this case the only benefit of git-annex's Setup using unix-compat was to be able to do some things when used with cabal v1-install, which was not worth continuing to support. |
…-shell and git-remote-tor-annex symlinks Anything still relying on that, eg via cabal v1-install will need to change to using make install-home. Which was added back in 2019 in 6491b62 because cabal new-build (now the default) already didn't use Setup in a way that let its installation of those things work. Notably this means Setup does not need to depend on unix-compat, which is useful because in 0.7 it removed System.PosixCompat.User, which Setup needed to determine where to install the desktop files. See haskell-pkg-janitors/unix-compat#3
I’ve submitted a patch. It’s a simple revert (but with CHANGELOG change), somebody might want to check whether that’s what we want |
System.PosixCompat.User
actally had useful purposes despite not doing anything useful on Windows. Here's how I depend on it in git-annex:I have a custom
Setup.hs
, which hooks into cabal to install additional files in the user's home directory.To get the home directory, I need to use
System.Posix.User
, so would need aSetup-Depends: unix
in the cabal file. But that would prevent building on windows! So instead ISetup-Depends: unix-compat
. Then the code that gets the user's home directory is#ifdef
ed to avoid usinggetEffectiveUserID
on Windows.Note that cabal does not allow using
if(! os(windows))
in the custom-setup block. If it did, I could simply depend onunix
conditionally. (Cabal says: invalid subsection "if")I am going to have to pin
unix-compat
at an old version, or remove functionality from my custom Setup if this change is not reverted.The text was updated successfully, but these errors were encountered: