Skip to content
This repository

Git repo URLs not escaped correctly on Windows #1212

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

7 participants

will-s-owen André Arko Lars Gierth Steven Talcott Smith Muneeb Petteri Räty André Gabriel
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

André Arko
Owner
will-s-owen

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

André Arko
Owner

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.

André Arko 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.

André Arko
Owner

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.

André Arko indirect reopened this May 31, 2011
Lars Gierth
lgierth commented May 31, 2011
fatal: I don't handle protocol ''https'

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

André Arko
Owner

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?

Lars Gierth
lgierth commented May 31, 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.

André Arko
Owner

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!

Steven Talcott Smith

Too bad google did not index this yet.

Lars Gierth

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.

André Arko
Owner
Muneeb
neebz commented June 02, 2011

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

will-s-owen will-s-owen closed this June 02, 2011
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.

Petteri Räty

So was a fix for this committed?

André Arko
Owner

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.

André Arko indirect reopened this June 06, 2011
André Arko indirect closed this in 4794327 June 08, 2011
André Arko
Owner

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.

André Arko
Owner

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

André Gabriel

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'"

André Arko
Owner
André Gabriel

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!

André Gabriel

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
Something went wrong with that request. Please try again.