Skip to content

Fix crash when specifying a state_file in Ruby > 3.2.0 - #144

Merged
ashie merged 2 commits into
fluent:masterfrom
rophy:fix-state-file
Feb 28, 2024
Merged

Fix crash when specifying a state_file in Ruby > 3.2.0#144
ashie merged 2 commits into
fluent:masterfrom
rophy:fix-state-file

Conversation

@rophy

@rophy rophy commented Feb 28, 2024

Copy link
Copy Markdown
Contributor

Issue: the method File.exists() is removed since Ruby 3.2.0, and thus using a state_file will crash newer fluentd versions.
See: https://stackoverflow.com/a/75353113

Note: I am not a ruby developer, I simply copied the original test file and added state_file to it to reproduce the error. Let me know if this is not sufficient as unit tests.

Error: test_message(SqlInputStateFileTest): NoMethodError: undefined method `exists?' for File:Class
/home/kasm-user/fluent-plugin-sql/lib/fluent/plugin/in_sql.rb:285:in `initialize'
/home/kasm-user/fluent-plugin-sql/lib/fluent/plugin/in_sql.rb:186:in `new'
/home/kasm-user/fluent-plugin-sql/lib/fluent/plugin/in_sql.rb:186:in `start'
/home/kasm-user/.rvm/gems/ruby-3.2.2/gems/fluentd-1.16.3/lib/fluent/test/driver/base.rb:120:in `instance_start'
/home/kasm-user/.rvm/gems/ruby-3.2.2/gems/fluentd-1.16.3/lib/fluent/test/driver/base.rb:78:in `run'
/home/kasm-user/.rvm/gems/ruby-3.2.2/gems/fluentd-1.16.3/lib/fluent/test/driver/base_owner.rb:130:in `run'
/home/kasm-user/fluent-plugin-sql/test/plugin/test_in_sql_with_state_file.rb:78:in `test_message'

@ashie

ashie commented Feb 28, 2024

Copy link
Copy Markdown
Member

Thanks for your contribution!
The fix itself seems good.
Could you follow DCO?: https://github.com/fluent/fluent-plugin-sql/pull/144/checks?check_run_id=22075217219

Signed-off-by: Rophy Tsai <rophy@users.noreply.github.com>
Signed-off-by: Rophy Tsai <rophy@users.noreply.github.com>
@rophy

rophy commented Feb 28, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for your contribution! The fix itself seems good. Could you follow DCO?: https://github.com/fluent/fluent-plugin-sql/pull/144/checks?check_run_id=22075217219

done

@ashie

ashie commented Feb 28, 2024

Copy link
Copy Markdown
Member

Note: CI with Ruby head is currently broken like this: fluent/fluentd#4411
I'll tackle on it in another pull request.

@ashie
ashie merged commit c179334 into fluent:master Feb 28, 2024
@ashie

ashie commented Feb 28, 2024

Copy link
Copy Markdown
Member

Merged. Thanks!
I'll release a new version after fixing CI.

@rophy
rophy deleted the fix-state-file branch February 28, 2024 16:28
@ashie

ashie commented Feb 29, 2024

Copy link
Copy Markdown
Member

I've released it as v2.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants