gem: add ostruct gem as dependency for Ruby 4.0#461
Merged
kenhys merged 1 commit intofluent:masterfrom Feb 19, 2026
Merged
Conversation
This patch will fix following error:
```
$ bundle exec rake test
/home/watson/.rbenv/versions/4.0.1/bin/ruby -w -I"lib:lib:test" /home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb "test/test_in_s3.rb" "test/test_out_s3.rb"
/home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/fluentd-1.18.0/lib/fluent/plugin_helper.rb:46: warning: method redefined; discarding old inherited
/home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/fluentd-1.18.0/lib/fluent/plugin_helper.rb:46: warning: previous definition of inherited was here
/home/watson/src/fluent-plugin-s3/lib/fluent/plugin/in_s3.rb:7: warning: CGI::Util is removed from Ruby 4.0. Please use cgi/escape instead for CGI.escape and CGI.unescape features.
If you are using CGI.parse, please install and use the cgi gem instead.
/home/watson/src/fluent-plugin-s3/test/test_in_s3.rb:14: warning: ostruct used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0.
You can add ostruct to your Gemfile or gemspec to fix this error.
/home/watson/.rbenv/versions/4.0.1/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- ostruct (LoadError)
Did you mean? tsort
from /home/watson/.rbenv/versions/4.0.1/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/src/fluent-plugin-s3/test/test_in_s3.rb:14:in '<top (required)>'
from /home/watson/.rbenv/versions/4.0.1/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require'
from /home/watson/.rbenv/versions/4.0.1/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:21:in 'block in <main>'
from /home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in 'Array#select'
from /home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in '<main>'
rake aborted!
Command failed with status (1): [ruby -w -I"lib:lib:test" /home/watson/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb "test/test_in_s3.rb" "test/test_out_s3.rb" ]
/home/watson/.rbenv/versions/4.0.1/bin/bundle:25:in '<main>'
Tasks: TOP => test
(See full trace by running task with --trace)
```
We need to specify the ostruct gem as dependency because it is a bundled gem from Ruby 4.0.
Same reason with fluent/fluentd#5249
Ref:
https://github.com/fluent/fluent-plugin-s3/blob/9e5e9e81f9449af466330a298ada50eadc631312/test/test_in_s3.rb#L14
https://github.com/fluent/fluent-plugin-s3/blob/9e5e9e81f9449af466330a298ada50eadc631312/test/test_out_s3.rb#L12
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Contributor
Author
|
Thanks. |
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.
This patch will fix following error:
We need to specify the ostruct gem as dependency because it is a bundled gem from Ruby 4.0.
Same reason with fluent/fluentd#5249
Ref:
fluent-plugin-s3/test/test_in_s3.rb
Line 14 in 9e5e9e8
fluent-plugin-s3/test/test_out_s3.rb
Line 12 in 9e5e9e8