Bug 639330 - Update macro usage for compatibility with Ruby 1.9
Update macro usage for compatibility with Ruby 1.9
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: ruby-libvirt (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Chris Lalancette
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-01 09:21 EDT by Neil Wilson
Modified: 2010-12-21 16:48 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-12-21 16:48:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
rarray_len_macro_patch (502 bytes, patch)
2010-10-01 09:21 EDT, Neil Wilson
no flags Details | Diff
rstring_macros_patch (629 bytes, patch)
2010-10-01 09:49 EDT, Neil Wilson
no flags Details | Diff

  None (edit)
Description Neil Wilson 2010-10-01 09:21:52 EDT
Created attachment 451008 [details]
rarray_len_macro_patch

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):

Git HEAD

How reproducible:

Compile using Ruby 1.9 header files.
Comment 1 Neil Wilson 2010-10-01 09:49:28 EDT
Created attachment 451019 [details]
rstring_macros_patch
Comment 2 Neil Wilson 2010-10-01 09:49:58 EDT
Also RSTRING macros in secret.c
Comment 3 Chris Lalancette 2010-10-05 11:49:06 EDT
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?

Chris Lalancette
Comment 4 Neil Wilson 2010-10-05 12:18:31 EDT
Err.

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.

#ifndef RARRAY_LEN
# define RARRAY_LEN(s) (RARRAY(s)->len)
#endif

#ifndef RSTRING_LEN
# define RSTRING_LEN(s) (RSTRING(s)->len)
#endif

etc, etc.
Comment 5 Chris Lalancette 2010-10-05 12:30:40 EDT
You should be insulting, I was being dumb :).  I'll add it, thanks.

Chris Lalancette
Comment 6 Chris Lalancette 2010-10-05 23:22:27 EDT
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!

Chris Lalancette
Comment 7 Neil Wilson 2010-10-06 03:28:38 EDT
Missed one:

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[1]: *** [connect.o] Error 1
make[1]: Leaving directory `/build/buildd/ruby-libvirt-0.2.0+195/ext/libvirt'
debian-setup.rb:656:in `command': system("make") failed (RuntimeError)
Comment 8 Chris Lalancette 2010-10-08 10:44:22 EDT
Oops, sorry about that.  Fixed now.

Chris Lalancette
Comment 9 Chris Lalancette 2010-12-21 16:48:59 EST
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.

Chris Lalancette

Note You need to log in before you can comment on or make changes to this bug.