Fix "undefined method `uid' for nil:NilClass" problem with Rubygems 1.3.1
-------------------------------------------------------------------------
Key: JRUBY-3197
URL: http://jira.codehaus.org/browse/JRUBY-3197
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.1.5
Environment: Rubygems 1.3.1, JRuby native access turned off, existence
of a ~/.gems directory
Reporter: Nick Sieger
Assignee: Thomas E Enebo
Priority: Critical
Fix For: JRuby 1.1.6
In JRuby 1.1.5, with the conditions listed in the environment section, the
following error occurs when loading Rubygems:
{noformat}
org.jruby.rack.RackInitializationException: undefined method `uid' for
nil:NilClass
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:719:in
`each'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:719:in
`set_paths'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:526:in
`path'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:66:in
`installed_spec_directories'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:56:in
`from_installed_gems'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:736:in
`source_index'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:140:in
`activate'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:49:in
`gem'
... 17 levels...
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/rack/builder.rb:22:in
`instance_eval'
from
{elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/rack/builder.rb:22:in
`initialize'
from <script>:3
at
org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:154)
at
org.jruby.rack.PoolingRackApplicationFactory$1.run(PoolingRackApplicationFactory.java:159)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jruby.exceptions.RaiseException
at
Kernel.method_missing({elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:723)
at
#<Class:01x1ed72e>.set_paths({elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:719)
at
Array.each({elided}.../glassfish-v2ur1/domains/domain1/generated/jsp/j2ee-modules/junction2/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:719)
{noformat}
Make sure this is patched before the 1.1.6 release.
Related:
*
http://rubyforge.org/tracker/index.php?func=detail&aid=22226&group_id=126&atid=575
*
http://rubyforge.org/tracker/index.php?func=detail&aid=22764&group_id=126&atid=575
* JRUBY-3094
As a quickfix, consider this patch from dudleyf in #22764:
{noformat}
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb (revision 1918)
+++ lib/rubygems.rb (working copy)
@@ -719,7 +719,7 @@
@gem_path.each do |path|
if 0 == File.expand_path(path).index(Gem.user_home)
next unless File.directory? Gem.user_home
- unless win_platform? then
+ if defined?(Etc) && !Etc.getpwuid.nil? then
# only create by matching user
next if Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid
end
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email