Declare logger as a runtime dependency - #135
Merged
Merged
Conversation
lib/license_acceptance/config.rb requires "logger" and Config#initialize calls
::Logger.new(IO::NULL) on the default path, so logger is a runtime dependency in
practice. It was never declared, which was harmless while logger was a default
gem.
Ruby 4.0 moved logger from a default gem to a bundled gem:
Gem::BUNDLED_GEMS::SINCE["logger"] => "4.0.0"
Gem::Specification.find_all_by_name("logger").first.default_gem? => false
Bundled gems ship with Ruby but are not on the load path of a bundle that does
not ask for them, so under Ruby 4.0 the gem fails to load at all:
before LoadError: cannot load such file -- logger
0 examples, 0 failures, 1 error occurred outside of examples
after 124 examples, 0 failures
Declared without a constraint, matching how ruby/syslog and ruby/rbs handled the
same transition. The logger gem supports well below the gemspec's
required_ruby_version of >= 2.5, so no floor is needed and older rubies keep
resolving the version they already had.
logger is the only require in lib that this affects. date, timeout, forwardable,
fileutils, etc and yaml are all still default gems on 4.0 and stay undeclared.
This is not the current CI failure, which is Security/YAMLLoad under Cookstyle
9.0.0 and is fixed separately. It does break any consumer bundling this gem on
Ruby 4.0, including inspec-core and kitchen-omnibus-chef.
Signed-off-by: Tim Smith <tsmith84@proton.me>
tpowell-progress
force-pushed
the
fix/declare-logger-dependency
branch
from
September 4, 2026 15:24
985b037 to
17be1fc
Compare
tpowell-progress
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
lib/license_acceptance/config.rbrequireslogger, andConfig#initializecalls::Logger.new(IO::NULL)on the default path:So
loggeris a runtime dependency in practice. It was never declared, which was harmless whileloggerwas a default gem.Ruby 4.0 moved
loggerfrom a default gem to a bundled gem:Bundled gems ship with Ruby but are not on the load path of a bundle that doesn't ask for them. Under Ruby 4.0 the gem therefore fails to load at all:
LoadError: cannot load such file -- logger— 0 examples, 1 error outside of examplesScope
loggeris the only require inlib/this affects. I cross-referenced every stdlib require in the gem againstGem::BUNDLED_GEMS::SINCE:loggerdate,timeout,forwardable,fileutils,etc,yamlConstraint
Declared without a version constraint, matching how ruby/syslog and ruby/rbs handled the same transition. The
loggergem supports well below this gemspec'srequired_ruby_version = ">= 2.5", so no floor is needed and older rubies keep resolving the version they already had.Note on CI
This is not the current red CI, which is
Security/YAMLLoadunder Cookstyle 9.0.0 — fixed separately in #134. This PR is branched offmain, so it will show those same 4 pre-existing lint offenses until #134 lands.It does, however, break any consumer bundling this gem on Ruby 4.0 — including
inspec-coreandkitchen-omnibus-chef, both of which depend onlicense-acceptance.