Actions
Bug #21798
open`bundle install` command fails if touches `$LOAD_PATH` on `Ruby::Box` enabled
Bug #21798:
`bundle install` command fails if touches `$LOAD_PATH` on `Ruby::Box` enabled
Description
How to reproduce¶
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.
# 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.
No data to display
Actions