Backport(v1.19): config: accept empty lines in quoted strings (#5448) - #5478
Merged
Conversation
**Which issue(s) this PR fixes**: Fixes #4691 **What this PR does / why we need it**: The quoted configuration values previously handled a physical line ending together with its preceding character. When the parser was already positioned at a line ending—such as on an empty line or after an escaped literal backslash—it instead reported an unexpected end of file. Handle backslash line continuations and preserved line endings explicitly. This accepts empty lines, preserves LF and CRLF, and retains the existing single-backslash continuation behavior. **Docs Changes**: None. The existing multiline-string documentation already describes the intended behavior. **Release Note**: config: accept empty lines in quoted strings. **Testing**: Automated: - `bundle exec rake test TEST=test/config/test_literal_parser.rb` — 220 tests, 223 assertions, 0 failures, 0 errors - `TEST_ENV_NUMBER=focus4691 bundle exec rake test TEST=test/config/test_config_parser.rb` — 56 tests, 106 assertions, 0 failures, 0 errors - `bundle exec rake test` (two independent runs) — 4,343 tests, 15,829 and 15,830 assertions respectively; 0 failures, 0 errors, 3 pendings, and 36 omissions in both - `rubocop` — 459 files inspected, no offenses - `ruby -c` for all three changed Ruby files and `git diff --check` Manual (Ruby 4.0.6): - Built and separately installed gems from baseline `f380d996bc828b5cd488b578018c06826ebcbf7e` and candidate `7d017869a55e179da4d195806f26d33dc485fc9d`. - The baseline built gem rejected the reproducing configuration with a false unexpected-EOF error; the candidate built gem accepted it with `fluentd --dry-run`; a genuinely unterminated double-quoted value remained rejected. - Ran the candidate built gem as a separate `fluentd --no-supervisor` process through `dummy` → `record_transformer` → `stdout` and externally parsed its emitted JSON as `{"message":"seed","blank":"world\n\n","literal_backslash":"left\\\nright","continued":"leftright"}`. --------- Signed-off-by: Akash Kumar <meakash7902@gmail.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Co-authored-by: Shizuo Fujita <fujita@clear-code.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Watson1978
approved these changes
Aug 31, 2026
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:
Backport #5448
Fixes #4691
What this PR does / why we need it:
The quoted configuration values previously handled a physical line ending together with its preceding character. When the parser was already positioned at a line ending—such as on an empty line or after an escaped literal backslash—it instead reported an unexpected end of file.
Handle backslash line continuations and preserved line endings explicitly. This accepts empty lines, preserves LF and CRLF, and retains the existing single-backslash continuation behavior.
Docs Changes:
None. The existing multiline-string documentation already describes the intended behavior.
Release Note:
config: accept empty lines in quoted strings.
Testing:
Automated:
bundle exec rake test TEST=test/config/test_literal_parser.rb— 220 tests, 223 assertions, 0 failures, 0 errorsTEST_ENV_NUMBER=focus4691 bundle exec rake test TEST=test/config/test_config_parser.rb— 56 tests, 106 assertions, 0 failures, 0 errorsbundle exec rake test(two independent runs) — 4,343 tests, 15,829 and 15,830 assertions respectively; 0 failures, 0 errors, 3 pendings, and 36 omissions in bothrubocop— 459 files inspected, no offensesruby -cfor all three changed Ruby files andgit diff --checkManual (Ruby 4.0.6):
f380d996bc828b5cd488b578018c06826ebcbf7eand candidate7d017869a55e179da4d195806f26d33dc485fc9d.fluentd --dry-run; a genuinely unterminated double-quoted value remained rejected.fluentd --no-supervisorprocess throughdummy→record_transformer→stdoutand externally parsed its emitted JSON as{"message":"seed","blank":"world\n\n","literal_backslash":"left\\\nright","continued":"leftright"}.