From f5c3b0cc83b316ab7208a27fd31262ab64d5a1e1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 30 May 2026 21:19:52 +0900 Subject: [PATCH 1/4] Compressed files must be opened in binary mode --- test/stdlib/zlib/GzipReader_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/stdlib/zlib/GzipReader_test.rb b/test/stdlib/zlib/GzipReader_test.rb index 6d2e288b60..c4538ab0fb 100644 --- a/test/stdlib/zlib/GzipReader_test.rb +++ b/test/stdlib/zlib/GzipReader_test.rb @@ -29,7 +29,7 @@ def test_wrap path = File.join(tmpdir, "test.gz") Zlib::GzipWriter.open(path) { _1.puts "hello" } - File.open(path) do |io| + File.open(path, "rb") do |io| assert_send_type "(IO io) -> Zlib::GzipReader", Zlib::GzipReader, :wrap, io From 4f02ed4b7923dc14b02ff4ea265cb2d5b75230dc Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jun 2026 13:13:34 +0900 Subject: [PATCH 2/4] Fix flaky DirSingletonTest#test_fchdir under aggressive GC The Dir created by `Dir.new(Dir.pwd).fileno` was only referenced long enough to read its fileno, so it became collectable immediately. When GC ran between the assert_send_type calls the fd was closed, making the later `Dir.fchdir(fd)` fail with Errno::EBADF. Keep the Dir in a local and close it in ensure. Surfaced on ruby/ruby ZJIT CI with --enable-zjit=dev --zjit-call-threshold=1. https://github.com/ruby/ruby/actions/runs/27735384476/job/82051097840 Co-Authored-By: Claude Opus 4.8 --- test/stdlib/Dir_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/stdlib/Dir_test.rb b/test/stdlib/Dir_test.rb index 80b466559d..f7786fcca1 100644 --- a/test/stdlib/Dir_test.rb +++ b/test/stdlib/Dir_test.rb @@ -104,7 +104,8 @@ def test_exist? end def test_fchdir - fd = Dir.new(Dir.pwd).fileno + dir = Dir.new(Dir.pwd) + fd = dir.fileno with_int(fd) do |int| assert_send_type( @@ -117,6 +118,8 @@ def test_fchdir Dir, :fchdir, int, &proc { "string" } ) end + ensure + dir&.close end def test_foreach From 80fe578cb0cd24f006435b3acd3edc940b5790a9 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jun 2026 13:14:40 +0900 Subject: [PATCH 3/4] Apply the same GC fix to DirSingletonTest#test_for_fd test_for_fd has the same pattern as test_fchdir: the Dir from `Dir.new(Dir.pwd).fileno` is collectable before `Dir.for_fd(fd)` runs, so an ill-timed GC closes the fd and the call fails with Errno::EBADF. Keep the Dir alive in a local and close it in ensure. Co-Authored-By: Claude Opus 4.8 --- test/stdlib/Dir_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/stdlib/Dir_test.rb b/test/stdlib/Dir_test.rb index f7786fcca1..d98130acb4 100644 --- a/test/stdlib/Dir_test.rb +++ b/test/stdlib/Dir_test.rb @@ -133,7 +133,8 @@ def test_foreach end def test_for_fd - fd = Dir.new(Dir.pwd).fileno + dir = Dir.new(Dir.pwd) + fd = dir.fileno with_int(fd) do |int| assert_send_type( @@ -141,6 +142,8 @@ def test_for_fd Dir, :for_fd, int ) end + ensure + dir&.close end def test_getwd From ecc499a66720b713794e6db610a649046d7bf66b Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 12 May 2026 13:41:15 +0900 Subject: [PATCH 4/4] ci: skip Gemfile.lock BUNDLED WITH on ruby-head Released bundlers (up to 4.0.11) reference Pathname::SEPARATOR_PAT, which became a private constant on ruby-head, causing bundle install to crash with NameError. The fix (rubygems/rubygems#9529) is on master but not yet released. Use bundler's "version system" config to skip the lockfile-pinned 4.0.1 and use ruby-head's bundled bundler instead. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ruby.yml | 6 ++++++ .github/workflows/windows.yml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 1836e10e65..e92c4a590a 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -63,6 +63,9 @@ jobs: if: ${{ contains(matrix.ruby, 'head') }} run: | bundle config set force_ruby_platform true + - name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head + if: ${{ contains(matrix.ruby, 'head') }} + run: bundle config set --local version system - name: Skip installing type checkers if: ${{ ! contains(matrix.job, 'typecheck_test') }} run: | @@ -106,6 +109,9 @@ jobs: if: ${{ contains(matrix.ruby, 'head') }} run: | bundle config set force_ruby_platform true + - name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head + if: ${{ contains(matrix.ruby, 'head') }} + run: bundle config set --local version system - name: bin/setup run: | bin/setup diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e313060d04..1733e7d5e8 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -35,6 +35,9 @@ jobs: bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]} system "gem uninstall #{bundled_gems.join(" ")} --force", exception: true ' + - name: Ignore Gemfile.lock's BUNDLED WITH on dev Ruby + if: ${{ matrix.ruby == 'ucrt' || matrix.ruby == 'mswin' }} + run: bundle config set --local version system - name: bundle install run: | bundle config set without profilers libs