Bugs item #22770, was opened at 2008-11-12 09:34
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=575&aid=22770&group_id=126
Category: `gem` commands (other)
Group: v1.3.x
Status: Closed
Resolution: Accepted
Priority: 3
Submitted By: Andrew Reeve (dru)
Assigned to: Daniel Berger (djberg96)
Summary: Gem::InstallError when running gem clean in osx 10.5.5 (v.1.3.1)
Initial Comment:
Since updating to ruygems 1.3.1 (from 1.2) whenever I run
sudo gem clean
I get the following message for any gem version that comes bundled with leopard:
Cleaning up installed gems...
Attempting to uninstall ferret-0.11.4
ERROR: While executing gem ... (Gem::InstallError)
Unknown gem ferret = 0.11.4
With rubygems 1.2 it used to just skip over the pre-installed gems when I tried
to clean and then carried on cleaning up the other gems. Now, because of this
error it stops straight away meaning I have to do all of my cleanup by hand a
gem at a time.
Initially I though my gems were broken, but if I drop back down to rubygems 1.2
everything works fine, and in the interests of being thorough this problem also
persists after I do a clean install of the entire operating system.
This is the output of "gem env"
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-9
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/Dru/.gem/ruby/1.8
-
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org", "http://gems.github.com"]
- REMOTE SOURCES:
- http://gems.rubyforge.org
- http://gems.github.com
and this is the debug information from when I run "sudo gem clean"
[Dru ~] sudo gem --debug clean
Password:
Exception `NameError' at /Library/Ruby/Site/1.8/rubygems/command_manager.rb:134
- uninitialized constant Gem::Commands::CleanupCommand
Cleaning up installed gems...
Exception `NameError' at /Library/Ruby/Site/1.8/rubygems/command_manager.rb:134
- uninitialized constant Gem::Commands::UninstallCommand
Attempting to uninstall ferret-0.11.4
Exception `Gem::InstallError' at
/Library/Ruby/Site/1.8/rubygems/uninstaller.rb:61 - Unknown gem ferret = 0.11.4
ERROR: While executing gem ... (Gem::InstallError)
Unknown gem ferret = 0.11.4
/Library/Ruby/Site/1.8/rubygems/uninstaller.rb:61:in `uninstall'
/Library/Ruby/Site/1.8/rubygems/commands/cleanup_command.rb:78:in
`execute'
/Library/Ruby/Site/1.8/rubygems/commands/cleanup_command.rb:65:in `each'
/Library/Ruby/Site/1.8/rubygems/commands/cleanup_command.rb:65:in
`execute'
/Library/Ruby/Site/1.8/rubygems/command.rb:136:in `invoke'
/Library/Ruby/Site/1.8/rubygems/command_manager.rb:105:in `process_args'
/Library/Ruby/Site/1.8/rubygems/command_manager.rb:75:in `run'
/Library/Ruby/Site/1.8/rubygems/gem_runner.rb:39:in `run'
/usr/bin/gem:24
It's almost like it isn't seeing the gem repository located in
"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8"
I'll gladly submit any additional information you might need.
----------------------------------------------------------------------
Comment By: Hedge Hog (hedgehog)
Date: 2010-05-09 08:14
Message:
Also seeing this on ruby-1.9.1-p378, installed under rvm.
$ gem cleanup --debug
Exception `NameError' at
/home/hedge/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:163
- uninitialized constant Gem::Commands::CleanupCommand
Cleaning up installed gems...
Clean Up Complete
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.9.1 (2010-01-10 patchlevel 378) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/hedge/.rvm/gems/ruby-1.9.1-p378
- RUBY EXECUTABLE: /home/hedge/.rvm/rubies/ruby-1.9.1-p378/bin/ruby
- EXECUTABLE DIRECTORY: /home/hedge/.rvm/gems/ruby-1.9.1-p378/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/hedge/.rvm/gems/ruby-1.9.1-p378
- /home/hedge/.rvm/gems/ruby-1.9.1-p...@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :gem => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
----------------------------------------------------------------------
Comment By: John Stehle (jstehle)
Date: 2009-03-10 18:44
Message:
What was the fix. Is there a patch available? or should I do a gem update
--system?
Thanks
----------------------------------------------------------------------
Comment By: Eric Hodel (drbrain)
Date: 2009-03-08 21:04
Message:
Fixed by Ryan Davis.
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2009-02-11 06:09
Message:
Not much to report at the moment. This is going to be a tough one to solve I'm
sorry to say. Much tougher than it ought to be.
Dan
----------------------------------------------------------------------
Comment By: John Stehle (jstehle)
Date: 2009-02-10 18:13
Message:
Any update on this?
Thanks
----------------------------------------------------------------------
Comment By: John Stehle (jstehle)
Date: 2009-01-28 20:50
Message:
I am on a MacBook OS X 10.5.6 and I am having the same issues with
clean/cleanup as noted in this ticket. I also can not get uninstall to work
either. I would hazard a guess it has the same issues that cleanup does.
Any ETA when this will be set right? I'm starting a new project and would like
to get my house in order.
Also I have GEM_HOME=/Library/Ruby/Gems/1.8 set in my shell
Thanks in advance
John
gems$ pwd
/Library/Ruby/Gems/1.8/gems
gems$
gems$
gems$ ls merb-core*
merb-core-1.0.7.1:
CHANGELOG LICENSE README TODO
lib
CONTRIBUTORS PUBLIC_CHANGELOG Rakefile bin
merb-core-1.0.8:
CHANGELOG LICENSE README TODO
lib
CONTRIBUTORS PUBLIC_CHANGELOG Rakefile bin
merb-core-1.0.8.1:
CHANGELOG LICENSE README TODO
lib
CONTRIBUTORS PUBLIC_CHANGELOG Rakefile bin
gems$
gems$
gems$ sudo gem uninstall --version '= 1.0.7.1' merb-core --debug
Exception `NameError' at /Library/Ruby/Site/1.8/rubygems/command_manager.rb:134
- uninitialized constant Gem::Commands::UninstallCommand
Exception `Gem::InstallError' at
/Library/Ruby/Site/1.8/rubygems/uninstaller.rb:61 - Unknown gem merb-core =
1.0.7.1
ERROR: While executing gem ... (Gem::InstallError)
Unknown gem merb-core = 1.0.7.1
/Library/Ruby/Site/1.8/rubygems/uninstaller.rb:61:in `uninstall'
/Library/Ruby/Site/1.8/rubygems/commands/uninstall_command.rb:63:in
`execute'
/Library/Ruby/Site/1.8/rubygems/commands/uninstall_command.rb:61:in
`each'
/Library/Ruby/Site/1.8/rubygems/commands/uninstall_command.rb:61:in
`execute'
/Library/Ruby/Site/1.8/rubygems/command.rb:136:in `invoke'
/Library/Ruby/Site/1.8/rubygems/command_manager.rb:105:in `process_args'
/Library/Ruby/Site/1.8/rubygems/command_manager.rb:75:in `run'
/Library/Ruby/Site/1.8/rubygems/gem_runner.rb:39:in `run'
/usr/bin/gem:24
gems$
gems$
gems$
gems$
gems$ cat ~/.gemrc
---
:verbose: true
:benchmark: false
:sources:
- http://edge.merbivore.com
- http://gems.rubyforge.org/
:update_sources: true
:backtrace: false
:bulk_threshold: 1000
gems$
gems$
gems$
gems$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-9
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/johnstehle/.gem/ruby/1.8
-
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://edge.merbivore.com", "http://gems.rubyforge.org/"]
- REMOTE SOURCES:
- http://edge.merbivore.com
- http://gems.rubyforge.org/
gems$
gems$
gems$
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2009-01-04 16:24
Message:
Grr, the logic should be:
if @options[:install_dir]
paths = [...@options[:install_dir]]
else
paths = Gem.path.uniq
end
paths.each do |path|
path = File.expand_path(path)
spec_dir = File.join(path, 'specifications')
unless File.exists?(spec_dir)
raise ArgumentError, "path '#{spec_dir}' not found"
end
source_index = Gem::SourceIndex.from_gems_in(spec_dir)
list = source_index.find_name(@gem, @version)
...
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2009-01-04 16:23
Message:
Whoops, the logic should be:
paths.each do |path|
path = File.expand_path(path)
spec_dir = File.join(path, 'specifications')
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2009-01-04 16:21
Message:
Alright, digging through this some more has revealed some deeper fundamental
issues. But, let's step back to the immediate fix.
The first thing to to is to add a '-i' option to cleanup_command.rb. Not only
is it more convenient, it eliminates the need to hard code the install_dir in
the super call. That's something we don't want hard coded.
The next thing to do is to modify uninstaller.rb so that it iterates over
Gem.path, unless the -i option is specified, in which case _only_ that path
will be cleaned. Previously it was defaulting to a hard coded install_dir,
which was set to Gem.dir.
So, our logic for the uninstall method looked something like this:
paths.each do |path|
if @options[:install_dir]
paths = [...@options[:install_dir]]
else
paths = Gem.path.uniq
end
path = File.expand_path(path)
spec_dir = File.join(path, 'specifications')
unless File.exists?(spec_dir)
raise ArgumentError, "path '#{spec_dir}' not found"
end
source_index = Gem::SourceIndex.from_gems_in(spec_dir)
list = source_index.find_name(@gem, @version)
...
Unfortunately, what I've discovered is that the dependency list (in
dependency_list.rb) once again only checks in Gem.dir, not every Gem.path,
causing it to blow up with:
Exception `NoMethodError' at
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_list.rb:86 - undefined
method `name' for
nil:NilClass
ERROR: While executing gem ... (NoMethodError)
undefined method `name' for nil:NilClass
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_list.rb:86:in
`ok_to_remove?'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91:in `find_all'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_list.rb:85:in `each'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_list.rb:85:in
`find_all'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_list.rb:85:in
`ok_to_remove?'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:242:in
`dependencies_ok?'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:185:in `remove'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:113:in
`uninstall_gem'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:97:in `uninstall'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:66:in `each'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:66:in `uninstall'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb:83:in
`execute'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb:70:in `each'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb:70:in
`execute'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:136:in `invoke'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:105:in
`process_args'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:75:in `run'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:39:in `run'
C:/Ruby/bin/gem:24
Still working on it.
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2009-01-04 15:11
Message:
My initial attempt to just return if not found didn't work. I tried this in
uninstaller.rb:
if list.empty? then
return
But, it never seems to actually clean the gem, though it gives the impression
that it did:
c:\staging\gems>gem clean
Cleaning up installed gems...
Attempting to uninstall ptools-1.1.5
Clean Up Complete
c:\staging\gems>gem clean
Cleaning up installed gems...
Attempting to uninstall ptools-1.1.5
Clean Up Complete
Still working on it.
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2009-01-04 14:52
Message:
I'm able to duplicate this on my Windows box. This demonstrates the problem:
set GEM_PATH=c:\staging
gem install ptools -i c:\staging
gem install ptools --version=1.1.5 -i c:\staging
gem clean
Exception `Gem::InstallError' at
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:61 - Unknown gem ptools
= 1.1.5
ERROR: While executing gem ... (Gem::InstallError)
Unknown gem ptools = 1.1.5
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:61:in `uninstall'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb:78:in
`execute'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb:65:in `each'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb:65:in
`execute'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:136:in `invoke'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:105:in
`process_args'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:75:in `run'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:39:in `run'
C:/Ruby/bin/gem:24
The problem is that 'gem clean' is detecting that there's an older gem in one
of my gem paths, but it proceeds to assume that it's in _every_ gem path. When
it can't find it in one of the other paths it blows up.
Working on it...
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=575&aid=22770&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers