ruby-odbc icon indicating copy to clipboard operation
ruby-odbc copied to clipboard

Fails to make with Ruby 3.2.0

Open Galaxy83 opened this issue 1 year ago • 7 comments

Fails to make it with Ruby 3.2.0

odbc.c:1873:20: error: implicit declaration of function 'rb_obj_taint' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_ary_push(a, rb_obj_taint(v));
                   ^
odbc.c:1952:21: error: implicit declaration of function 'rb_obj_taint' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            rb_ary_push(a, rb_obj_taint(v));
                           ^
odbc.c:2048:21: error: implicit declaration of function 'rb_obj_taint' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            rb_ary_push(a, rb_obj_taint(v));
                           ^
odbc.c:2302:20: error: implicit declaration of function 'rb_obj_taint' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_ary_push(a, rb_obj_taint(v));
                   ^
odbc.c:2392:27: error: implicit declaration of function 'rb_tainted_str_new' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_iv_set(odsn, "@name", rb_tainted_str_new(dsn, dsnLen));
                                 ^
odbc.c:2457:27: error: implicit declaration of function 'rb_tainted_str_new' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_iv_set(odrv, "@name", rb_tainted_str_new(driver, driverLen));
                                 ^
odbc.c:2463:9: error: implicit declaration of function 'rb_tainted_str_new2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                             rb_tainted_str_new2(p + 1));
                             ^
odbc.c:2463:9: note: did you mean 'rb_tainted_str_new'?
odbc.c:2392:27: note: 'rb_tainted_str_new' declared here
        rb_iv_set(odsn, "@name", rb_tainted_str_new(dsn, dsnLen));
                                 ^
odbc.c:2782:9: error: implicit declaration of function 'rb_tainted_str_new2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return rb_tainted_str_new2(valbuf);
               ^
odbc.c:4589:29: error: implicit declaration of function 'rb_tainted_str_new2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_iv_set(obj, "@name", rb_tainted_str_new2(upcase_if(name, upc)));

Galaxy83 avatar Dec 25 '22 12:12 Galaxy83

@Galaxy83 did you find any workaround? I'm also facing same issue with Ruby 3.2.0

sandeshbodake avatar Jan 17 '23 12:01 sandeshbodake

@sandeshbodake nope. We refrained from updating the relevant microservice for now. Fortunately, updating to 3.2.0 is not critical. We are still looking for solutions.

Galaxy83 avatar Jan 17 '23 17:01 Galaxy83

Sorry I don't use ODBC in any way since years, so that I don't want to maintain this gem. You might contact the original author Christian Werner, to do the necessary changes or send him a patch.

The changes for ruby-3.2 are quite trivial. All the taint-things are gone and can be removed or changed to the non-taint-calls. See here for instance: https://github.com/ged/ruby-pg/commit/25d6ff2817a56a1ab9376b4f7dae82067bb911bb

larskanis avatar Jan 18 '23 16:01 larskanis

I had some contact with Christian Werner by mail: [email protected] years ago.

larskanis avatar Jan 18 '23 16:01 larskanis

@larskanis thx for the comment on taint removal, as we needed this quick, I copied latest v0.999991 from Christian Werner's page, and did a quick patch. Could be further cleaned up, but works for now.

https://github.com/vhermecz/ruby-odbc

Using it in our Gemfile as gem 'ruby-odbc', github: 'vhermecz/ruby-odbc'

The scary part is that the lib did built in Linux envs, only broke when we wanted to use. It did broke however when performing a build on new ARM based Mac.

vhermecz avatar Feb 01 '23 07:02 vhermecz

Thanks @vhermecz for patching this!

rkiller avatar Apr 01 '23 00:04 rkiller

Would it be possible to merge the fixing PR and release a new version on Rubygems? The changelog here mentions a recent version: http://www.ch-werner.de/rubyodbc/ChangeLog

I know the gem is unsupported but it would help many people and someone else already fixed it. @larskanis

Zeneixe avatar Oct 05 '23 13:10 Zeneixe