Bug #20058
closed`warning: bigdecimal/util is found in bigdecimal` even if the gem spec has the `add_dependency "bigdecimal"` entry
Description
warning: bigdecimal/util is found in bigdecimal
warning since https://github.com/ruby/ruby/commit/cc9826503d989df877adbcd94d39a6ff78d0b785
Steps to reproduce¶
foo.rb
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
end
require "active_support"
require "minitest/autorun" # https://github.com/minitest/minitest/commit/5f5c2111f36658fd2636b108b8327ce4b2f3cf8d will resolve `warning: mutex_m was loaded from the standard library,`
# This require will raise `warning: bigdecimal/util is found in bigdecimal`
require "bigdecimal/util"
Expected behavior¶
No warning: bigdecimal/util is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
warnings because Rails has already has add_dependency "bigdecimal"
https://github.com/rails/rails/blob/main/activesupport/activesupport.gemspec#L44
Actual behavior¶
warning: bigdecimal/util is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
appears.
Note: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.
will be addressed by minitest.
$ ruby -v ; ruby foo.rb
ruby 3.3.0dev (2023-12-08T11:25:04Z master cc9826503d) [x86_64-linux]
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-89d8569abe25/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:4: warning: bigdecimal/util is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:3: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.
Run options: --seed 37509
# Running:
Finished in 0.001073s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
$
Updated by hsbt (Hiroshi SHIBATA) 11 months ago
see https://github.com/ruby/ruby/pull/9163#issuecomment-1846994447
It will be resolved with bigdecimal-3.1.5 release.
Updated by yahonda (Yasuo Honda) 11 months ago
Thanks for the update. I wanted bigdecimal
3.1.5 is released because Rails CI fails https://buildkite.com/rails/rails/builds/102621 if any of these warnings appears.
Updated by yahonda (Yasuo Honda) 11 months ago
Confirmed by using the master branch of bigdecimal addresses the warning.
$ ruby -v ; ruby foo.rb
ruby 3.3.0dev (2023-12-08T11:25:04Z master cc9826503d) [x86_64-linux]
Fetching https://github.com/ruby/bigdecimal.git
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:3: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.
"3.1.5"
Run options: --seed 54913
# Running:
Finished in 0.000929s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
$
$ more foo.rb
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails", branch: "main"
gem "bigdecimal", github: "ruby/bigdecimal", branch: "master"
end
require "active_support"
require "minitest/autorun" # https://github.com/minitest/minitest/commit/5f5c2111f36658fd2636b108b8327ce4b2f3cf8d will resolve `warning: mutex_m was loaded from the standard library,`
# This require will raise `warning: bigdecimal/util is found in bigdecimal`
require "bigdecimal/util"
pp BigDecimal::VERSION
Updated by hsbt (Hiroshi SHIBATA) 11 months ago
- Status changed from Open to Assigned
- Assignee set to mrkn (Kenta Murata)
Thank you for confirming that. I keep to open this issue until bigdecimal release.
Updated by deivid (David RodrÃguez) 11 months ago
I'm also trying to improve this in upstream Bundler at https://github.com/rubygems/rubygems/pull/7242.
Updated by hsbt (Hiroshi SHIBATA) 11 months ago
Alternative fix is to specify "bigdecimal", "3.1.4"
into rails dependencies.
Updated by yahonda (Yasuo Honda) 11 months ago
Thanks for the info. Opened https://github.com/rails/rails/pull/50331 to pin the bigdecimal version.
Updated by segiddins (Samuel Giddins) 11 months ago
I also tried to fix with https://github.com/ruby/ruby/pull/9264
Updated by hsbt (Hiroshi SHIBATA) 11 months ago
- Status changed from Assigned to Closed
- Assignee changed from mrkn (Kenta Murata) to hsbt (Hiroshi SHIBATA)
bigdecimal-3.1.5 has been released. This issue was fixed.
@segiddins (Samuel Giddins) Thank you! I confirmed your fix is working with I test with manually bump up bigdecimal-3.1.6 from master HEAD.