Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building against Ruby 3.2+ (patch included) #2532

Closed
Lalufu opened this issue Apr 25, 2023 · 8 comments · Fixed by #2539
Closed

Fix building against Ruby 3.2+ (patch included) #2532

Lalufu opened this issue Apr 25, 2023 · 8 comments · Fixed by #2539

Comments

@Lalufu
Copy link
Contributor

Lalufu commented Apr 25, 2023

The rack/ruby plugin code references rb_obj_taint(), which has been removed from Ruby 3.2. The function has been deprecated for a long time, and hasn't been doing anything useful since Ruby 2.7.
The attached patch removes the call for Ruby 2.7 and onwards.

diff -uNr a/plugins/rack/rack_plugin.c b/plugins/rack/rack_plugin.c
--- a/plugins/rack/rack_plugin.c	2022-10-24 12:21:58.000000000 +0200
+++ b/plugins/rack/rack_plugin.c	2023-04-22 21:18:03.451028685 +0200
@@ -456,7 +456,11 @@
 
 static void rack_hack_dollar_zero(VALUE name, ID id) {
 	ur.dollar_zero = rb_obj_as_string(name);
+    // From ruby 2.7 onwards this is a noop, from ruby 3.2 onwards
+    // this function no longer exists
+#if !defined(RUBY27)
 	rb_obj_taint(ur.dollar_zero);
+#endif
 }
 
 #ifndef RUBY19
diff -uNr a/plugins/rack/uwsgiplugin.py b/plugins/rack/uwsgiplugin.py
--- a/plugins/rack/uwsgiplugin.py	2023-04-22 21:17:26.854810444 +0200
+++ b/plugins/rack/uwsgiplugin.py	2023-04-22 21:18:03.454028704 +0200
@@ -18,6 +18,8 @@
     CFLAGS.append('-DRUBY19')
     if version >= '2.0':
         CFLAGS.append('-DRUBY20')
+    if version >= '2.7':
+        CFLAGS.append('-DRUBY27')
     CFLAGS.append('-Wno-unused-parameter')
     rbconfig = 'RbConfig'	 
 else:
diff -uNr a/plugins/ruby19/uwsgiplugin.py b/plugins/ruby19/uwsgiplugin.py
--- a/plugins/ruby19/uwsgiplugin.py	2023-04-22 21:17:26.854810444 +0200
+++ b/plugins/ruby19/uwsgiplugin.py	2023-04-22 21:18:36.479225658 +0200
@@ -18,6 +18,8 @@
     CFLAGS.append('-DRUBY19')
     if version >= '2.0':
         CFLAGS.append('-DRUBY20')
+    if version >= '2.7':
+        CFLAGS.append('-DRUBY27')
     CFLAGS.append('-Wno-unused-parameter')
     rbconfig = 'RbConfig'	 
 else:
@xrmx
Copy link
Collaborator

xrmx commented Apr 29, 2023

Care to open a PR please?

@xrmx
Copy link
Collaborator

xrmx commented Jun 6, 2023

@Lalufu it looks like you have some local changes, I don't see the RUBY20 definition upstream. Chance there are other changes needed?

@Lalufu
Copy link
Contributor Author

Lalufu commented Jun 6, 2023 via email

@xrmx
Copy link
Collaborator

xrmx commented Jun 6, 2023

Let me see if I can update ruby on CI

xrmx pushed a commit to xrmx/uwsgi that referenced this issue Jun 6, 2023
The rack/ruby plugin code references rb_obj_taint(), which has been
removed from Ruby 3.2. The function has been deprecated for a long time,
and hasn't been doing anything useful since Ruby 2.7.

Fix unbit#2532
@xrmx
Copy link
Collaborator

xrmx commented Jun 6, 2023

It's already 2.0+ in CI so no need for that define i guess.

xrmx pushed a commit to xrmx/uwsgi that referenced this issue Jun 6, 2023
The rack/ruby plugin code references rb_obj_taint(), which has been
removed from Ruby 3.2. The function has been deprecated for a long time,
and hasn't been doing anything useful since Ruby 2.7.

Fix unbit#2532
@xrmx
Copy link
Collaborator

xrmx commented Jun 6, 2023

@Lalufu I think you may have other patches around or you ain't building master but uwsgi-2.0 branch https://github.com/unbit/uwsgi/actions/runs/5192790458/jobs/9362444450

xrmx pushed a commit to xrmx/uwsgi that referenced this issue Jun 6, 2023
The rack/ruby plugin code references rb_obj_taint(), which has been
removed from Ruby 3.2. The function has been deprecated for a long time,
and hasn't been doing anything useful since Ruby 2.7.

Fix unbit#2532
xrmx pushed a commit to xrmx/uwsgi that referenced this issue Jun 7, 2023
The rack/ruby plugin code references rb_obj_taint(), which has been
removed from Ruby 3.2. The function has been deprecated for a long time,
and hasn't been doing anything useful since Ruby 2.7.

Fix unbit#2532
@Lalufu
Copy link
Contributor Author

Lalufu commented Jun 14, 2023 via email

xrmx pushed a commit to xrmx/uwsgi that referenced this issue Jun 15, 2023
The rack/ruby plugin code references rb_obj_taint(), which has been
removed from Ruby 3.2. The function has been deprecated for a long time,
and hasn't been doing anything useful since Ruby 2.7.

Fix unbit#2532
@xrmx
Copy link
Collaborator

xrmx commented Jun 15, 2023

@Lalufu I fixed the ruby compile errors in my pr above, now need to look at other runtimes.

xrmx pushed a commit to xrmx/uwsgi that referenced this issue Jul 25, 2023
The rack/ruby plugin code references rb_obj_taint(), which has been
removed from Ruby 3.2. The function has been deprecated for a long time,
and hasn't been doing anything useful since Ruby 2.7.

Fix unbit#2532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants