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

curl error when attempting to fetch issues from github for custom tap #2733

Closed
4 tasks done
jasonkarns opened this issue Jun 5, 2017 · 9 comments
Closed
4 tasks done

Comments

@jasonkarns
Copy link
Contributor

jasonkarns commented Jun 5, 2017

Please always follow these steps:

  • Confirmed this is a problem with running a brew command and just brew installing one or more formulae? If it's a formulae-specific problem please file this issue at https://github.com/Homebrew/homebrew-core/issues/new

  • Ran brew update and retried your prior step?

  • Ran brew doctor, fixed all issues and retried your prior step?

  • Ran brew config and brew doctor and included their output with your issue?

    brew-config output

    $ brew doctor
    Your system is ready to brew.
    

Please note we may immediately close your issue without comment if you delete or do not fill out the issue checklist and provide ALL the requested information.

To help us debug your issue please explain:

  • What you were trying to do (and why)

    Attempting to install a formula from a custom tap. Important detail: the custom tap is hosted on our internal GitHub Enterprise instance.

  • What happened (include command output)

    Received 2 bits of error output. The first was some error output from the failed formula itself (which was expected). The second was error output from a failed curl command while brew was attempting to fetch related issues from the tap. Full command output

    relevant snippet:

    If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
    rockstack/rock
    
    /usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': curl failed!  
    (GitHub::Error)
    curl: (22) The requested URL returned error: 422 Unprocessable Entity
    curl: (3) <url> malformed
    	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
    	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:233:in `issues_matching'
    	from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:272:in `issues_for_formula'
    	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:368:in `fetch_issues'
    	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:364:in `issues'
    	from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:418:in `dump'
    	from /usr/local/Homebrew/Library/Homebrew/brew.rb:138:in `rescue in <main>'
    	from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `<main>'
    
  • What you expected to happen

    Expected just the error output from the formula. (ie, the error output from make) Brew should not be attempting to fetch issues from api.github.com for taps which are not on public github.

  • Step-by-step reproduction instructions (by running brew commands)

    1. brew-tap a repo that is not on github.com
    2. attempt to install a formula that is is known to fail/error

    I would imagine this is where the additional guard should take place:

    if issues && !issues.empty?

    It should be checking if the tap has a custom_remote? and/or if the tap is a private_repo? (which is currently not exposed on a Tap but probably should be?)

@MikeMcQuaid
Copy link
Member

This would be where the change should be made:

def issues_for_formula(name, options = {})
tap = options[:tap] || CoreTap.instance
issues_matching(name, state: "open", repo: "#{tap.user}/homebrew-#{tap.repo}")
end

Closing as we don't support GitHub Enterprise but we'll accept a fix for this case.

@jasonkarns
Copy link
Contributor Author

jasonkarns commented Jun 5, 2017

Don't need to support issues for GHE. (I can see that being a huge pain in not knowing which version of the API any particular GHE instance was using.) But brew already supports taps for any given remote (as evidenced by the custom_remote? method, so brew shouldn't be throwing its own errors when one such tap is in use, no?

@MikeMcQuaid
Copy link
Member

as evidenced by the custom_remote? method

I don't think this method necessarily implies "not on GitHub".

so brew shouldn't be throwing its own errors when one such tap is in use, no?

Yes. If this problem is reported more widely I'll look at fixing it but otherwise I'll leave it to those affected to work on the fairly straightforward fix.

@jasonkarns
Copy link
Contributor Author

I don't think this method necessarily implies "not on GitHub".

Fair. (A github-hosted tap that doesn't follow the homebrew-{repo} convention would be considered a custom_remote? while still being on GitHub.)

However, this documentation clearly indicates that non-github taps are supported.

If it’s hosted outside of GitHub, they have to use brew tap user/repo , where user and repo will be used to refer to your tap and is your Git clone URL.

But again, I think it's totally fair to define "support" of a non-github tap as: "will not perform the niceties like fetching open issues on formula failure". But I strongly think that brew shouldn't be throwing exceptions when it encounters non-github taps. Especially when documentation indicates they are a supported (though second-class) use case.

I'll work on a PR to fix!

@MikeMcQuaid
Copy link
Member

However, this documentation clearly indicates that non-github taps are supported.

Without being too much of a dick about it: that's a bad assumption. Things maintainers say are supported are supported.

But I strongly think that brew shouldn't be throwing exceptions when it encounters non-github taps.
I'll work on a PR to fix!

That's great, thanks.

@jasonkarns
Copy link
Contributor Author

I'm not trying to be contentious here, but the claim that non-github taps aren't supported is in direct contradiction to all the documentation in the repo and in brew's own manpages. Obviously, if you say they're unsupported, then they're unsupported. But all the documentation below indicates (unequivocally) that they are supported. Was support dropped recently and the docs need updated to reflect the change?

docs/How-to-Create-and-Maintain-a-Tap.md

If it’s hosted outside of GitHub, they have to use brew tap user/repo , where user and repo will be used to refer to your tap and is your Git clone URL.

docs/brew-tap.md

Unlike the one-argument version, URL is not assumed to be GitHub, and it doesn't have to be HTTP. Any location and any protocol that Git can handle is fine.

brew-tap manpage (literally says "can be cloned from places other than GitHub")

With URL specified, taps a formula repository from anywhere, using
any transport protocol that git handles. The one-argument form of tap
simplifies but also limits. This two-argument command makes no
assumptions, so taps can be cloned from places other than GitHub and
using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC.

@MikeMcQuaid
Copy link
Member

Was support dropped recently and the docs need updated to reflect the change?

I think we're just disagreeing over what the word "supported" means. To me, it means "things that we will prioritise fixing if it's broken" (and "we" mostly means "@MikeMcQuaid" on Homebrew/brew). To others it means, "all documented Homebrew functionality". I don't agree with this; we document things that people want and try to do even but they are not the "happy path" that we recommend. For example, installing Homebrew into a non-/usr/local location is functional but not supported; we may fix issues you have with it or we may not.

@jasonkarns
Copy link
Contributor Author

Okay, I can understand that. And the spectrum of "support" makes sense. Even with this bug, I would never expect non-github taps to fetch open issues, as github.com taps do.

Thanks!

@cinnamennen
Copy link

Thought I'd add that brew bump-formula-pr is also broken for taps on GitHub Enterprise in what appears to be the same way. Once the next version of brew gets released I'll see if it gets resolved.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants