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

gem uninstall with more than one argument fails #115

Closed
vandrijevik opened this issue Jun 16, 2011 · 6 comments
Closed

gem uninstall with more than one argument fails #115

vandrijevik opened this issue Jun 16, 2011 · 6 comments

Comments

@vandrijevik
Copy link

Environment:

[vladimir@fermat:~/Code]$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
[vladimir@fermat:~/Code]$ gem -v
1.8.5

[vladimir@fermat:~/Code]$ gem list refinery

*** LOCAL GEMS ***

refinerycms-images (1.0.0)
refinerycms-pages (1.0.0)
refinerycms-resources (1.0.0)
refinerycms-settings (1.0.0)

Attempting to uninstall more than one gem at the same time results in the first gem being uninstalled, and a Gem::InstallError on the second one:

[vladimir@fermat:~/Code]$ gem uninstall refinerycms-images refinerycms-pages
Successfully uninstalled refinerycms-images-1.0.0
ERROR:  While executing gem ... (Gem::InstallError)
    cannot uninstall, check `gem list -d refinerycms-pages`

However, without making any changes, running:

[vladimir@fermat:~/Code]$ gem uninstall refinerycms-pages
Successfully uninstalled refinerycms-pages-1.0.0

immediately afterwards uninstalls the second gem without any problems.

This occurs for any two gems (whether they have mutual dependencies or not), so uninstall seems to be broken for removing more than one gem at the same time.

@ghost ghost assigned zenspider Jun 17, 2011
@wapcaplet
Copy link

Ditto. Example:

$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]
$ gem -v
1.8.5

$ gem list cucumber
*** LOCAL GEMS ***
cucumber (1.0.0)
cucumber-rails (0.5.1)

$ gem uninstall cucumber cucumber-rails -aIx
Removing cucumber
Successfully uninstalled cucumber-1.0.0
ERROR:  While executing gem ... (Gem::InstallError)
    cannot uninstall, check `gem list -d cucumber-rails`

$ gem uninstall cucumber-rails -aIx
Successfully uninstalled cucumber-rails-0.5.1

The only workaround I have found is to uninstall gems one by one, which is very tedious.

@blackwinter
Copy link
Contributor

I've tracked it down to the following:

  1. I have /usr/lib/ruby/gems/1.8 and ~/.gem/ruby/1.8 in my GEM PATHS
  2. For the first gem, Gem::Uninstaller#initialize effectively calls Gem.use_paths '~/.gem/ruby/1.8', '/usr/lib/ruby/gems/1.8' which sets Gem.dir to ~/.gem/ruby/1.8
  3. For the second gem, Gem::Uninstaller#initialize effectively calls Gem.use_paths '~/.gem/ruby/1.8', '~/.gem/ruby/1.8', because Gem.dir is now ~/.gem/ruby/1.8

Not sure what a fix should look like. I'm not too familiar with the code base and it feels like Gem.dir and Gem.path are mixed up in several places (gem cleanup has a similar problem; see #153). Comments in the source seem to indicate that this is something that is going to be refactored.

Workaround: gem uninstall --no-user-install ...

@blackwinter
Copy link
Contributor

Not sure if 3653f2c was supposed to fix this (it says "Fixed uninstalling multiple gems using gem uninstall"), but for me the issue remains. Tests pass, though.

@vandrijevik
Copy link
Author

1.8.9 fixes this issue for me.

@blackwinter
Copy link
Contributor

Definitely not the case here:

$ gem192 install exifr xmp
Fetching: exifr-1.0.6.gem (100%)
Successfully installed exifr-1.0.6
Fetching: xmp-0.2.0.gem (100%)
Successfully installed xmp-0.2.0
2 gems installed
$ gem192 uninstall -x xmp exifr
Successfully uninstalled xmp-0.2.0
ERROR:  While executing gem ... (Gem::InstallError)
    gem "exifr" is not installed
$ gem192 uninstall -x exifr
Removing exifr
Successfully uninstalled exifr-1.0.6

It seems, the only thing this update did for me was break the workaround :(

P.S.:

$ gem192 env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.9
  - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/jw/.multiruby/install/mri_1_9_2/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /home/jw/.multiruby/install/mri_1_9_2/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jw/.multiruby/install/mri_1_9_2/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/jw/.multiruby/install/mri_1_9_2/lib/ruby/gems/1.9.1
     - /home/jw/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :sources => ["http://rubygems.org/", "http://prometheus-app.uni-koeln.de/rubygems/"]
  - REMOTE SOURCES:
     - http://rubygems.org/
     - http://prometheus-app.uni-koeln.de/rubygems/

@blackwinter
Copy link
Contributor

That did it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants