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

RFC: Added documentation and tests for Pkg.setprotocol #13879

Merged
merged 1 commit into from
Nov 19, 2015
Merged

RFC: Added documentation and tests for Pkg.setprotocol #13879

merged 1 commit into from
Nov 19, 2015

Conversation

LachlanGunn
Copy link
Contributor

As a followup to #11312, I have added documentation and a test for Pkg.setprotocol!()

The test is performed by setting the protocol to "notarealprotocol" before testing Pkg.add(), and trapping the error. This seems the most straightforward way to see what is actually being passed to Git.

The protocol is then manually reset to "https" in order to continue testing Pkg,add().

@kshyatt kshyatt added docs This change adds or pertains to documentation packages Package management and loading labels Nov 4, 2015
@LachlanGunn
Copy link
Contributor Author

If anyone has any comments, I would be greatly appreciative. If I've not committed any major stupidities then I'm happy for it to be merged as-is.

@@ -11559,6 +11559,13 @@ Checkout the `Pkg.dir(pkg)` repo to the branch `branch`. Defaults to checking ou
Pkg.checkout(pkg)

doc"""
setprotocol!(proto)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to put this docstring at the function definition rather than helpdb (we're trying to empty out this file).

@LachlanGunn
Copy link
Contributor Author

Fixed as requested. Any other requests?

@tkelman
Copy link
Contributor

tkelman commented Nov 5, 2015

lgtm, though using git config is potentially confusing since pkg no longer requires having command line git installed

@LachlanGunn
Copy link
Contributor Author

Ok, I'll have a look then to see if the same thing can be done with libgit2.

@hayd
Copy link
Member

hayd commented Nov 5, 2015

cc @wildart

@wildart
Copy link
Member

wildart commented Nov 5, 2015

I agree with @tkelman, reference to git command can be confusing. BTW, why is global constant used instead of ENV variable?

@tkelman
Copy link
Contributor

tkelman commented Nov 5, 2015

this doesn't influence anything other than julia's use of libgit2 and it isn't needed immediately at startup so i think an env var would be less useful here

@LachlanGunn
Copy link
Contributor Author

Hmm, so if command line Git won't be relevant, then perhaps the solution might be to remove insteadOf from the documentation for the moment, and then add that functionality to setprotocol!?

@tkelman
Copy link
Contributor

tkelman commented Nov 6, 2015

depends whether libgit2 respects global git config settings

@LachlanGunn
Copy link
Contributor Author

Does it matter if the user has no way to set them? We could just add a configuration option to make protocol changes happen on all domains, then there's no risk of confusion.

@StefanKarpinski
Copy link
Member

The real problem is that we can't just unilaterally force all git URLs to change protocol – because in general not all git repos support that. GitHub repos all do, but we don't (and shouldn't) require hosting packages on GitHub.

@johnmyleswhite
Copy link
Member

And can't since we already have registered packages that aren't hosted on GitHub.

@LachlanGunn
Copy link
Contributor Author

Sure, but as an option, not by default. We'd just add a second argument to setprotocol! that tells it whether to apply it globally or just to a list of domains, defaulting to ["github.com"].

Edit: Probably a second function might be better.

@StefanKarpinski
Copy link
Member

It feels kind of weird that we'd be reproducing the functionality of Git here in a slightly different and probably weaker form.

@LachlanGunn
Copy link
Contributor Author

True, but we have to do so anyway for the GitHub-specific bit that has already been merged, and it seems silly to do the same thing in two places. Plus we don't want to tread over the global config if we can avoid it since people may be perfectly happy to use git:// on internal-network repositories.

@tkelman
Copy link
Contributor

tkelman commented Nov 6, 2015

Reproducing a fair amount of functionality that exists in command line git but not at a high level in libgit2 is inevitable if we want to finish moving away from Pkg depending on command line git.

@wildart
Copy link
Member

wildart commented Nov 6, 2015

I guess we should allow ssh protocol on systems where libgit2 can be build with libssh but use https protocol as a default. Rewrite protocol only if it isn't supported on target system and notify user about it.

@LachlanGunn
Copy link
Contributor Author

What about git:// urls? Can we rewrite them by default?

@wildart
Copy link
Member

wildart commented Nov 6, 2015

Only if necessary, and only for packages installed with add. clone shouldn't no be affected by rewrite.

@LachlanGunn
Copy link
Contributor Author

Clone no, that was removed during review before. So do we do a test of git:// accessibility on first run? The user is going to run into problems if they move between networks then.

@wildart
Copy link
Member

wildart commented Nov 6, 2015

It is not that git protocol that we need to test, but rather ssh availability. And try to rewrite protocol if ssh connection fails or not supported.

@LachlanGunn
Copy link
Contributor Author

Ah, ok. I'm not sure automatic fallback is a safe idea, though, since you risk being man-in-the-middled by someone who blocks the SSH connection. They need to be able to defeat HTTPS, but lots of companies already do that. Maybe I'm being overly paranoid though, I should probably stop talking and start coding.

@tkelman
Copy link
Contributor

tkelman commented Nov 14, 2015

git protocol is not secure so i think we should move away from it.

can this be merged?

@wildart
Copy link
Member

wildart commented Nov 14, 2015

👍

@LachlanGunn
Copy link
Contributor Author

Ok, should I pull the git-config stuff first though?

@tkelman
Copy link
Contributor

tkelman commented Nov 14, 2015

Did we determine whether libgit2 uses global git config?

@LachlanGunn
Copy link
Contributor Author

It can, I'm not sure whether it does by default, but if not it would be an easy fix I expect.

    https://libgit2.github.com/libgit2/#HEAD/group/config/git_config_find_global

@LachlanGunn
Copy link
Contributor Author

Actually, since git is yet to be removed I'm going to go ahead and change this to RFC, probably best to leave the documentation consistent anyway.

@LachlanGunn LachlanGunn changed the title WIP: Added documentation and tests for Pkg.setprotocol RFC: Added documentation and tests for Pkg.setprotocol Nov 14, 2015
@tkelman
Copy link
Contributor

tkelman commented Nov 14, 2015

Right but we already aren't using it, so it's worth determining whether the command we say to run actually does anything.

@LachlanGunn
Copy link
Contributor Author

Ah, got you. I just tried and yes, it does still work on my ten-day-old copy of Julia.

tkelman added a commit that referenced this pull request Nov 19, 2015
RFC: Added documentation and tests for Pkg.setprotocol
@tkelman tkelman merged commit 6adbbed into JuliaLang:master Nov 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation packages Package management and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants