Skip to content

gem: add ostruct gem as dependency for Ruby 4.0#5249

Merged
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:gem
Feb 6, 2026
Merged

gem: add ostruct gem as dependency for Ruby 4.0#5249
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:gem

Conversation

@Watson1978

@Watson1978 Watson1978 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

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.

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>
@Watson1978 Watson1978 changed the title gem: add ostruct gem as dependency gem: add ostruct gem as dependency for Ruby 4.0 Feb 6, 2026
@Watson1978 Watson1978 added this to the v1.20.0 milestone Feb 6, 2026
@Watson1978 Watson1978 added the backport to v1.19 We will backport this fix to the LTS branch label Feb 6, 2026
@Watson1978 Watson1978 marked this pull request as ready for review February 6, 2026 01:36
@Watson1978 Watson1978 requested a review from kenhys February 6, 2026 01:41

@kenhys kenhys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kenhys kenhys merged commit dc7afab into fluent:master Feb 6, 2026
19 of 21 checks passed
@Watson1978 Watson1978 deleted the gem branch February 6, 2026 02:24
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 Watson1978 added the backported "backport to LTS" is done label Feb 9, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport to v1.19 We will backport this fix to the LTS branch backported "backport to LTS" is done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants