-
Notifications
You must be signed in to change notification settings - Fork 696
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
[WIP] Use the directory package to create new-install symlinks #5684
Conversation
This provides uniform code and behaviour across all platforms, including Windows.
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-7.10.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-8.0.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-7.8.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-7.6.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-8.2.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-8.4.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-8.6.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"linux-8.4.4-fdebug-expensive-assertions" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"osx-7.8.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "d8bae5190107627a41eba4b33aa0041f4475c800", "tag":"osx-8.0.2" }
Sounds like a good idea. |
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-7.10.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-7.8.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-8.0.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-8.2.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-7.6.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-8.4.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-8.4.4-fdebug-expensive-assertions" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"linux-8.6.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45", "tag":"osx-7.8.4" }
cabal-install/cabal-install.cabal
Outdated
@@ -307,7 +307,7 @@ executable cabal | |||
containers >= 0.5 && < 0.7, | |||
cryptohash-sha256 >= 0.11 && < 0.12, | |||
deepseq >= 1.3 && < 1.5, | |||
directory >= 1.2.2.0 && < 1.4, | |||
directory >= 1.3.3.0 && < 1.4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a fairly recent directory
version (it only started getting bundled w/ GHC 8.6); can we make this conditional on if os(windows)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the problem. Are you worried about the stability of recent versions of directory
?
This change uses the createFileLink
function, which was added in directory-1.3.1.0
, so the lower bound will need to be raised anyways. Is 1.3.1.0
an acceptable lower bound? One potential downside is that the behaviour of new-install
on Windows will differ depending on which version of directory
was used to compile cabal-install
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the concern is mostly support, does directory-1.3.1.0
support the same versions of GHC that cabal
supports, if not it can't be unconditionally used.
This change uses the createFileLink function, which was added in directory-1.3.1.0, so the lower bound will need to be raised anyways. Is 1.3.1.0 an acceptable lower bound? One potential downside is that the behaviour of new-install on Windows will differ depending on which version of directory was used to compile cabal-install
This is quite normal, and just means the distro needs to be built with an up-to-date compiler/cabal. Long filenames support is another thing that already depends on which version of GHC is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we have all those *.Compat.*
modules for a reason... ;-)
See
- https://github.com/haskell/cabal/tree/master/Cabal/Distribution/Compat
- https://github.com/haskell/cabal/tree/master/cabal-install/Distribution/Client/Compat
So I'd strongly suggest to try to follow the prior-art from those compat modules to avoid requiring such a bleeding edge directory
version
Travis is reporting that the bootstrap builds are failing. I tried having |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation wise no objections from me, just a question, have you tested this on older versions of Windows or windows 10 with developer mode off? Just want to make sure that the errors propagated by the directory
function are properly handled.
I assume since the old implementation threw an error as well, but just want to check that what is thrown now makes sense.
Before, any attempt to use
Running without developer mode now gives a failure message like the following:
I don't have any machines with older versions of Windows, so unfortunately I can't test there. |
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-7.8.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-8.0.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-7.10.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-7.6.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-8.2.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-8.6.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-8.4.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"linux-8.4.4-fdebug-expensive-assertions" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"osx-7.8.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "01f193a92e284a59a089e335eba8eddc42f7089c", "tag":"osx-8.0.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-7.10.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-8.0.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-7.8.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-8.2.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-7.6.3" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-8.4.4" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-8.6.2" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"linux-8.4.4-fdebug-expensive-assertions" }
"url":"pull/5684", "account":"haskell", "repo":"cabal", "commit": "cf67537c54a675be16ca21eba637fb9272a267cf", "tag":"osx-7.8.4" }
Yeah that error looks fine to me. No objections from my part. I'll leave it to @hvr about the directory bounds |
An alternative solution/fallback would be to copy and record the checksum of the installed exe somewhere, and after that overwrite only if the checksum of the existing file matches the recorded one (or the user forced an overwrite explicitly). |
I'm brand new to haskell and trying to setup my dev environment on windows. Immediately ran into the error message that |
Symlinking on windows is done in #6519, but it looks it doesn't made it into 3.2. Will be in the next major cabal-install |
Running
cabal new-install
on Windows currently gives the error"Symlinking feature not available on Windows"
. Symlinks have been supported on Windows since Vista (with administrator privileges), and symlinks can currently be created without administrator privileges on Windows 10 when in developer mode. This change letscabal new-install
create symlinks on Windows.I've been using this patch on my own Windows system for ~4 months (ever since haskell/directory#83 was fixed) with no issues.
One caveat is that
directory-1.3.3.0
or newer is required for in order to create symlinks on Windows 10 without administrator privileges.Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!