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
Unswallow uninstall error #2707
Conversation
/cc @eregon |
If we want to get this in quickly without changing any behavior, I can also scope the swallowing to the |
We should fix the culprit of the error though, I'll try to figure out why this is succeeding under some version manager and failing on others. |
Ok. So the explanation is that by default On a bare ruby installation, |
@deivid-rodriguez It's not urgent, I have a workaround, let's find a proper fix. |
I think in all cases we'd want error messages to at least be printed to let the user know, so this fix looks good to me. |
That's surprising. Maybe |
Yeah, apparently this is optional rubygems/lib/rubygems/commands/uninstall_command.rb Lines 55 to 60 in 0fa3165
And defaults to true
I'm not really sure how |
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 seems reasonable. We shouldn't ignore exception warnings.
Let's do this then! @bundlerbot r=hsbt |
2707: Unswallow uninstall error r=hsbt a=deivid-rodriguez # Description: Sometimes `gem uninstall <gem_name>` fails to uninstall the gem, but does not give any errors. See #2701. This error swallowing seems intentionally introduced specifically for the `--all` option in 564ffe2, but I don't think this is good. In that case, `--all` is leaving gems around so the user should be informed too? Maybe `gem uninstall` should try all paths in `GEM_PATH` instead? Not sure, but the current behavior is no good. # Tasks: - [x] Describe the problem / feature - [x] Write tests - [x] Write code to solve the problem - [ ] Get code review from coworkers / friends I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md). Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Build succeeded |
Thanks for the fix! |
2707: Unswallow uninstall error r=hsbt a=deivid-rodriguez # Description: Sometimes `gem uninstall <gem_name>` fails to uninstall the gem, but does not give any errors. See #2701. This error swallowing seems intentionally introduced specifically for the `--all` option in 564ffe2, but I don't think this is good. In that case, `--all` is leaving gems around so the user should be informed too? Maybe `gem uninstall` should try all paths in `GEM_PATH` instead? Not sure, but the current behavior is no good. # Tasks: - [x] Describe the problem / feature - [x] Write tests - [x] Write code to solve the problem - [ ] Get code review from coworkers / friends I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md). Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Hey, we're currently facing CI issues in rails/webpacker#2243. I know this is because we cannot (yet) support bundler 2.0 in that repo in all cases and thus is not directly a bug, but it's still backwards incompatible behavior, in case the CLI is considered public API. I guess we're hitting this new behavior here and can just |
Yeah, @aried3r, I'm sorry we broke your CI... There's always a fine line between backwards incompatibility and bug fixes, because every change in the code, even bug fixes, change the behaviour of programs. In this case, we've chosen to consider this a bug fix, and thus ship it in a patch release. If you want your CI to be locked, and only upgrade whenever you want to / need to, you can lock the rubygems version in your CI with Hope it helps! |
No worries, just wanted to make sure we actually know why it happened. Thanks for your quick reply and your and everybody else's work on rubygems! |
2893: Improve `gem uninstall --all` r=bronzdoc a=deivid-rodriguez # Description: After we started unswallowing errors of `gem uninstall` in #2707, some people got failing CI runs because they were doing things like `gem uninstall <default_gem> --all --force`. Previously that would work just fine, because the error while trying to uninstall a default gem was being swallowed. In my opinion, if you try to do `gem uninstall bundler:1.17.2` (on a ruby where this is the default bundler version), then it is fine to fail hard, but if you do `gem uninstall bundler --all`, then the command should uninstall all bundler versions that can be uninstalled (and skip the default version), but not fail just because bundler is a default gem. It can be argued though that the command should indeed fail hard, because it didn't really succeeded on trying to do what the user asked for: the user tried to uninstall _all_versions, but that wasn't achieved because the default version was left around. In order to find a compromise between these two visions, and maximize usability, I propose to not fail hard, but log a line for each default version that couldn't be removed. Note that the current behavior is completely inconsistent (in my opinion), because it fails if the default copy is the single copy in the system, but succeeds if it's not: ``` $ gem uninstall rdoc --all --force ERROR: While executing gem ... (Gem::InstallError) gem "rdoc" cannot be uninstalled because it is a default gem $ gem install rdoc Fetching rdoc-6.1.1.gem Successfully installed rdoc-6.1.1 1 gem installed $ gem uninstall rdoc --all --force Successfully uninstalled rdoc-6.1.1 ``` After this PR, the messages are more consistent and informative, in my opinion, and the status code is always success (as it was before #2707). ``` $ ruby -Ilib bin/gem uninstall rdoc --all --force Ignored rdoc-6.1.0 because it is a default gem $ gem install rdoc Fetching rdoc-6.1.1.gem Successfully installed rdoc-6.1.1 1 gem installed $ ruby -Ilib bin/gem uninstall rdoc --all --force Ignored rdoc-6.1.0 because it is a default gem Successfully uninstalled rdoc-6.1.1 ``` Thoughts? # Tasks: - [x] Describe the problem / feature - [x] Write tests - [x] Write code to solve the problem - [ ] Get code review from coworkers / friends I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md). Closes #2892. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
A change in rubygems [0] made our CI fail, but since it was every run, it showed that this line was indeed not needed. A fix in a future rubygems version [1] should fix this as well, but I think this is the way to go. [0] rubygems/rubygems#2707 [1] rubygems/rubygems#2893
A change in rubygems [0] made our CI fail, but since it was every run, it showed that this line was indeed not needed. A fix in a future rubygems version [1] should fix this as well, but I think this is the way to go. [0] rubygems/rubygems#2707 [1] rubygems/rubygems#2893
Description:
Sometimes
gem uninstall <gem_name>
fails to uninstall the gem, but does not give any errors. See #2701.This error swallowing seems intentionally introduced specifically for the
--all
option in 564ffe2, but I don't think this is good. In that case,--all
is leaving gems around so the user should be informed too?Maybe
gem uninstall
should try all paths inGEM_PATH
instead?Not sure, but the current behavior is no good.
Tasks:
I will abide by the code of conduct.