[Rubygems-developers] [ rubygems-Bugs-22617 ] Gem.loaded_specs does not work on 1.9

noreply at rubyforge.org noreply at rubyforge.org
Sat Nov 13 04:36:02 EST 2010


Bugs item #22617, was opened at 2008-10-30 16:32
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=22617&group_id=126

Category: other
Group: v1.3.x
Status: Closed
Resolution: Accepted
Priority: 3
Submitted By: Paul Brannan (cout)
>Assigned to: Evan Phoenix (evan)
Summary: Gem.loaded_specs does not work on 1.9

Initial Comment:
The loaded_specs attribute seems to always be empty on 1.9:

[pbrannan at zem ruby]$ ruby -rubygems -e 'gem("ruby-prof"); p Gem.loaded_specs'
{"ruby-prof"=>#<Gem::Specification:0x402fd664 @extra_rdoc_files=["bin/ruby-prof", "ext/ruby_prof.c", "examples/flat.txt", "examples/graph.txt", "examples/graph.html", "README", "LICENSE"], @date=Sun Feb 03 00:00:00 -0500 2008, @new_platform="ruby", @executables=["ruby-prof"], @authors=["Shugo Maeda and Charlie Savage"], @cert_chain=[], @required_rubygems_version=#<Gem::Requirement:0x402fd470 @version=nil, @requirements=[[">=", #<Gem::Version "0">]]>, @version=#<Gem::Version "0.6.0">, @files=["Rakefile", "README", "LICENSE", "CHANGES", "bin/ruby-prof", "lib/ruby-prof", "lib/ruby-prof.rb", "lib/unprof.rb", "lib/ruby-prof/abstract_printer.rb", "lib/ruby-prof/call_tree_printer.rb", "lib/ruby-prof/call_tree_printer.rb.rej", "lib/ruby-prof/flat_printer.rb", "lib/ruby-prof/graph_html_printer.rb", "lib/ruby-prof/graph_printer.rb", "lib/ruby-prof/profile_test_case.rb", "lib/ruby-prof/task.rb", "rails_plugin/ruby-prof", "rails_plugin/ruby-prof/init.rb", "rails_plugin/ruby-prof/lib", "rails_plugin/ruby-prof/lib/profiling.rb", "examples/flat.txt", "examples/graph.html", "examples/graph.txt", "ext/extconf.rb", "ext/extconf.rb.rej", "ext/measure_allocations.h", "ext/measure_cpu_time.h", "ext/measure_memory.h", "ext/measure_process_time.h", "ext/measure_wall_time.h", "ext/ruby_prof.c", "test/basic_test.rb", "test/duplicate_names_test.rb", "test/line_number_test.rb", "test/measure_mode_test.rb", "test/module_test.rb", "test/no_method_class_test.rb", "test/prime.rb", "test/prime1.rb", "test/prime2.rb", "test/prime3.rb", "test/prime_test.rb", "test/printers_test.rb", "test/profile_unit_test.rb", "test/recursive_test.rb", "test/singleton_test.rb", "test/start_test.rb", "test/test_helper.rb", "test/test_suite.rb", "test/thread_test.rb", "test/timing_test.rb"], @has_rdoc=true, @specification_version=2, @loaded=true, @requirements=[], @signing_key=nil, @default_executable="ruby-prof", @email="shugo at ruby-lang.org and cfis at savagexi.com", @required_ruby_version=#<Gem::Requirement:0x402fcad4 @version=nil, @requirements=[[">=", #<Gem::Version "1.8.4">]]>, @rdoc_options=["--title", "ruby-prof", "--inline-source", "--line-numbers", "--main", "README"], @bindir="bin", @rubygems_version="1.2.0", @homepage="http://rubyforge.org/projects/ruby-prof/", @name="ruby-prof", @platform="ruby", @autorequire=nil, @rubyforge_project="ruby-prof", @extensions=["ext/extconf.rb"], @summary="Fast Ruby profiler", @loaded_from="/usr/local/lib/ruby/gems/1.8/specifications/ruby-prof-0.6.0.gemspec", @original_platform=nil, @post_install_message=nil, @description="ruby-prof is a fast code profiler for Ruby. It is a C extension and therefore is many times faster than the standard Ruby profiler. It supports both flat and graph profiles.  For each method, graph profiles show how long the method ran, which methods called it and which  methods it called. RubyProf generate both text and html and can output it to standard out or to a file.", @dependencies=[], @test_files=["test/test_helper.rb", "test/test_suite.rb"], @require_paths=["bin", "lib"]>}
[pbrannan at zem ruby]$ ruby1.9 -rubygems -e 'gem("ruby-prof"); p Gem.loaded_specs'
/usr/local/lib/ruby/gems/1.9.0/gems/rubygems-update-1.3.1/lib/rubygems/config_file.rb:7: warning: mismatched indentations: line 216:'def' and line 218:'end'
/usr/local/lib/ruby/gems/1.9.0/gems/rubygems-update-1.3.1/lib/rubygems/config_file.rb:7: warning: mismatched indentations: line 231:'def' and line 233:'end'
/usr/local/lib/ruby/gems/1.9.0/gems/rubygems-update-1.3.1/lib/rubygems/config_file.rb:7: warning: mismatched indentations: line 246:'def' and line 248:'end'
/usr/local/lib/ruby/gems/1.9.0/gems/rubygems-update-1.3.1/lib/rubygems/config_file.rb:7: warning: mismatched indentations: line 261:'def' and line 263:'end'
{}


----------------------------------------------------------------------

>Comment By: James Tucker (raggi)
Date: 2010-11-13 09:36

Message:
Yeah, Evan took this on, it's his game now.

----------------------------------------------------------------------

Comment By: Ryan Davis (zenspider)
Date: 2010-11-13 04:06

Message:
This was rejected because it is invalid. gem_prelude supersedes rubygems in 1.9. I doubt there is anything we can or should do (to rubygems).

----------------------------------------------------------------------

Comment By: Roger Pack (rogerdpack)
Date: 2010-11-12 23:28

Message:
This one appears to still be valid.
(standard users are unable to re-open tickets.)


----------------------------------------------------------------------

Comment By: Ryan Davis (zenspider)
Date: 2010-11-12 22:46

Message:
This ticket has been deemed stale and we're closing it in order to catch up 
with our ticket list. If you think it is still valid, please reopen.

----------------------------------------------------------------------

Comment By: Giorgenes Gelatti (giorgenes)
Date: 2010-07-08 17:23

Message:
I can't require 'gemname' on ruby1.9.1. Could it be related?

----------------------------------------------------------------------

Comment By: Roger Pack (rogerdpack)
Date: 2010-01-19 02:44

Message:
you can run ruby --disable-gems (I think) to disable gem prelude (auto loading of gem lib dirs).
Barring that, you could submit a patch that compares $LOADED_FEATURES with the load paths of existing gems and "infers" "we have already loaded those other gems via the normal mechanism"
Cheers!
-r

----------------------------------------------------------------------

Comment By: Nikolai Weibull (pcp)
Date: 2009-10-21 20:36

Message:
Yes, I would love to be able to provide a patch, but I don’t see a solution.  To me it looks like this is an inherent flaw in how Ruby 1.9 and Rubygems interact.  Since Ruby 1.9 adds all the paths to gems installed on your system, Rubygems never gets a chance to load the specs and thus solve this problem.  I have no idea why it was decided that Ruby 1.9 should augment its $LOAD_PATH in this way, nor why these things weren’t considered at the time, but it would be great if someone came up with a solution.

----------------------------------------------------------------------

Comment By: Luis Lavena (luislavena)
Date: 2009-10-21 17:00

Message:
Whiny you sound, patches are welcome too :-)



----------------------------------------------------------------------

Comment By: Nikolai Weibull (pcp)
Date: 2009-10-21 16:48

Message:
This is still the case on Windows 1.9.1-p243.  By extension, Config.datadir, which is what I care about, doesn’t work.

I don’t want to sound whiny, but I can’t see how this can have gone unfixed for close to a year now.  It seems like a rather central concept.

----------------------------------------------------------------------

Comment By: Matt Hulse (mhulse)
Date: 2009-08-04 23:27

Message:
Yes, this is still happening in 1.9.1-p129.  I'm on WinXP Pro using the mingw32 build from rubyinstaller.org/downloads.  I just updated to rubygems 1.3.5 using gem update --system and Gem.loaded_specs is still empty until I call gem('') or gem('nokogiri') (the gem I'm looking for).

----------------------------------------------------------------------

Comment By: Joeri Samson (joeri)
Date: 2009-03-29 18:42

Message:
with 1.9.1p0 and rubygems 1.3.1 I get the same error as Eric Hodel, except if I print/access Gem.loaded_specs before calling gem "rake":

joeri at alpha ~ $ ruby19 -rubygems -e 'p Gem.loaded_specs; gem("rake"); p Gem.loaded_specs'
{}
{"rake"=>#<Gem::Specification:0x81c8240 @new_platform="ruby", @name="rake", @version=#<Gem::Version "0.8.4">, @summary="Ruby based make-like utility.", @email="jim at weirichhouse.org", @homepage="http://rake.rubyforge.org", @rubyforge_project="rake", @description="Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.", @autorequire=nil, @default_executable="rake", @signing_key=nil, @post_install_message=nil, @original_platform=nil, @rubygems_version="1.3.1", @specification_version=2, @date=2009-03-04 00:00:00 +0100, @require_paths=["bin", "lib"], @bindir="bin", @has_rdoc=true, @required_ruby_version=#<Gem::Requirement:0x81c8088 @requirements=[[">=", #<Gem::Version "0">]], @version=nil>, @required_rubygems_version=#<Gem::Requirement:0x81c7778 @requirements=[[">=", #<Gem::Version "0">]], @version=nil>, @platform="ruby", @cert_chain=[], @authors=["Jim Weirich"], @files=["install.rb", "CHANGES", "MIT-LICENSE", "Rakefile", "README", "TODO", "bin/rake", "lib/rake/classic_namespace.rb", "lib/rake/clean.rb", "lib/rake/contrib/compositepublisher.rb", "lib/rake/contrib/ftptools.rb", "lib/rake/contrib/publisher.rb", "lib/rake/contrib/rubyforgepublisher.rb", "lib/rake/contrib/sshpublisher.rb", "lib/rake/contrib/sys.rb", "lib/rake/gempackagetask.rb", "lib/rake/loaders/makefile.rb", "lib/rake/packagetask.rb", "lib/rake/rake_test_loader.rb", "lib/rake/rdoctask.rb", "lib/rake/repaired_system.rb", "lib/rake/ruby182_test_unit_fix.rb", "lib/rake/runtest.rb", "lib/rake/tasklib.rb", "lib/rake/testtask.rb", "lib/rake/win32.rb", "lib/rake.rb", "test/capture_stdout.rb", "test/check_expansion.rb", "test/contrib/test_sys.rb", "test/data/rakelib/test1.rb", "test/data/rbext/rakefile.rb", "test/filecreation.rb", "test/functional.rb", "test/in_environment.rb", "test/rake_test_setup.rb", "test/reqfile.rb", "test/reqfile2.rb", "test/session_functional.rb", "test/shellcommand.rb", "test/test_application.rb", "test/test_clean.rb", "test/test_definitions.rb", "test/test_earlytime.rb", "test/test_extension.rb", "test/test_file_creation_task.rb", "test/test_file_task.rb", "test/test_filelist.rb", "test/test_fileutils.rb", "test/test_ftp.rb", "test/test_invocation_chain.rb", "test/test_makefile_loader.rb", "test/test_multitask.rb", "test/test_namespace.rb", "test/test_package_task.rb", "test/test_pathmap.rb", "test/test_rake.rb", "test/test_rdoc_task.rb", "test/test_require.rb", "test/test_rules.rb", "test/test_task_arguments.rb", "test/test_task_manager.rb", "test/test_tasklib.rb", "test/test_tasks.rb", "test/test_test_task.rb", "test/test_top_level_functions.rb", "test/test_win32.rb", "test/data/imports/deps.mf", "test/data/sample.mf", "test/data/chains/Rakefile", "test/data/default/Rakefile", "test/data/dryrun/Rakefile", "test/data/file_creation_task/Rakefile", "test/data/imports/Rakefile", "test/data/multidesc/Rakefile", "test/data/namespace/Rakefile", "test/data/statusreturn/Rakefile", "test/data/unittest/Rakefile", "test/data/unittest/subdir", "doc/command_line_usage.rdoc", "doc/example", "doc/example/a.c", "doc/example/b.c", "doc/example/main.c", "doc/example/Rakefile1", "doc/example/Rakefile2", "doc/glossary.rdoc", "doc/jamis.rb", "doc/proto_rake.rdoc", "doc/rake.1.gz", "doc/rakefile.rdoc", "doc/rational.rdoc", "doc/release_notes", "doc/release_notes/rake-0.4.14.rdoc", "doc/release_notes/rake-0.4.15.rdoc", "doc/release_notes/rake-0.5.0.rdoc", "doc/release_notes/rake-0.5.3.rdoc", "doc/release_notes/rake-0.5.4.rdoc", "doc/release_notes/rake-0.6.0.rdoc", "doc/release_notes/rake-0.7.0.rdoc", "doc/release_notes/rake-0.7.1.rdoc", "doc/release_notes/rake-0.7.2.rdoc", "doc/release_notes/rake-0.7.3.rdoc", "doc/release_notes/rake-0.8.0.rdoc", "doc/release_notes/rake-0.8.2.rdoc", "doc/release_notes/rake-0.8.3.rdoc", "doc/release_notes/rake-0.8.4.rdoc"], @test_files=[], @rdoc_options=["--line-numbers", "--inline-source", "--main", "README", "--title", "Rake -- Ruby Make"], @extra_rdoc_files=["README", "MIT-LICENSE", "TODO", "CHANGES", "doc/command_line_usage.rdoc", "doc/glossary.rdoc", "doc/proto_rake.rdoc", "doc/rakefile.rdoc", "doc/rational.rdoc", "doc/release_notes/rake-0.4.14.rdoc", "doc/release_notes/rake-0.4.15.rdoc", "doc/release_notes/rake-0.5.0.rdoc", "doc/release_notes/rake-0.5.3.rdoc", "doc/release_notes/rake-0.5.4.rdoc", "doc/release_notes/rake-0.6.0.rdoc", "doc/release_notes/rake-0.7.0.rdoc", "doc/release_notes/rake-0.7.1.rdoc", "doc/release_notes/rake-0.7.2.rdoc", "doc/release_notes/rake-0.7.3.rdoc", "doc/release_notes/rake-0.8.0.rdoc", "doc/release_notes/rake-0.8.2.rdoc", "doc/release_notes/rake-0.8.3.rdoc", "doc/release_notes/rake-0.8.4.rdoc"], @executables=["rake"], @extensions=[], @requirements=[], @dependencies=[], @loaded=true, @loaded_from="/home/joeri/.gem/ruby/1.9.1/specifications/rake-0.8.4.gemspec">}

----------------------------------------------------------------------

Comment By: Eric Hodel (drbrain)
Date: 2009-03-27 21:29

Message:
With 1.9.1p0 and 1.9.2dev I see:

$ ruby19 -v -rubygems -e 'gem "rake"; p Gem.loaded_specs'
ruby 1.9.2dev (2009-03-28 trunk 23085) [i386-darwin9.6.0]
<internal:gem_prelude>:234:in `push_gem_version_on_load_path': Could not find RubyGem rake (>= 0) (Gem::LoadError)
	from <internal:gem_prelude>:14:in `gem'
	from -e:1:in `<main>'

This will take a bit more work than I planned for 1.3.1, and may require changes to gem_prelude :/

----------------------------------------------------------------------

Comment By: James Tucker (raggi)
Date: 2009-03-16 10:50

Message:
Ah, no, I hit .activate, which hits source_index.

----------------------------------------------------------------------

Comment By: James Tucker (raggi)
Date: 2009-03-16 10:48

Message:
works for me

----------------------------------------------------------------------

Comment By: Daniel Berger (djberg96)
Date: 2009-01-02 15:59

Message:
Is this still happening in 1.9.1?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=22617&group_id=126


More information about the Rubygems-developers mailing list