Red Hat Bugzilla – Bug 639330
Update macro usage for compatibility with Ruby 1.9
Last modified: 2010-12-21 16:48:59 EST
Created attachment 451008 [details]
Description of problem:
Extension is using RARRAY()->len rather than the RARRAY_LEN macro, which causes the extention to fail to compile under Ruby 1.9
Version-Release number of selected component (if applicable):
Compile using Ruby 1.9 header files.
Created attachment 451019 [details]
Also RSTRING macros in secret.c
Ug. The problem is that on certain older ruby versions I tested, RARRAY_LEN doesn't exist. I can't quite remember the version that I saw the problem on, though I can poke around and try to find it. Do you have a suggestion for supporting both older ruby with RARRAY_LEN and new ruby with RARRAY_LEN?
Well at the risk of sounding insulting if the macro isn't defined, I'd sort of define it. Anywhere after including 'ruby.h' should do.
# define RARRAY_LEN(s) (RARRAY(s)->len)
# define RSTRING_LEN(s) (RSTRING(s)->len)
You should be insulting, I was being dumb :). I'll add it, thanks.
I slightly modified the patch to add the compatibility macros we discussed and pushed it to the git tree as commit 82a7374001f93e4540116c4f530b47299f7742fd. I'll build a new package with this included as soon as I do an upstream release.
Thanks for the contribution!
connect.c: In function 'libvirt_conn_baseline_cpu':
connect.c:406: error: 'struct RArray' has no member named 'len'
connect.c:408: error: 'struct RArray' has no member named 'len'
connect.c:412: error: 'struct RArray' has no member named 'len'
make: *** [connect.o] Error 1
make: Leaving directory `/build/buildd/ruby-libvirt-0.2.0+195/ext/libvirt'
debian-setup.rb:656:in `command': system("make") failed (RuntimeError)
Oops, sorry about that. Fixed now.
I've released 0.3.0 upstream, and put that release into rawhide. Both of these should have the fix. Thanks again for the contribution. I'll close this out as RAWHIDE.