Search code examples
rubyodbc

ruby-odbc and ruby 3.2.2: undefined symbol: rb_tainted_str_new


ruby-odbc is on error on ruby 3.2.x because of :

ruby-odbc-0.99999/lib/odbc.so: undefined symbol: rb_tainted_str_new

Indead, the ruby C methods rb_tainted_str_new is now removed. Do you know if there is any patch to solve that?

And generally, is there anyone maintaining this gem?


Solution

  • As long as the gem isn't driving any logic with the taint mechanism, it can be trivially patched by replacing rb_tainted_str_new with rb_str_new (which should include replacing rb_tainted_str_new2 with rb_str_new2) and removing any calls to rb_obj_taint.

    It looks like someone already forked ruby-odbc to do this: https://github.com/vhermecz/ruby-odbc/commit/c38d182863b907f9ce55d2dfeb9bd86e698f8968

    In your gemfile, you can install their patched version:

    gem 'ruby-odbc', github: 'vhermecz/ruby-odbc'