Skip to content

tests: runtime: Handle byte order mark for non-ASCII environment of Windows correctly#12100

Open
cosmo0920 wants to merge 2 commits into
masterfrom
cosmo0920-save-in_tail-test-case-with-bom
Open

tests: runtime: Handle byte order mark for non-ASCII environment of Windows correctly#12100
cosmo0920 wants to merge 2 commits into
masterfrom
cosmo0920-save-in_tail-test-case-with-bom

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Especially, cp932 Windows causes compilation failure without appropriate BOM handlings on in_tail and out_syslog runtime tests.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of files that begin with a UTF-8 byte order mark (BOM), ensuring the initial mode comment is recognized correctly.
  • Tests

    • Updated RFC5424 syslog formatter expectations to avoid embedding an invisible UTF-8 BOM directly in string literals, improving test reliability across severity, facility, hostname, appname, procid, msgid, and structured data cases.

…f Windows

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Runtime tests now add a UTF-8 BOM prefix to one source comment and represent BOM bytes explicitly in RFC5424 syslog expected strings using a shared macro.

Changes

UTF-8 BOM test updates

Layer / File(s) Summary
Make RFC5424 BOM expectations explicit
tests/runtime/out_syslog.c
Defines UTF8_BOM and uses it across RFC5424 syslog expected strings.
Add BOM to test source comment
tests/runtime/in_tail.c
Adds a UTF-8 BOM prefix to the file’s leading comment.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: edsiper

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding BOM handling for Windows runtime tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-save-in_tail-test-case-with-bom

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/runtime/out_syslog.c`:
- Line 1453: Split the oversized RFC5424 expected string literals near the
affected assertions into adjacent C string literals on multiple lines, including
the occurrences around the referenced expectations. Preserve exact compile-time
concatenation and expected values while keeping each source line within the
project’s 120-character limit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f8237e25-052b-4367-bcc1-461a9418f430

📥 Commits

Reviewing files that changed from the base of the PR and between a4ad88f and bd56507.

📒 Files selected for processing (1)
  • tests/runtime/out_syslog.c


char *expected_strs[] = {"hello world", "1970-01-01T00:00:01.000000Z",
"<14>1 1970-01-01T00:00:01.000000Z - - - - [sd_key logtype=\"access\" clustername=\"mycluster\" namespace=\"mynamespace\"] hello world"};
"<14>1 1970-01-01T00:00:01.000000Z - - - - [sd_key logtype=\"access\" clustername=\"mycluster\" namespace=\"mynamespace\"] " UTF8_BOM "hello world"};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Split the oversized expected strings.

These RFC5424 expectations exceed 120 characters. Split them into adjacent C string literals across multiple lines; compile-time concatenation preserves the exact expected value while following the project’s line-length guideline.

As per coding guidelines, C/C++ lines should target 100 characters and avoid exceeding 120 where avoidable.

Also applies to: 1509-1509, 1566-1566

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/runtime/out_syslog.c` at line 1453, Split the oversized RFC5424
expected string literals near the affected assertions into adjacent C string
literals on multiple lines, including the occurrences around the referenced
expectations. Preserve exact compile-time concatenation and expected values
while keeping each source line within the project’s 120-character limit.

Source: Coding guidelines

@cosmo0920 cosmo0920 changed the title tests: runtime: Save with byte order mark for non-ASCII environment of Windows tests: runtime: Handle byte order mark for non-ASCII environment of Windows correctly Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant