Git repo URLs not escaped correctly on Windows #1212

Closed
will-s-owen opened this Issue May 31, 2011 · 24 comments

Projects

None yet

7 participants

@will-s-owen

tl;dr: double-quote everything on Windows, after replacing double-quotes with two double-quotes

bundle install fails with:
fatal: I don't handle protocol ''https'
Git error: command git clone 'https://github.com/bborn/authlogic.git' "c:/Ruby192/lib/ruby/gems/1.9.1/cache/bundler/git/authlogic-d886115472ee6d482cf48f3e903527ef78df0048" --bare --no-hardlinks in directory c:/Ruby192/apps/communityengine has failed.

This will run fine on the cmd line.

This happens on any and all references to a git repo in gemfiles.

more details here:
https://gist.github.com/1001422

@indirect
Member

The git that Bundler is invoking doesn't have support for https URLs. Your PATH must be set up to prioritize a different git binary that does have support.

On May 31, 2011, at 3:36 PM, will-s-owen reply@reply.github.com wrote:

bundle install fails with:
fatal: I don't handle protocol ''https'
Git error: command git clone 'https://github.com/bborn/authlogic.git' "c:/Ruby192/lib/ruby/gems/1.9.1/cache/bundler/git/authlogic-d886115472ee6d482cf48f3e903527ef78df0048" --bare --no-hardlinks in directory c:/Ruby192/apps/communityengine has failed.

This will run fine on the cmd line.

This happens on any and all references to a git repo in gemfiles.

more details here:
https://gist.github.com/1001422

Reply to this email directly or view it on GitHub:
#1212

@will-s-owen

That would be nice and simple, but I only have one git binary installed.

@indirect
Member

As you've probably noticed, the error that you're seeing is actually just Bundler re-raising the error that it got when it shelled out to git with system('git clone ...'). That means, for whatever reason, your git binary is throwing that error. It's not something I can fix by changing Bundler. You might be able to figure out what's going on by patching Bundler to print the path when it shells out to git, or print git --version or something like that.

@indirect indirect closed this May 31, 2011
@will-s-owen

yeah, I did that. It is unilluminating. I reverted to 1.0.13 of bundler and it works just fine.

@indirect
Member
indirect commented Jun 1, 2011

Well, that's at least helpful for narrowing it down... as far as I know, the only change to git between 1.0.13 and 1.0.14 was to escape git URLs more completely, in commit 4fc8385. Does that change break things for you? If it does, is there a different "correct" way to escape single quotes on Windows? Thanks.

@indirect indirect reopened this Jun 1, 2011
@lgierth
lgierth commented Jun 1, 2011
fatal: I don't handle protocol ''https'

That actually looks as if git was treating the single-quote as part of the protocol.

@indirect
Member
indirect commented Jun 1, 2011

Yep, that appears to be the issue. Looks like we need to implement separate shell-escaping logic on Windows, but I don't know the secret incantations that allow you to quote strings on Windows... can either of you comment on that?

@lgierth
lgierth commented Jun 1, 2011

In think you use double quotes, and escape them by doubling them (yo dawg :>). At least with Win NT 4.0, but I guess it didn't change.

@indirect
Member
indirect commented Jun 1, 2011

Ow, my brain. Alright, then, we'll just have to adjust the escaping method to check for Windows and use double (double (double)) quotes instead. Thanks for reporting!

@indirect indirect was assigned Jun 1, 2011
@stalcottsmith

Too bad google did not index this yet.

@lgierth
lgierth commented Jun 1, 2011

Mmh, looks like escaping changed after NT4: http://stackoverflow.com/questions/2403647/how-to-escape-parameter-in-windows-command-line

So in Win7 you basically escape like in Bash, but always with double quotes. I guess someone with a Windows machine needs to do a bit of testing on this.

@indirect
Member
indirect commented Jun 1, 2011

Yes, please. Confirmation from a Windows user would be great.

On Jun 1, 2011, at 6:43 AM, lgierth reply@reply.github.com wrote:

Mmh, looks like escaping changed after NT4: http://stackoverflow.com/questions/2403647/how-to-escape-parameter-in-windows-command-line

So in Win7 you basically escape like in Bash, but always with double quotes. I guess someone with a Windows machine needs to do a bit of testing on this.

Reply to this email directly or view it on GitHub:
#1212 (comment)

@neebz
neebz commented Jun 2, 2011

still not working for me on Windows 7 using Bundler version 1.0.14. The previous version works fine.

@will-s-owen

@neebz: I haven't had a chance to try a fix, but if you would like to take a try is it uri_escaped in source.rb.

@will-s-owen will-s-owen closed this Jun 2, 2011
@betelgeuse

So was a fix for this committed?

@indirect
Member
indirect commented Jun 6, 2011

Nope, no fix yet. A patch for the uri_escaped method in lib/bundler/source.rb would be the place to fix it, and you will probably just need to add something like if Bundler::WINDOWS and do Windows escaping instead.

@indirect indirect reopened this Jun 6, 2011
@indirect indirect added a commit that closed this issue Jun 9, 2011
@indirect indirect escape git URIs correctly on Windows
closes #1212
4794327
@indirect indirect closed this in 4794327 Jun 9, 2011
@indirect
Member
indirect commented Jun 9, 2011

The fix in 4794327 seems to work for me. Could someone else please test it and let me know if it works for them, too? Thanks.

@will-s-owen

It seems to work for me too.

@indirect
Member
indirect commented Jun 9, 2011

Great! I'll be releasing a new version of Bundler with this fix (among others) later today. Thanks for testing!

@andregabriel

I have the same dont handle https error. How do I install the previous bundle version 1.0.13?

Thank you.

Regards, Andre.

@will-s-owen

The fix mentioned above seems to work fine. Otherwise just 'gem unsintall bundler' and "gem install bundler -v '1.0.13'"

@indirect
Member

This error is fixed in the newest bundler, 1.0.15. Please see gem help for information on installing gems.

On Jun 19, 2011, at 7:36 AM, andregabriel reply@reply.github.com wrote:

I have the same dont handle https error. How do I install the previous bundle version 1.0.13?

Thank you.

Regards, Andre.

Reply to this email directly or view it on GitHub:
#1212 (comment)

@andregabriel

Hello, I did installed the latested version everything appeared to went smoothly (no error messages), but after bundle install when I ran rake db:migrate is said: "Could not find kgio-2.1.1 in any of the sources. Try running 'bundlle install'". How can I solve this? Thank you!

@andregabriel

Sorry, there actually was an error within the bundle install. Tks, André.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment