Skip to content
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

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@YellPika
Copy link

YellPika commented Nov 13, 2018

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 lets cabal 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:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

Use the directory package to create new-install symlinks
This provides uniform code and behaviour across all platforms, including Windows.

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-7.10.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-8.0.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-7.8.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-7.6.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-8.2.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-8.4.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-8.6.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"osx-7.8.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "d8bae5190107627a41eba4b33aa0041f4475c800",
"tag":"osx-8.0.2"
}
@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Nov 13, 2018

Sounds like a good idea.

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-7.10.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-7.8.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-8.0.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-8.2.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-7.6.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-8.4.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"linux-8.6.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 13, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "2a7e3b77f66b3e4cd9a5fe1504169ad907664f45",
"tag":"osx-7.8.4"
}
@@ -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,

This comment has been minimized.

Copy link
@hvr

hvr Nov 13, 2018

Member

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)?

This comment has been minimized.

Copy link
@YellPika

YellPika Nov 14, 2018

Author

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.

This comment has been minimized.

Copy link
@Mistuke

Mistuke Nov 14, 2018

Collaborator

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.

This comment has been minimized.

Copy link
@hvr

hvr Nov 17, 2018

Member

Well, we have all those *.Compat.* modules for a reason... ;-)

See

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

@YellPika YellPika force-pushed the YellPika:master branch from 2a7e3b7 to d8bae51 Nov 13, 2018

@YellPika

This comment has been minimized.

Copy link
Author

YellPika commented Nov 14, 2018

Travis is reporting that the bootstrap builds are failing. I tried having bootstrap.sh download the appropriate directory version, but this caused dependency conflicts. Any advice on how to resolve this issue?

@Mistuke
Copy link
Collaborator

Mistuke left a comment

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.

@YellPika

This comment has been minimized.

Copy link
Author

YellPika commented Nov 14, 2018

Before, any attempt to use new-install would report:

Symlinking feature not available on Windows

Running without developer mode now gives a failure message like the following:

C:\Users\Anthony\AppData\Roaming\local\bin\ghcid.exe: createFileLink:CreateSymbolicLink:
permission denied (A required privilege is not held by the client. Creating symbolic links
usually requires administrative rights.)

I don't have any machines with older versions of Windows, so unfortunately I can't test there.

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-7.8.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-8.0.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-7.10.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-7.6.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-8.2.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-8.6.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-8.4.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"osx-7.8.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "01f193a92e284a59a089e335eba8eddc42f7089c",
"tag":"osx-8.0.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-7.10.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-8.0.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-7.8.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-8.2.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-7.6.3"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-8.4.4"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-8.6.2"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}

haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Nov 14, 2018

{"origin":"haskell/cabal/pull/5684",
"url":"pull/5684",
"account":"haskell",
"repo":"cabal",
"commit": "cf67537c54a675be16ca21eba637fb9272a267cf",
"tag":"osx-7.8.4"
}
@Mistuke

This comment has been minimized.

Copy link
Collaborator

Mistuke commented Nov 14, 2018

Yeah that error looks fine to me. No objections from my part. I'll leave it to @hvr about the directory bounds

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Nov 14, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.