Skip to content

Pr5449 verify - #59

Closed
Watson1978 wants to merge 6 commits into
masterfrom
pr5449-verify
Closed

Watson1978 wants to merge 6 commits into
masterfrom
pr5449-verify

Conversation

@Watson1978

Copy link
Copy Markdown
Owner

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:

Docs Changes:

Release Note:

Watson1978 and others added 5 commits September 9, 2026 16:14
**Which issue(s) this PR fixes**: 
Fixes #

**What this PR does / why we need it**: 
json 3.0 dropped the positional options argument from `JSON.parse`, so
every call passing `Fluent::DEFAULT_JSON_PARSE_OPTIONS` now fails with
`ArgumentError: wrong number of arguments (given 2, expected 1)`.
Ref. https://github.com/fluent/fluentd/actions/runs/34311091836

Pass the options as keyword arguments instead.

**Docs Changes**:
N/A

**Release Note**: 
* Support json gem v3.x

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
The byte-index path added for the space after the RFC3164 priority mixed
byte offsets with the character offsets used by String#slice. A UTF-8
header carrying a multibyte character was handed to the time parser
instead of being rejected.

Drop that path and check the priority digits on the substring itself,
guard the space_count branch against a truncated header in both the
string and the regexp parser, and search for the subsecond delimiter
from the end of the timestamp.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>

param = if val.is_a?(String)
val.start_with?('{') ? JSON.parse(val, Fluent::DEFAULT_JSON_PARSE_OPTIONS) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]
val.start_with?('{') ? JSON.parse(val, **Fluent::DEFAULT_JSON_PARSE_OPTIONS) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]

param = if val.is_a?(String)
val.start_with?('[') ? JSON.parse(val, Fluent::DEFAULT_JSON_PARSE_OPTIONS) : val.strip.split(/\s*,\s*/)
val.start_with?('[') ? JSON.parse(val, **Fluent::DEFAULT_JSON_PARSE_OPTIONS) : val.strip.split(/\s*,\s*/)
Accepting the boundary space moves the cursor one character forward, so
a record whose timestamp is malformed can line up with the fixed-width
lookup and reach the time parser. The string parser then raised
Fluent::TimeParser::TimeParseError where it used to yield nil, nil.

RFC 3164 asks receivers to be liberal in what they accept and not to
malfunction on malformed messages, and in_tail cannot apply
emit_unmatched_lines once the parser raises. Turn the error back into
the documented nil, nil rejection.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978

Copy link
Copy Markdown
Owner Author

Superseded by the changes pushed directly to fluent#5449.

@Watson1978 Watson1978 closed this Sep 9, 2026
@Watson1978
Watson1978 deleted the pr5449-verify branch September 9, 2026 09:06
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.

3 participants