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

bug in api_credentials_error_message #6134

Closed
5 tasks done
masukomi opened this issue May 15, 2019 · 0 comments · Fixed by #6135
Closed
5 tasks done

bug in api_credentials_error_message #6134

masukomi opened this issue May 15, 2019 · 0 comments · Fixed by #6135
Labels
outdated PR was locked due to age

Comments

@masukomi
Copy link

I'm reporting a logic bug in the code which is provable via the error message reported below. The report includes pointers to the faulty method. These checkbox things aren't applicable.

  • are reporting a bug others will be able to reproduce and not asking a question.
    yes
  • ran a brew command and reproduced the problem with multiple formulae?
    not but it's not applicable
  • ran brew update and can still reproduce the problem?
    is up to date
  • ran brew doctor, fixed all issues and can still reproduce the problem?
    no, but it's not applicable because it doesn't address github credentials
  • ran brew config and brew doctor and included their output with your issue?
    ran them but brew doctor has nothing applicable and brew config doesn't mention keychain or GitHub credentials

What you were trying to do (and why)

brew tap slhck/moreutils which worked just fine and ended with Tapped 1 formula (43 files, 12.6KB). As far as I can tell the tap has nothing to do with the problem. The problem comes when tapping something you either haven't tapped before or have untapped since the last tap.

What happened (include command output)

it complained about needing scopes but it didn't actually need scopes

Scopes they need: none
Scopes they have:

this comes from api_credentials_error_message

The method fails to handle the situation where needed_scopes is empty. Logically if needed_scopes is empty and you're unauthorized then it shouldn't be complaining about needing scopes because you were unauthorized for some non-scope reason.

I believe this method:

  • needs to check needed_scopes earlier
  • needs to change if unauthorized && scopes.empty? to if ! needed_scopes.empty? && unauthorized && scopes.empty? (or something like that)
  • needs to correct the error messages to handle whatever the true error is.
Command output

brew tap slhck/moreutils
==> Tapping slhck/moreutils
Cloning into '/usr/local/Homebrew/Library/Taps/slhck/homebrew-moreutils'...
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
✓ (post-checkout) ctags
Tapped 1 formula (43 files, 12.6KB).
Error: Your macOS keychain GitHub credentials do not have sufficient scope!
Scopes they need: none
Scopes they have:
Create a personal access token:
https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew
echo 'set -gx HOMEBREW_GITHUB_API_TOKEN your_token_here' >> ~/.config/fish/config.fish

What you expected to happen

not complaining about needing non-existent scopes

Step-by-step reproduction instructions

  • convince homebrew to try and use your keychain instead of environment for credentials
  • don't have anything in there for it. (i think) Hard to tell what exactly it's looking for.
    brew tap <something you haven't tapped before>
@lock lock bot added the outdated PR was locked due to age label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant