Skip to content

Backport(v1.19): config: accept empty lines in quoted strings (#5448) - #5478

Merged
Watson1978 merged 1 commit into
v1.19from
backport-to-v1.19/pr5448
Aug 31, 2026
Merged

Backport(v1.19): config: accept empty lines in quoted strings (#5448)#5478
Watson1978 merged 1 commit into
v1.19from
backport-to-v1.19/pr5448

Conversation

@github-actions

Copy link
Copy Markdown

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 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 dummyrecord_transformerstdout and externally parsed its emitted JSON as {"message":"seed","blank":"world\n\n","literal_backslash":"left\\\nright","continued":"leftright"}.

**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 Watson1978 added this to the v1.19.4 milestone Aug 31, 2026
@Watson1978
Watson1978 merged commit ee0d6af into v1.19 Aug 31, 2026
36 of 37 checks passed
@Watson1978
Watson1978 deleted the backport-to-v1.19/pr5448 branch August 31, 2026 07:32
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