[Rubygems-developers] [ rubygems-Bugs-27587 ] #gem fatals on getpwuid for daemons

noreply at rubyforge.org noreply at rubyforge.org
Sat Feb 6 21:23:55 EST 2010


Bugs item #27587, was opened at 2009-12-17 14:09
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=27587&group_id=126

Category: #gem and #require methods
Group: v1.3.x
>Status: Closed
>Resolution: Out of Date
Priority: 3
Submitted By: Riley Lynch (rlynch)
>Assigned to: Eric Hodel (drbrain)
Summary: #gem fatals on getpwuid for daemons

Initial Comment:
After upgrading from RubyGems 0.9.2 to 1.3.1, a monit script which runs mongrel processes was failing to exec. I captured the stderr, and found this trace:

/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:723:in `getpwuid': can't find user for 1000 (ArgumentError)
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:723:in `set_paths'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:719:in `each'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:719:in `set_paths'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:526:in `path'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:66:in `installed_spec_directories'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:56:in `from_installed_gems'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:736:in `source_index'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:140:in `activate'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
	from /usr/local/bin/mongrel_rails:15

I found reports of similar problems when running daemons via Cruise Control or Capistrano but did not see a solution posted.

  http://old.nabble.com/Etc.getpwuid-error-in-rake-gems-td22130762.html
  http://groups.google.com/group/capistrano/browse_thread/thread/b62989776d395c0a?pli=1

I was able to resolve the problem by adding a line for the daemon user to /etc/passwd via vipw. However, it seems to me that RubyGems ought not to fail under this condition. May I suggest wrapping the call to getpwuid in a block which rescues in the case that getpwuid raises ArgumentError ?



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

>Comment By: Eric Hodel (drbrain)
Date: 2010-02-06 18:23

Message:
This code seems to be removed from 1.3.5.

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

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


More information about the Rubygems-developers mailing list