bluhm@'s octeon test machine found a consistently failing openssl-ruby test. tb@ and claudio@ did some analysis and found the issue was not a LibreSSL issue, but a general issue with attempting to create a Time object in Ruby after the year 2115.
Since this was a Ruby issue and not a LibreSSL issue, @tb got me involved. @bluhm granted me access to an octeon machine, allowing me to debug the issue. I found the underlying cause was an general multiplication issue in Ruby when using two integers less than 64-bit that when multiplied resulted in a integer greater than 64-bit. On octeon, Ruby was using an int128_t type in this case, but the results were not consistent. A simple workaround of not using a int128_t type fixes the issue. Ruby falls back to a different approach in this case. tb@ did some testing and it does not appear there is a general int128_t problem on octeon. visa@ tested my patch to avoid the use of the int128_t type, and found it fixed the failing openssl-ruby test. I committed my patch upstream, and would like to backport the fix to our ports for Ruby 3.0 and 3.1. OKs for the following patch? This updates MASTER_SITES0 in the Ruby port to use GitHub instead of bugs.ruby-lang.org by default, since that's where I've been backporting recent commits from. It adds my upstream commit as a distpatch for Ruby 3.0 and 3.1. The patch doesn't apply on Ruby 2.7, so I don't plan to fix this on Ruby 2.7 unless requested. Thank you to tb@, visa@, bluhm@, and claudio@ for their help in resolving this issue. Jeremy Index: Makefile.inc =================================================================== RCS file: /cvs/ports/lang/ruby/Makefile.inc,v retrieving revision 1.27 diff -u -p -r1.27 Makefile.inc --- Makefile.inc 11 Mar 2022 19:29:13 -0000 1.27 +++ Makefile.inc 3 Jul 2022 18:43:08 -0000 @@ -23,7 +23,7 @@ MAINTAINER ?= Jeremy Evans <jeremy@openb PERMIT_PACKAGE?= Yes MASTER_SITES ?= https://cache.ruby-lang.org/pub/ruby/${VERSION:R}/ -MASTER_SITES0 ?= https://bugs.ruby-lang.org/attachments/download/ +MASTER_SITES0 ?= https://github.com/ruby/ruby/commit/ CONFIGURE_STYLE ?= gnu CONFIGURE_ARGS += --enable-shared \ Index: 2.7/Makefile =================================================================== RCS file: /cvs/ports/lang/ruby/2.7/Makefile,v retrieving revision 1.20 diff -u -p -r1.20 Makefile --- 2.7/Makefile 14 Apr 2022 20:32:06 -0000 1.20 +++ 2.7/Makefile 3 Jul 2022 18:43:08 -0000 @@ -4,7 +4,6 @@ SHARED_LIBS = ruby27 0.0 NEXTVER = 2.8 PKGSPEC-main ?= ruby->=2.7.0,<${NEXTVER} -MASTER_SITES0 = https://github.com/ruby/ruby/commit/ # Backport fix for regression in 2.7.2+ to avoid crash in ffi_closure_free PATCHFILES = ruby-2.7-ffi-closure-fix{040cfc89b9a110cd0fb2abdcd35e8215b4a71f60}.patch:0 PATCH_DIST_STRIP = -p1 Index: 3.0/Makefile =================================================================== RCS file: /cvs/ports/lang/ruby/3.0/Makefile,v retrieving revision 1.11 diff -u -p -r1.11 Makefile --- 3.0/Makefile 14 Apr 2022 20:32:59 -0000 1.11 +++ 3.0/Makefile 3 Jul 2022 18:43:08 -0000 @@ -3,6 +3,11 @@ DISTNAME = ruby-${VERSION} SHARED_LIBS = ruby30 0.0 NEXTVER = 3.1 PKGSPEC-main ?= ruby->=3.0.0,<${NEXTVER} +REVISION-main = 0 + +# Backport fix for fixnum*fixnum multiplication on octeon +PATCHFILES = ruby-octeon-fix{fe6245b4309c855e6aca5b786ad50a72d53d278a}.patch:0 +PATCH_DIST_STRIP = -p1 PSEUDO_FLAVORS= no_ri_docs bootstrap # Do not build the RI docs on slow arches Index: 3.0/distinfo =================================================================== RCS file: /cvs/ports/lang/ruby/3.0/distinfo,v retrieving revision 1.5 diff -u -p -r1.5 distinfo --- 3.0/distinfo 14 Apr 2022 20:32:59 -0000 1.5 +++ 3.0/distinfo 3 Jul 2022 18:43:08 -0000 @@ -1,2 +1,4 @@ SHA256 (ruby-3.0.4.tar.gz) = cLR8IHrwS86azqJiMI+0KJPT4kTzmkq8WGkgoccjcis= +SHA256 (ruby-octeon-fix.patch) = qFc5PJPaBF1ly9Kr9hXaQIYLmPPyUUw7ThMTkfE6y3A= SIZE (ruby-3.0.4.tar.gz) = 21139486 +SIZE (ruby-octeon-fix.patch) = 1880 Index: 3.1/Makefile =================================================================== RCS file: /cvs/ports/lang/ruby/3.1/Makefile,v retrieving revision 1.7 diff -u -p -r1.7 Makefile --- 3.1/Makefile 14 Apr 2022 20:33:25 -0000 1.7 +++ 3.1/Makefile 3 Jul 2022 18:43:08 -0000 @@ -3,6 +3,11 @@ DISTNAME = ruby-${VERSION} SHARED_LIBS = ruby31 0.0 NEXTVER = 3.2 PKGSPEC-main ?= ruby->=3.1.0,<${NEXTVER} +REVISION-main = 0 + +# Backport fix for fixnum*fixnum multiplication on octeon +PATCHFILES = ruby-octeon-fix{fe6245b4309c855e6aca5b786ad50a72d53d278a}.patch:0 +PATCH_DIST_STRIP = -p1 PSEUDO_FLAVORS= no_ri_docs bootstrap # Do not build the RI docs on slow arches Index: 3.1/distinfo =================================================================== RCS file: /cvs/ports/lang/ruby/3.1/distinfo,v retrieving revision 1.3 diff -u -p -r1.3 distinfo --- 3.1/distinfo 14 Apr 2022 20:33:25 -0000 1.3 +++ 3.1/distinfo 3 Jul 2022 18:43:08 -0000 @@ -1,2 +1,4 @@ SHA256 (ruby-3.1.2.tar.gz) = YYQxEjifArc1QotTu2TPmIrZ+4GFi4JI4i5XM28kqD4= +SHA256 (ruby-octeon-fix.patch) = qFc5PJPaBF1ly9Kr9hXaQIYLmPPyUUw7ThMTkfE6y3A= SIZE (ruby-3.1.2.tar.gz) = 20553628 +SIZE (ruby-octeon-fix.patch) = 1880