Repro (current master in 1.8.7 mode):
a = Etc.getpwent
NoMethodError: undefined method `gecos' on an instance of Struct::Passwd.
There are cross platform issues here. Etc is implement with FFI. @brixen @dbussink What's the recommended approach for dealing with this in Rubinius? Implement Etc in C?
What are the issues? You can deal with platform issues in either rakelib/platform.rake or in lib/etc.rb.ffi.
struct passwd differs. Mostly just extra members, though there are is one type difference MRI implements. I've not been able to find an example of detecting member presence with FFI (possible?). Conditionals on the platform are the recommended approach then?
Look at rakelib/platform.rake. We also have detection code in configure if it is needed.
Added spec for Struct::Passwd
Added #gecos field to Struct::Passwd
I've added a spec for Struct::Passwd and the #gecos field to Struct::Passwd (needed to run Chef on rbx). The extra platform dependent members that MRI implements (change, quota, age, class, comment, expire)
aren't in MRI's official docs http://www.ruby-doc.org/stdlib-1.9.3/libdoc/etc/rdoc/Etc.html#method-c-getpwent
and I couldn't figure out how to make the detection code in configure work with ffi either nor how to write a spec for them (the detection code is in configure, it passes compile flags to rubinius but how do you get to them in mspec in a way that's implementation independent ?)
Fixed spec descriptions in struct_passwd_spec
Added Struct::Group spec