-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
brew.rb: tell more people to not report issues. #17003
Conversation
c77658b
to
737b120
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
You have disabled automatic updates.
to the error message clarifies why the error occurred.
It would be kind to include how to reenable them, too, since that's the preferred path.
2b8cd60
to
9692ce6
Compare
I've revamped this a bit to DRY up the repeated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to tell from the diff but I think it's ok
- We should tell people to not report issues if they are running in an unsupported configuration. - We should tell people to run `brew update` before reporting issues if they have `HOMEBREW_NO_AUTO_UPDATE` set. - We should tell people to not report issues in more types of exceptions. - Warn people in `HOMEBREW_NO_AUTO_UPDATE` documentation. - DRY up `brew.rb` exception handling. Co-authored-by: Colin Dean <[email protected]>
9692ce6
to
21d99c5
Compare
Thanks all! |
if OS.unsupported_configuration? | ||
$stderr.puts "#{Tty.bold}Do not report this issue: you are running in an unsupported configuration.#{Tty.reset}" | ||
elsif Homebrew::EnvConfig.no_auto_update? | ||
$stderr.puts "#{Tty.bold}You have disabled automatic updates.#{Tty.reset}" | ||
$stderr.puts "#{Tty.bold}Do not report this issue until you've run `brew update` and tried again.#{Tty.reset}" | ||
elsif (issues_url = (method_deprecated_error && e.issues_url) || Utils::Backtrace.tap_error_url(e)) | ||
$stderr.puts "If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):" | ||
$stderr.puts " #{Formatter.url(issues_url)}" | ||
elsif internal_cmd | ||
$stderr.puts "#{Tty.bold}Please report this issue:#{Tty.reset}" | ||
$stderr.puts " #{Formatter.url(OS::ISSUES_URL)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a pre-existing issue, but: not sure these categories should be treated as mutually exclusive (which is kinda what happens as a consequence of the if-elsif-else structure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carlocab which ones do you think should not be exclusive? The first two are broadly "don't report this", the latter two are "here's where to report it" (in different places).
I could see it being worth actually checking when the last brew update
was done and, if e.g. today, then we don't print the auto-update message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could see it being worth actually checking when the last
brew update
was done and, if e.g. today, then we don't print the auto-update message?
Yea, I was thinking something along those lines. Because a user who still has HOMEBREW_NO_AUTO_UPDATE
set but has run brew update
in, say, the last 5 minutes would never see the last two messages even when they are relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened PR for this in #17018
elsif internal_cmd | ||
$stderr.puts "#{Tty.bold}Please report this issue:#{Tty.reset}" | ||
$stderr.puts " #{Formatter.url(OS::ISSUES_URL)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like refactor is causing this message to be output more often? Like on a non-existent formula, e.g.
❯ brew uninstall test
Error: No available formula with the name "test". Did you mean testssl?
Please report this issue:
https://docs.brew.sh/Troubleshooting
❯ git checkout 4.2.16
Note: switching to '4.2.16'.
...
❯ brew uninstall test
Error: No available formula with the name "test". Did you mean testssl?
In my opinion, it seems a little odd to tell users to report this given I consider this a user issue (mistyping formula name or using wrong name).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cho-m I agree this is a regression and we should not tell users to report this. However, it's late here and I cannot obviously figure out what specific change causes this. If you can: I'd love a PR or even just a comment ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regression is probably from no longer just exiting on RuntimeError
. We do classify a bunch of exceptions as RuntimeError
(in this case, FormulaUnavailableError < FormulaOrCaskUnavailableError < RuntimeError
).
If there are RuntimeError
s that should output message, then need to rescue
or is_a?
detect specific Errors to restore previous behavior and exit before reporting message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cho-m Thanks, will take a look.
brew update
before reporting issues if they haveHOMEBREW_NO_AUTO_UPDATE
set.HOMEBREW_NO_AUTO_UPDATE
documentation.brew.rb
exception handling.