From cfdac1e2a0de73395dea8f048eae2541cb26715f Mon Sep 17 00:00:00 2001 From: Daisuke Aritomo Date: Sat, 17 Feb 2024 12:31:21 +0900 Subject: [PATCH] Workaround 3.3.0 crash on arm64 Ruby 3.3.0 has a bug which crashes many programs on arm64. https://bugs.ruby-lang.org/issues/20085 This bug is fixed in upstream (https://github.com/ruby/ruby/pull/9371) and is planned to be backported, but no date is given yet for the 3.3.1 release. This patch workarounds this bug by applying the upstream fix/backport in https://github.com/ruby/ruby/pull/9385 . Co-authored-by: Tianon Gravi --- 3.3/alpine3.18/Dockerfile | 7 +++++++ 3.3/alpine3.19/Dockerfile | 7 +++++++ 3.3/bookworm/Dockerfile | 7 +++++++ 3.3/bullseye/Dockerfile | 7 +++++++ 3.3/slim-bookworm/Dockerfile | 7 +++++++ 3.3/slim-bullseye/Dockerfile | 7 +++++++ Dockerfile.template | 9 +++++++++ 7 files changed, 51 insertions(+) diff --git a/3.3/alpine3.18/Dockerfile b/3.3/alpine3.18/Dockerfile index a8fc31e8d..01c0153f1 100644 --- a/3.3/alpine3.18/Dockerfile +++ b/3.3/alpine3.18/Dockerfile @@ -117,6 +117,13 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/3.3/alpine3.19/Dockerfile b/3.3/alpine3.19/Dockerfile index 09166fdd9..e3ad15bee 100644 --- a/3.3/alpine3.19/Dockerfile +++ b/3.3/alpine3.19/Dockerfile @@ -117,6 +117,13 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/3.3/bookworm/Dockerfile b/3.3/bookworm/Dockerfile index 42ab5f94e..79801b37f 100644 --- a/3.3/bookworm/Dockerfile +++ b/3.3/bookworm/Dockerfile @@ -75,6 +75,13 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/3.3/bullseye/Dockerfile b/3.3/bullseye/Dockerfile index 3be8ea342..70b0fd66d 100644 --- a/3.3/bullseye/Dockerfile +++ b/3.3/bullseye/Dockerfile @@ -75,6 +75,13 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/3.3/slim-bookworm/Dockerfile b/3.3/slim-bookworm/Dockerfile index ace67cb4a..183503cb9 100644 --- a/3.3/slim-bookworm/Dockerfile +++ b/3.3/slim-bookworm/Dockerfile @@ -101,6 +101,13 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/3.3/slim-bullseye/Dockerfile b/3.3/slim-bullseye/Dockerfile index da0533312..6ed757bea 100644 --- a/3.3/slim-bullseye/Dockerfile +++ b/3.3/slim-bullseye/Dockerfile @@ -101,6 +101,13 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/Dockerfile.template b/Dockerfile.template index b59a19ea7..3387f9cb3 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -252,6 +252,15 @@ RUN set -eux; \ export LIBS='-lucontext'; \ ;; \ esac; \ +{{ ) else "" end -}} +{{ if .version == "3.3.0" then ( -}} + # workaround crash on arm64 + # https://bugs.ruby-lang.org/issues/20085 + # https://github.com/ruby/ruby/pull/9385 <- https://github.com/ruby/ruby/pull/9371 + wget -O 'arm64-fix.patch' 'https://github.com/ruby/ruby/commit/7f97e3540ce448b501bcbee15afac5f94bb22dd9.patch?full_index=1'; \ + echo '86bc65415fd62cb2272a4df249f39fb79db15617ad05c540e05a22f02eae73b3 *arm64-fix.patch' | sha256sum --check --strict; \ + patch -p1 -i arm64-fix.patch; \ + rm arm64-fix.patch; \ {{ ) else "" end -}} gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \