From a6add43312b203a0841e8fe793dea98504dcc9c9 Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Thu, 26 Dec 2019 14:23:12 +0900 Subject: [PATCH 1/5] Add ruby 2.7.0 Signed-off-by: Yuta Iwama --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index ce66cd82e2..0ce1a04ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ matrix: dist: xenial - rvm: 2.6.5 os: linux + - rvm: 2.7.0 + os: linux - rvm: ruby-head os: linux - rvm: ruby-head From 0b8527318e9acc103de7d8768b42145a8667f6ea Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Thu, 26 Dec 2019 14:37:47 +0900 Subject: [PATCH 2/5] delete gem update Signed-off-by: Yuta Iwama --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ce1a04ccf..742dd54b60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,9 +59,6 @@ branches: - v0.12 - v0.14 -before_install: - - gem update --system=2.7.8 - sudo: false dist: trusty # for TLSv1.2 support From 44293a575a4d2d348712379011eda93d818b5d4a Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Thu, 26 Dec 2019 14:41:52 +0900 Subject: [PATCH 3/5] relax rake version this should be updated to 13.0 when dropping ruby 2.1 Signed-off-by: Yuta Iwama --- fluentd.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluentd.gemspec b/fluentd.gemspec index 2263821ff2..52ec2f4aaf 100644 --- a/fluentd.gemspec +++ b/fluentd.gemspec @@ -40,7 +40,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency("certstore_c", ["~> 0.1.2"]) end - gem.add_development_dependency("rake", ["~> 11.0"]) + gem.add_development_dependency("rake", ["~> 12.0"]) gem.add_development_dependency("flexmock", ["~> 2.0"]) gem.add_development_dependency("parallel_tests", ["~> 0.15.3"]) gem.add_development_dependency("simplecov", ["~> 0.7"]) From d4705613b52cac75403d9bbf0f308a56585f3642 Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Fri, 27 Dec 2019 12:17:09 +0900 Subject: [PATCH 4/5] replace ruby lex with ripper Signed-off-by: Yuta Iwama --- lib/fluent/config/literal_parser.rb | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/fluent/config/literal_parser.rb b/lib/fluent/config/literal_parser.rb index 3a798cb429..ce9307b3ce 100644 --- a/lib/fluent/config/literal_parser.rb +++ b/lib/fluent/config/literal_parser.rb @@ -19,7 +19,7 @@ require 'json' require 'yajl' require 'socket' -require 'irb/ruby-lex' # RubyLex +require 'ripper' require 'fluent/config/basic_parser' @@ -155,15 +155,20 @@ def scan_nonquoted_string(boundary_charset = LINE_END) end def scan_embedded_code - rlex = RubyLex.new - src = '"#{'+@ss.rest+"\n=end\n}" + src = '"#{'+@ss.rest+"\n=begin\n=end\n}" - input = StringIO.new(src) - input.define_singleton_method(:encoding) { external_encoding } - rlex.set_input(input) + seek = -1 + while (seek = src.index('}', seek + 1)) + unless Ripper.sexp(src[0..seek] + '"').nil? # eager parsing until valid expression + break + end + end + + unless seek + raise Fluent::ConfigParseError, @ss.rest + end - tk = rlex.token - code = src[3,tk.seek-3] + code = src[3, seek-3] if @ss.rest.length < code.length @ss.pos += @ss.rest.length From b4ab3c28c624bc074daebf69bcff8423b2189774 Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Fri, 27 Dec 2019 14:10:20 +0900 Subject: [PATCH 5/5] res.message does not have a space after text since ruby 2.7 Signed-off-by: Yuta Iwama --- lib/fluent/plugin/out_http.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fluent/plugin/out_http.rb b/lib/fluent/plugin/out_http.rb index 4536fa3acd..8c225822ae 100644 --- a/lib/fluent/plugin/out_http.rb +++ b/lib/fluent/plugin/out_http.rb @@ -212,9 +212,9 @@ def send_request(uri, req) end if res.is_a?(Net::HTTPSuccess) - log.debug { "#{res.code} #{res.message}#{res.body}" } + log.debug { "#{res.code} #{res.message.rstrip}#{res.body.lstrip}" } else - msg = "#{res.code} #{res.message}#{res.body}" + msg = "#{res.code} #{res.message.rstrip} #{res.body.lstrip}" if @retryable_response_codes.include?(res.code.to_i) raise RetryableResponse, msg