Error in Sys::Host on FreeBSD

I just downloaded the Sys::Host package from RAA. Upon installing it
under my FreeBSD system, I got an error when I ran the test script. I’m
using Ruby 1.7.2.

The error occurs when I run the test.rb program with the final line
uncommented, as follows:

#!/usr/bin/ruby

require "sys/host"
include Sys

puts Host.hostname
puts Host.ip_addr
Host.ip_addr{|ip| puts ip}

Output:

hippo.asfast.net
216.182.10.250
216.182.10.250
ruby in free(): warning: junk pointer, too high to make sense.

I’m not familiar with the C-Ruby interface, or else I’d try to fix this
myself.

Thanks in advance for any help you might be able to give me with this
warning.

···


Lloyd Zusman
ljz@asfast.com

Lloyd Zusman ljz@asfast.com writes:

[ … ]

The error occurs when I run the test.rb program with the final line
uncommented, as follows:

#!/usr/bin/ruby

require "sys/host"
include Sys

puts Host.hostname
puts Host.ip_addr
Host.ip_addr{|ip| puts ip}

I just discovered that if I use “each” in the final line, the error goes
away …

Host.ip_addr.each {|ip| puts ip}

I’m not sure if the final line in test.rb has a typo, or if this a bona
fide bug because the ip_addr method is supposed to properly handle
iterators.

But anyway, at least I can use the module without a problem now.

···

[ … ]


Lloyd Zusman
ljz@asfast.com