FFI::Enum Ruby class in Enum.java not taken into account
--------------------------------------------------------

                 Key: JRUBY-5956
                 URL: https://jira.codehaus.org/browse/JRUBY-5956
             Project: JRuby
          Issue Type: Bug
          Components: Ruby 1.9.3
    Affects Versions: JRuby 1.6.3
         Environment: OpenVMS IA64. JRuby 1.6.3 modified and built using Ant
            Reporter: Philippe Vouters
            Assignee: Thomas E Enebo
             Fix For: JRuby 1.6.4


PHV:[PHV.jruby_vms.jruby-1^.6^.3.lib.ruby.site_ruby.shared.ffi]enum.rb;2 has 
been SFTP transferred from 
/usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.5/lib/ffi/enum.rb on my Linux 
computer to jruby_vms/jruby-1.6.3/lib/ruby/site_ruby/shared/ffi on the OpenVMS 
IA64 computer.

Now 3 versions of enum.rb are found in two different directories.

$ dire [...]enum.rb

Directory PHV:[PHV.jruby_vms.jruby-1^.6^.3.build.jar-complete.META-INF.jruby^.ho
me.lib.ruby.site_ruby.shared.ffi]

enum.rb;1           

Total of 1 file.

Directory PHV:[PHV.jruby_vms.jruby-1^.6^.3.lib.ruby.site_ruby.shared.ffi]

enum.rb;2           enum.rb;1           

Total of 2 files.

Grand total of 2 directories, 3 files.
$ jruby --1.9 DECC_test.rb foo bar
Hello, World!
Argument 0: FOO
Argument 1: BAR
$ type DECC_test.rb
require 'ffi'
require 'ffi/platform'

module Portablelibc
  extend FFI::Library
  if FFI::Platform.openvms?
     libc = "DECC$SHR"
  else
     libc = "c"
  end
  ffi_lib libc
  if FFI::Platform.openvms?
     attach_function :printf, :"decc$txprintf", [:string, :varargs], :int
  else
     attach_function :printf, [:string, :varargs], :int
  end
end

Portablelibc.printf("Hello, World!\n")
if ARGV.length > 1
   ARGV.length.times do |i|
       Portablelibc.printf("Argument %d: %s\n", :int, i, :string, ARGV[i])
   end
end
$ rename PHV:[PHV.jruby_vms.jruby-1^.6^.3.lib.ruby.site_ruby.shared.ffi]enum.rb;
2 enum.rb.save
$ dire [...]enum.rb

Directory PHV:[PHV.jruby_vms.jruby-1^.6^.3.build.jar-complete.META-INF.jruby^.ho
me.lib.ruby.site_ruby.shared.ffi]

enum.rb;1           

Total of 1 file.

Directory PHV:[PHV.jruby_vms.jruby-1^.6^.3.lib.ruby.site_ruby.shared.ffi]

enum.rb;1           

Total of 1 file.

Grand total of 2 directories, 2 files.
$ jruby --1.9 DECC_test.rb foo bar
LoadError: load error: ffi/enum -- java.lang.NullPointerException: null
  require at org/jruby/RubyKernel.java:1047
  require at /PHV/PHV/jruby_vms/jruby-1.6.3//lib/ruby/site_ruby/1.8/rubygems/cus
tom_require.rb:29
   (root) at /PHV/PHV/jruby_vms/jruby-1.6.3//lib/ruby/site_ruby/shared/ffi/ffi.r
b:81
  require at org/jruby/RubyKernel.java:1047
  require at /PHV/PHV/jruby_vms/jruby-1.6.3//lib/ruby/site_ruby/shared/ffi/ffi.r
b:29
   (root) at /PHV/PHV/jruby_vms/jruby-1.6.3//lib/ruby/site_ruby/shared/ffi.rb:1
  require at org/jruby/RubyKernel.java:1047
  require at /PHV/PHV/jruby_vms/jruby-1.6.3//lib/ruby/site_ruby/shared/ffi.rb:29
   (root) at DECC_TEST.RB:1
$ jruby --1.8 DECC_test.rb foo bar
Hello, World!
Argument 0: FOO
Argument 1: BAR

In consequence, either Ruby's 1.9.2 enum.rb file is missing in JRuby 1.6.3 or
jruby-1.6.3/src/org/jruby/ext/ffi/Enum.java is not taken into account when the 
Ruby code contains require 'ffi/ffi' and is executed under 1.9 compatibility.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to