gem: add ostruct gem as dependency for Ruby 4.0#5249
Merged
Conversation
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
I501307
approved these changes
Feb 6, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Feb 8, 2026
**Which issue(s) this PR fixes**: Fixes # **What this PR does / why we need it**: We need to specify the `ostruct` gem as dependency because it is a bundled gem from Ruby 4.0. https://github.com/ruby/ruby/blob/e4dd078a2734f1f3b7169feb4da8c68587effc6e/gems/bundled_gems#L38 This PR will fix following error. ``` /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- ostruct (LoadError) Did you mean? tsort from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require' from /home/runner/work/fluentd/fluentd/lib/fluent/plugin/filter_record_transformer.rb:19:in '<top (required)>' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require' from /home/runner/work/fluentd/fluentd/test/plugin/test_filter_record_transformer.rb:4:in '<top (required)>' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:21:in 'block in <main>' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in 'Array#select' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in '<main>' rake aborted! ``` https://github.com/fluent/fluentd/actions/runs/21718510028/job/62697972725?pr=5239#step:6:22 Ref. https://github.com/fluent/fluentd/blob/82acf75ad6da7c43797bcb8dedcde5570ad15242/lib/fluent/plugin/filter_record_transformer.rb#L19 **Docs Changes**: N/A **Release Note**: * gem: add ostruct gem as dependency for Ruby 4.0 Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Watson1978
added a commit
that referenced
this pull request
Feb 9, 2026
…) (#5251) **Which issue(s) this PR fixes**: Backport #5249 Fixes # **What this PR does / why we need it**: We need to specify the `ostruct` gem as dependency because it is a bundled gem from Ruby 4.0. https://github.com/ruby/ruby/blob/e4dd078a2734f1f3b7169feb4da8c68587effc6e/gems/bundled_gems#L38 This PR will fix following error. ``` /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- ostruct (LoadError) Did you mean? tsort from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require' from /home/runner/work/fluentd/fluentd/lib/fluent/plugin/filter_record_transformer.rb:19:in '<top (required)>' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require' from /home/runner/work/fluentd/fluentd/test/plugin/test_filter_record_transformer.rb:4:in '<top (required)>' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:21:in 'block in <main>' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in 'Array#select' from /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in '<main>' rake aborted! ``` https://github.com/fluent/fluentd/actions/runs/21718510028/job/62697972725?pr=5239#step:6:22 Ref. https://github.com/fluent/fluentd/blob/82acf75ad6da7c43797bcb8dedcde5570ad15242/lib/fluent/plugin/filter_record_transformer.rb#L19 **Docs Changes**: N/A **Release Note**: * gem: add ostruct gem as dependency for Ruby 4.0 Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Shizuo Fujita <fujita@clear-code.com>
Watson1978
added a commit
to Watson1978/fluent-plugin-s3
that referenced
this pull request
Feb 19, 2026
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>
kenhys
pushed a commit
to fluent/fluent-plugin-s3
that referenced
this pull request
Feb 19, 2026
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>
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.
Which issue(s) this PR fixes:
Fixes #
What this PR does / why we need it:
We need to specify the
ostructgem as dependency because it is a bundled gem from Ruby 4.0.https://github.com/ruby/ruby/blob/e4dd078a2734f1f3b7169feb4da8c68587effc6e/gems/bundled_gems#L38
This PR will fix following error.
https://github.com/fluent/fluentd/actions/runs/21718510028/job/62697972725?pr=5239#step:6:22
Ref.
fluentd/lib/fluent/plugin/filter_record_transformer.rb
Line 19 in 82acf75
Docs Changes:
N/A
Release Note: