Here's a better fix for fibers on Ruby 2.7, developed by the Ruby fiber
maintainer. It no longer requires building certain files without
optimizations on sparc64. Unlike the previous fix, with this fix,
make test finishes without crashing on sparc64.
It also includes another patch that fixes an occassional crash when
using lots of short-lived fibers and threads.
I plan to commit this in a few days unless I hear objections.
Thanks,
Jeremy
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/ruby/2.7/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile 5 Nov 2020 20:21:35 -0000 1.7
+++ Makefile 2 Dec 2020 23:00:08 -0000
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.7 2020/11/05 20:21:35 kn Exp $
+# $OpenBSD: Makefile,v 1.6 2020/10/30 22:07:20 jeremy Exp $
VERSION = 2.7.2
DISTNAME = ruby-${VERSION}
@@ -6,11 +6,18 @@ SHARED_LIBS = ruby27 0.0
NEXTVER = 2.8
PKGSPEC-main ?= ruby->=2.7.0,<${NEXTVER}
-REVISION-main = 0
+REVISION-main = 1
-MASTER_SITES0 = https://github.com/jeremyevans/ruby/commit/
-PATCHFILES = ruby-2.7-copy-coro-fix{7008ca3838d33bd2d594251fc8c7f4ce52dde72d}.patch:0 \
- ruby-2.7-ffi-closure-fix{040cfc89b9a110cd0fb2abdcd35e8215b4a71f60}.patch:0
+MASTER_SITES0 = https://github.com/ruby/ruby/commit/
+# First patch: Fix copy coroutine to avoid crash on fiber usage (affects at
+# least sparc64)
+# Second patch: Backport fix for regression in 2.7.2 to avoid crash in
+# ffi_closure_free
+# Third patch: Backport fix for use-after-free when fiber and thread are
+# garbage collected together
+PATCHFILES = ruby-2.7-copy-coro-fix-4{9de559acc82a28bb0d912ed55cd36cf6f652ea9f}.patch:0 \
+ ruby-2.7-ffi-closure-fix{040cfc89b9a110cd0fb2abdcd35e8215b4a71f60}.patch:0 \
+ ruby-2.7-fiber-use-after-free-fix{9fb60672d55162a92ab7e97b000a7e277458aab1}.patch:0
PATCH_DIST_STRIP = -p1
PSEUDO_FLAVORS= no_ri_docs bootstrap
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/ruby/2.7/distinfo,v
retrieving revision 1.5
diff -u -p -r1.5 distinfo
--- distinfo 5 Nov 2020 20:21:35 -0000 1.5
+++ distinfo 2 Dec 2020 23:23:47 -0000
@@ -1,6 +1,8 @@
-SHA256 (ruby-2.7-copy-coro-fix.patch) = 6kZ7jRFjQ9/KITyz0N+Pr1dKWrLgUDvjixtDkD76wX0=
+SHA256 (ruby-2.7-copy-coro-fix-4.patch) = 5KqbWXB9Qye3WMkmFS1aDAy2Y9HBls55AS+AWANojIg=
SHA256 (ruby-2.7-ffi-closure-fix.patch) = 4MKbiJzsl+VKRd24hZ4wWmiRQnEJgMKGcZS2KUsN1TU=
+SHA256 (ruby-2.7-fiber-use-after-free-fix.patch) = MNSCSLbg6MVuV/mEXXfV2eO6ZbJp8qPZ9N1CDCHYH7I=
SHA256 (ruby-2.7.2.tar.gz) = blcG0NTuTh4viD2512hYa00GVn3r6jU8eW7EXoMhw9Q=
-SIZE (ruby-2.7-copy-coro-fix.patch) = 2902
+SIZE (ruby-2.7-copy-coro-fix-4.patch) = 6062
SIZE (ruby-2.7-ffi-closure-fix.patch) = 1033
+SIZE (ruby-2.7-fiber-use-after-free-fix.patch) = 954
SIZE (ruby-2.7.2.tar.gz) = 16836767
Index: patches/patch-common_mk
===================================================================
RCS file: /cvs/ports/lang/ruby/2.7/patches/patch-common_mk,v
retrieving revision 1.2
diff -u -p -r1.2 patch-common_mk
--- patches/patch-common_mk 30 Oct 2020 22:07:20 -0000 1.2
+++ patches/patch-common_mk 2 Dec 2020 23:22:53 -0000
@@ -4,9 +4,6 @@ Enable verbose mode when building.
Don't regenerate rdoc documentation during install.
-Force building coroutine code without optimization on sparc64
-to avoid crashes.
-
Index: common.mk
--- common.mk.orig
+++ common.mk
@@ -37,20 +34,3 @@ Index: common.mk
pre-install-doc:: install-prereq
do-install-doc: $(PROGRAM) pre-install-doc
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc $(INSTALL_DOC_OPTS)
-@@ -1522,6 +1522,16 @@ update-man-date: PHONY
- -e 'BEGIN{@vcs=VCS.detect(ARGV.shift)}' \
- -e '$$_.sub!(/^(\.Dd ).*/){$$1+@vcs.modified(ARGF.path).strftime("%B %d, %Y")}' \
- "$(srcdir)" "$(srcdir)"/man/*.1
-+
-+.if "sparc64" == ${MACHINE}
-+cont.o: cont.c
-+ @$(ECHO) compiling $<
-+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -O0 $(COUTFLAG)$@ -c $<
-+
-+coroutine/copy/Context.o: coroutine/copy/Context.c
-+ @$(ECHO) compiling $<
-+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -O0 $(COUTFLAG)$@ -c $<
-+.endif
-
- HELP_EXTRA_TASKS = ""
-
No comments:
Post a Comment