-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
gem uninstall --user-install GEM_NAME
throws InstallError, even if the gem is installed
#6457
Comments
This issue blocks #5327 (If GEM_HOME is not writable, use --user-install). The error is obviously deliberate, but I suspect it was not intended to affect rubygems/lib/rubygems/commands/uninstall_command.rb Lines 180 to 192 in 6256829
|
Just FTR, the
|
Yeah, I'm not entirely sure what the appropriate behavior is. I just know that "throw an error" feels like it is definitely wrong. |
That is a good question, but as far as I know, if you use gem --user-install, it will install into the home dir, right? And there may be situations where you have /usr/lib/ as target (say a campus university computer system) and you need to override some things via custom gems so --user-install is used. You are probably correct that this may not make a difference because of gem's default behaviour targeting the user's home dir first - that may be. But I can understand why users can come up with using --user-install at gem uninstall too, even though that seems a misnomer. 🗡️
Well, while I agree with you in general, IF the user passes a flag that says "ruby, target user-installed gems first", then there should not be any picking. It should default to uninstall the first gem it can find AT the user-install directory. |
I guess an additional source of confusion may be for users to wonder what GEM_HOME is used for and how it relates to --user-install, if at all. |
Interesting. This works as documented for me:
So this is probably specific to @duckinator's setup. Have you investigated anything yet, @duckinator? For what it's worth, the option is documented like this: rubygems/lib/rubygems/commands/uninstall_command.rb Lines 54 to 58 in ac7c317
|
I haven't dug into this yet. Planning to get to it this week. |
This is reproducible on a fresh FreeBSD 13.1 VM. Installed FreeBSD 13.1, added a non-root user, and installed the `gem env` after installing `ruby` and `ruby30-gems` packages
This also happens with the latest RubyGems (installed via `gem env` after `gem update --system`
I could not reproduce it on Ubuntu 22.04. I'm attempting to narrow it down farther. |
It took a little more effort (I had to manually install RubyGems from a TGZ file), but almost-latest Ruby (3.2.0) and latest RubyGems (3.4.10) still had the problem. `gem env` on fresh FreeBSD 13.1 VM, after installing `ruby32` and installing RubyGems manually
|
Some info from the working system, for comparison. `gem env` on Ubuntu 22.04 LTS
|
Hmm. Off the top of my head, that sounds like an issue with the FreeBSD ruby package, rather than an issue with Ruby itself. If you install ruby on FreeBSD using a version manager like rvm or ruby-install, does it still have the same problem? |
I used Ruby 3.0.5 installed via By default I get a different failure: it just doesn't think the gem is installed.
After deleting attempting with `GEM_*` unset
I also realized that the code I linked to before was not the area the error happens. This is the correct one: rubygems/lib/rubygems/uninstaller.rb Lines 113 to 123 in 63a6a4b
It looks like that error has been there for 12 years: 7096384. I'm not sure what's happening that's making |
Is It seems to compare |
@fd00 |
I am using a cygwin environment where After checking the contents of the variable, this comparison failed. rubygems/lib/rubygems/uninstaller.rb Lines 107 to 110 in a67b265
The proper fix is still unknown to me. |
@duckinator I'm having a pass over related RubyGems issues and I found a repro for your problem and a potential fix at #7645. Ruby core specs are failing, I should look into that, but other than that seems fine. |
Describe the problem as clearly as you can
If you run
gem install --user-install SOME_GEM
, then rungem uninstall --user-install SOME_GEM
, RubyGems throws an error because the gem is not inGEM_HOME
and tells you to use--install-dir
instead.There is a test which seems relevant, and passes. It does not catch this problem, however.
rubygems/test/rubygems/test_gem_uninstaller.rb
Lines 371 to 394 in 6256829
I suspect we need something closer to an integration test, possibly in test/rubygems/test_gem_commands_uninstall_command.rb.
Did you try upgrading RubyGems?
Yes. This occurs both on RubyGems 3.4.8 and master (as of 6256829)
Post steps to reproduce the problem
Using Ruby 3.0.5p211, via the FreeBSD
lang/ruby30
package.Which command did you run?
gem uninstall --user-install boop
(exact gem does not matter).What were you expecting to happen?
I was expecting it to uninstall the specified gem.
What actually happened?
It said it is not installed in GEM_HOME, and recommends using
-i
(--install-dir
) with the user-install directory (the value ofGem.user_dir
).Run
gem env
and paste the output belowThe text was updated successfully, but these errors were encountered: