Bug #3462

gem activation fails for native gems

Added by Roger Pack over 1 year ago. Updated 9 months ago.

Status:Closed Start date:06/22/2010
Priority:Normal Due date:
Assignee:Evan Phoenix % Done:

0%

Category:-
Target version:1.9.2
ruby -v:ruby 1.9.3dev (2010-06-19) [i386-mingw32]

Description

C:\dev\digitalarchive_trunk>gem install ruby-prof
Successfully installed ruby-prof-0.8.1-x86-mingw32
1 gem installed

C:\dev\digitalarchive_trunk>irb
>> gem 'ruby-prof'
Gem::LoadError: Could not find RubyGem ruby-prof (>= 0)

        from <internal:gem_prelude>:186:in `push_gem_version_on_load_path'
        from <internal:gem_prelude>:16:in `gem'
        from (irb):1
        from c:/installs/ruby_trunk_installed/bin/irb.bat:20:in `<main>'
irb(main):002:0> $:.grep /ruby-prof/
=> ["c:/installs/ruby_trunk_installed/lib/ruby/gems/1.9.1/gems/ruby-prof-0.8.1-x86-mingw32/bin", "c:/installs/ruby_trunk_installed/lib/ruby/gems/1.9.1/gems/ruby-prof-0.8.1-x86-mingw32/lib"]

C:\dev\digitalarchive_trunk>ruby -v
ruby 1.9.3dev (2010-06-19) [i386-mingw32]


C:\dev\digitalarchive_trunk>gem -v
1.3.7

History

Updated by Yusuke Endoh over 1 year ago

  • Assignee set to Eric Hodel

Updated by Yusuke Endoh over 1 year ago

  • Target version set to 1.9.2
Hi,

This issue seems to be reproducible only on windows.
Unless anyone suggests any fix by today, this issue will be WONTFIX
for 1.9.2.

This is the last ticket that is a show stopper against 1.9.2 release.

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by Roger Pack over 1 year ago

Yeah I wouldn't call this a high priority ticket.

Updated by Nobuyoshi Nakada over 1 year ago

gem_prelude.rb:push_all_highest_version_gems_on_load_path expects gem
directory names to be "#{GEMNAME}-#{VERSION}", but the native gem
directory name is suffixed by the platform name.

The following patch may help or may not.


diff --git a/gem_prelude.rb b/gem_prelude.rb
index 71f30bd..3be64aa 100644
--- a/gem_prelude.rb
+++ b/gem_prelude.rb
@@ -229,8 +229,12 @@ if defined?(Gem) then
             Dir.entries(gems_directory).each do |gem_directory_name|
               next if gem_directory_name == "." || gem_directory_name == ".."

-              next unless gem_name = gem_directory_name[/(.*)-(.*)/, 1]
+              next unless gem_name = gem_directory_name[/(.*)-(\d+(?:\.\d+)*)(?:-(.*))?/, 1]
               new_version = integers_for($2)
+              if platform = $3
+                require 'rubygems/platform'
+                Gem::Platform.match(platform) or next
+              end
               current_version = GemVersions[gem_name]

               if !current_version or (current_version <=> new_version) < 0 then

Updated by Yusuke Endoh over 1 year ago

  • Assignee changed from Eric Hodel to Evan Phoenix
Hi, Evan

This ticket is about gem_prelude.rb.
Do you think this should be fixed in 1.9.2?
And what do you think about nobu's patch?

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by Evan Phoenix over 1 year ago

On Jul 20, 2010, at 6:25 AM, Yusuke Endoh wrote:

> Issue #3462 has been updated by Yusuke Endoh.
> 
> Assigned to changed from Eric Hodel to Evan Phoenix
> 
> Hi, Evan
> 
> This ticket is about gem_prelude.rb.
> Do you think this should be fixed in 1.9.2?
> And what do you think about nobu's patch?

Nobu's patch is fine. It's a minor modification of my original patch for this issue. Nobu's patch was reverted from trunk because of the lazy sweep issue, as I recall.

If we can apply the patch to 1.9.2, we should.

 - Evan

> 
> -- 
> Yusuke Endoh <mame@tsg.ne.jp>
> ----------------------------------------
> http://redmine.ruby-lang.org/issues/show/3462
> 
> ----------------------------------------
> http://redmine.ruby-lang.org
> 
> 

Updated by Yusuke Endoh over 1 year ago

Hi,

2010/7/21 Evan Phoenix <evan@fallingsnow.net>:
>> Hi, Evan
>>
>> This ticket is about gem_prelude.rb.
>> Do you think this should be fixed in 1.9.2?
>> And what do you think about nobu's patch?
>
> Nobu's patch is fine. It's a minor modification of my original patch for this issue. Nobu's patch was reverted from trunk because of the lazy sweep issue, as I recall.
>
> If we can apply the patch to 1.9.2, we should.


Thank you for your quick reply!

Did you get a commit bit?  If you did, could you apply it to
trunk and check "make test-rubyspec" and "make check"?
If you see no problem, please commit it to trunk.

If no problem is reported in a few days, I'll backport it to
ruby_1_9_2.

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by Evan Phoenix over 1 year ago

On Jul 20, 2010, at 9:32 AM, Yusuke Endoh wrote:

> Issue #3462 has been updated by Yusuke Endoh.
> 
> 
> Hi,
> 
> 2010/7/21 Evan Phoenix <evan@fallingsnow.net>:
>>> Hi, Evan
>>> 
>>> This ticket is about gem_prelude.rb.
>>> Do you think this should be fixed in 1.9.2?
>>> And what do you think about nobu's patch?
>> 
>> Nobu's patch is fine. It's a minor modification of my original patch for this issue. Nobu's patch was reverted from trunk because of the lazy sweep issue, as I recall.
>> 
>> If we can apply the patch to 1.9.2, we should.
> 
> 
> Thank you for your quick reply!

No problem!

> 
> Did you get a commit bit?  If you did, could you apply it to
> trunk and check "make test-rubyspec" and "make check"?
> If you see no problem, please commit it to trunk.

Yep! I've got a commit bit now, I'll apply to trunk and commit it if it's fine.

> 
> If no problem is reported in a few days, I'll backport it to
> ruby_1_9_2.

Wonderful!

> 
> -- 
> Yusuke Endoh <mame@tsg.ne.jp>
> ----------------------------------------
> http://redmine.ruby-lang.org/issues/show/3462
> 
> ----------------------------------------
> http://redmine.ruby-lang.org
> 
> 

Updated by Evan Phoenix over 1 year ago

I've committed a slightly revised version of the patch that nobu and I worked on into trunk. It solves the gem activation issues because it loads all of rubygems to perform any gem activation.

Hopefully we can have this backported to 1.9.2 soon.

Thanks!

 - Evan

On Jul 20, 2010, at 9:34 AM, Evan Phoenix wrote:

> 
> On Jul 20, 2010, at 9:32 AM, Yusuke Endoh wrote:
> 
>> Issue #3462 has been updated by Yusuke Endoh.
>> 
>> 
>> Hi,
>> 
>> 2010/7/21 Evan Phoenix <evan@fallingsnow.net>:
>>>> Hi, Evan
>>>> 
>>>> This ticket is about gem_prelude.rb.
>>>> Do you think this should be fixed in 1.9.2?
>>>> And what do you think about nobu's patch?
>>> 
>>> Nobu's patch is fine. It's a minor modification of my original patch for this issue. Nobu's patch was reverted from trunk because of the lazy sweep issue, as I recall.
>>> 
>>> If we can apply the patch to 1.9.2, we should.
>> 
>> 
>> Thank you for your quick reply!
> 
> No problem!
> 
>> 
>> Did you get a commit bit?  If you did, could you apply it to
>> trunk and check "make test-rubyspec" and "make check"?
>> If you see no problem, please commit it to trunk.
> 
> Yep! I've got a commit bit now, I'll apply to trunk and commit it if it's fine.
> 
>> 
>> If no problem is reported in a few days, I'll backport it to
>> ruby_1_9_2.
> 
> Wonderful!
> 
>> 
>> -- 
>> Yusuke Endoh <mame@tsg.ne.jp>
>> ----------------------------------------
>> http://redmine.ruby-lang.org/issues/show/3462
>> 
>> ----------------------------------------
>> http://redmine.ruby-lang.org
>> 
>> 
> 
> 
> 

Updated by Roger Pack over 1 year ago

Seems to work now. Since it doesn't pre-load $: with any gem lib paths anymore, probably quite a bit of gem_prelude could now be removed as well.

Thanks much.
-r

Updated by Yusuke Endoh over 1 year ago

  • Status changed from Open to Closed
I've backported r28693, r28695 and r28703.  Please check ruby_1_9_2.

We'll release RC3 within a few days (or weeks), and then 1.9.2-p0.

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Also available in: Atom PDF