On Wed, Jan 28, 2009 at 05:00:05PM +0100, James Gray wrote:
> Bug #1068: Ruby Cannot Handle Some UIDs
> http://redmine.ruby-lang.org/issues/show/1068
> 
> Author: James Gray
> Status: Open, Priority: Normal
> 
> This shows the main problem:
> 
>   $ sudo ruby -r etc -e 'n = Etc.getpwnam("nobody"); p n.uid; Process.uid = n.uid'
>   Password:
>   ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin9.4.0]
>   4294967294
>   -e:1:in `uid=': bignum too big to convert into `long' (RangeError)
>   	from -e:1
> 
> The real UID for the nobody user on my system (Mac OS X 10.5.6) is -2.  Thus it seems at least some systems use signed UID's and Ruby can't handle that.
> 
> The above example is from Ruby 1.8.6.  Ruby 1.9 does seem to properly switch users, but it still shows the UID's incorrectly:
> 
>   $ sudo ruby_dev -v -r etc -e 'n = Etc.getpwnam("nobody"); p n.uid; Process.uid = n.uid; p Process.uid; p Etc.getpwuid(Process.uid)'
>   ruby 1.9.1 (2008-12-30 patchlevel-0 revision 21203) [i386-darwin9.6.0]
>   4294967294
>   4294967294
>   #<struct Struct::Passwd name="nobody", passwd="*", uid=4294967294, gid=4294967294, gecos="Unprivileged User", dir="/var/empty", shell="/usr/bin/false", change=0, uclass="", expire=0>
> 
> 
> ----------------------------------------
> http://redmine.ruby-lang.org
Any reason why not handle UID and GID as signed?

-- 

Ionization from the air-conditioning