From: "unasuke (Yusuke Nakamura) via ruby-core" Date: 2026-08-23T05:55:47+00:00 Subject: [ruby-core:126471] [Ruby Bug#21798] `bundle install` command fails if touches `$LOAD_PATH` on `Ruby::Box` enabled Issue #21798 has been updated by unasuke (Yusuke Nakamura). This is no longer reproducible since Ruby 4.0.6, so I'm closing this. Bisecting on ruby_4_0 shows it was fixed by [99aac00fa1](https://github.com/ruby/ruby/commit/99aac00fa13c03f71d3a4d89686e447f2950df68). Fixed by #21881. ---------------------------------------- Bug #21798: `bundle install` command fails if touches `$LOAD_PATH` on `Ruby::Box` enabled https://bugs.ruby-lang.org/issues/21798#change-118626 * Author: unasuke (Yusuke Nakamura) * Status: Assigned * Assignee: tagomoris (Satoshi Tagomori) * ruby -v: 4.0.0-preview3 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- ## How to reproduce ```dockerfile FROM ruby:4.0.0-preview3-trixie WORKDIR /ruby_box_test RUN bundle gem foo --test=minitest WORKDIR /ruby_box_test/foo RUN head -n 10 foo.gemspec # PASS RUN bundle install # PASS RUN RUBY_BOX=1 bundle install RUN sed --in-place \ --expression='2i lib=File.expand_path("../lib", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)' \ foo.gemspec RUN sed --in-place \ --expression='s/require_relative "lib\/foo\/version"/require "foo\/version"/' \ foo.gemspec RUN head -n 10 foo.gemspec # PASS RUN bundle install # FAIL RUN RUBY_BOX=1 bundle install ``` This script fails. ``` /usr/local/bin/ruby: warning: Ruby::Box is experimental, and the behavior may change in the future! See doc/language/box.md for known issues, etc. [!] There was an error while loading `foo.gemspec`: cannot load such file -- foo/version. Bundler cannot continue. # from /ruby_box_test/foo/foo.gemspec:5 # ------------------------------------------- # > require "foo/version" # # ------------------------------------------- Error: building at STEP "RUN RUBY_BOX=1 bundle install": while running runtime: exit status 14 ``` Head of the gemspec file is this. ```ruby # frozen_string_literal: true lib=File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "foo/version" Gem::Specification.new do |spec| # ..snip.. end ``` # misc I found this behavior when `RUBY_BOX=1 bundle exec rake spec` on `https://github.com/itamae-kitchen/itamae`. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/