Masterminds / glide

Package Management for Golang
https://glide.sh
Other
8.15k stars 540 forks source link

glide install/update fails on Windows behind corporate proxy due to backslashes in URL #216

Open christophberger opened 8 years ago

christophberger commented 8 years ago

Hi,

I stumbled across a weird constellation that makes glide install and glide update fail:

  1. OS is Windows
  2. A corporate HTTP proxy/firewall is in place.

What happens:

What I see in cmd.exe:

C:\...> glide update
[INFO] Fetching updates for github.com\pkg\profile.
[WARN] Unable to checkout github.com\pkg\profile
[WARN] Update failed for github.com\pkg\profile: Cloning into 'C:\[...]\src\sieblog\vendor\github.com\pkg\profile'...
fatal: unable to access 'https://github.com\pkg\profile/': SSL certificate problem: self signed certificate in certificate chain
: exit status 128

And when GIT_SSL_NO_VERIFY is not set, I get this:

C:\...> glide update
[INFO] Fetching updates for github.com\pkg\profile.
[WARN] Unable to checkout github.com\pkg\profile
[WARN] Update failed for github.com\pkg\profile: Cloning into 'C:\[...]\src\sieblog\vendor\github.com\pkg\profile'...
fatal: unable to access 'https://github.com\pkg\profile/': The requested URL returned error: 502

I "resolved" this by this one-line change in utils.go:

from

vcsURL := "https://" + pkg

to

vcsURL := "https://" + strings.Replace(pkg, "\\", "/", -1)

This "Works For Me(TM)", however, I have no idea if this is sufficient and has no side effects.
What do you think?

Thanks Christoph

mattfarina commented 8 years ago

@christophberger Thanks for bringing this up. Can you please provide a little more information. What version of Glide are you using (glide --version), how did you get Glide (go get, binary download, something else), and can you share your glide.yaml file or provide some example representation.

I'd like to try and reproduce the problem to verify, understand, and test any fixes.

christophberger commented 8 years ago

@mattfarina I used the binary from glide-0.8.3-windows-amd64.zip. For my attempt to fix the issue, I cloned the master branch at tag 0.8.3-2-g66ba663.

Here is my glide.yaml:

package: sieblog
import:
- package: github.com/Sirupsen/logrus
  subpackages:
  - github.com\Sirupsen\logrus
- package: github.com/christophberger/start
  subpackages:
  - github.com\christophberger\start
- package: github.com/ogier/pflag
  subpackages:
  - github.com\ogier\pflag
- package: github.com/pkg/profile
  subpackages:
  - github.com\pkg\profile
- package: github.com/pombredanne/ahocorasick
  subpackages:
  - github.com\pombredanne\ahocorasick

And of course it is a Windows-only problem.

mattfarina commented 8 years ago

@christophberger Thanks. Did you create this by hand?

None of these sub-package entries should exist. Did you add them?

christophberger commented 8 years ago

@mattfarina This yaml file was generated from an internal package. But the problem is not within the yaml file anyway. I assume that you can replicate this with any glide.yaml as long as you do a glide install or glide update on Windows. You should then see that the generated URL's contain backslashes:

[WARN] Update failed for github.com\pkg\profile: Cloning into 'C:\[...]\src\sieblog\vendor\github.com\pkg\profile'...
fatal: unable to access 'https://github.com\pkg\profile/': The requested URL returned error: 502

I think the HTTP 502 is due to the corporate firewall/proxy/gateway I was behind when I got that error. I cannot tell what error occurs without a firewall as I have no Windows at home. But anyway, backslashes in URL's are wrong per se, so the problem is not tied to a specific yaml file nor to a corporate firewall.