Skip to content

Conversation

pwhelan
Copy link
Contributor

@pwhelan pwhelan commented Aug 26, 2025

Summary

Due to how cmake works and how the CMakeLists.txt is designed, one can explicitly enable FLB_UNICODE_ENCODER when FLB_USE_SIMDUTF is disabled. This should not happen often but when it does it will lead to a failed build.

This code should guard against it.


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
    • Prevents mismatched configuration by automatically disabling the Unicode encoder when SIMD UTF support is off, reducing build errors and unexpected behavior. Ensures consistent feature gating across builds.
  • Chores
    • Adds a build-time pre-check with a clear status message explaining when the Unicode encoder is turned off due to missing SIMD UTF support, improving configuration transparency.

… disabled.

Signed-off-by: Phillip Adair Stewart Whelan <[email protected]>
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds a CMake pre-check that automatically disables FLB_UNICODE_ENCODER when FLB_USE_SIMDUTF is not enabled, emitting a status message and short-circuiting encoder configuration. No other logic paths are modified.

Changes

Cohort / File(s) Summary
Build config dependency check
CMakeLists.txt
Inserted conditional: if FLB_UNICODE_ENCODER is ON and FLB_USE_SIMDUTF is OFF, log a STATUS message and set FLB_UNICODE_ENCODER to OFF, preventing inconsistent configuration states.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as Developer
    participant CMake as CMake Configure
    Dev->>CMake: Configure project
    rect rgba(230,246,255,0.6)
    note right of CMake: New pre-check
    CMake->>CMake: Is FLB_UNICODE_ENCODER ON?
    alt Encoder ON
        CMake->>CMake: Is FLB_USE_SIMDUTF ON?
        alt SIMDUTF OFF (new)
            CMake->>CMake: set(FLB_UNICODE_ENCODER OFF)
            CMake-->>Dev: STATUS: Disabling FLB_UNICODE_ENCODER
        else SIMDUTF ON
            CMake->>CMake: Proceed with encoder configuration (unchanged)
        end
    else Encoder OFF
        CMake->>CMake: No action
    end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

docs-required

Poem

A toggle flips in CMake’s warren bright,
Encoder dreams pause without SIMD light.
A STATUS whisper, clear and small,
“Not today, dear bytes,” to one and all.
I thump approval—config neat and tight,
Carrots compiled, dependencies right. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pwhelan-disable-unicode-encoder-without-simdutf

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
CMakeLists.txt (3)

433-440: Good guard; prevents inconsistent config when SIMDUTF is off

This early guard cleanly avoids the build failure scenario by forcing FLB_UNICODE_ENCODER off when FLB_USE_SIMDUTF is disabled. Placement (before coverage flags and the later simdutf block) is correct.

Optional polish:

  • Consider updating the cache entry so CMake-GUI/ccmake reflect the final OFF value, even if the user passed -DFLB_UNICODE_ENCODER=ON. Current set() only overrides in the normal scope and can look confusing in GUIs.
  • Optionally bump the message to WARNING to make CI logs more visible.

Examples:

-    message(STATUS "FLB_USE_SIMDUTF is disabled. Disabling FLB_UNICODE_ENCODER support.")
-    set(FLB_UNICODE_ENCODER OFF)
+    message(WARNING "FLB_USE_SIMDUTF is disabled. Disabling FLB_UNICODE_ENCODER support.")
+    set(FLB_UNICODE_ENCODER OFF CACHE BOOL "Build with Unicode (UTF-16LE, UTF-16BE) encoding support" FORCE)

609-613: Remove unreachable fatal check (dead code)

This inner check can never trigger because the outer condition already requires FLB_USE_SIMDUTF. Simplify to reduce noise:

-if(FLB_UNICODE_ENCODER AND FLB_USE_SIMDUTF)
-  if (NOT FLB_USE_SIMDUTF)
-    message(FATAL_ERROR "FLB_UNICODE_ENCODER requires FLB_USE_SIMDUTF")
-  endif()
+if(FLB_UNICODE_ENCODER AND FLB_USE_SIMDUTF)

163-165: Clarify option help to document dependency

Make the dependency explicit in the option description so users see it immediately in GUIs and cache listings:

-option(FLB_UNICODE_ENCODER     "Build with Unicode (UTF-16LE, UTF-16BE) encoding support" ${FLB_USE_SIMDUTF})
+option(FLB_UNICODE_ENCODER     "Build with Unicode (UTF-16LE/BE) encoding support (requires FLB_USE_SIMDUTF=ON)" ${FLB_USE_SIMDUTF})

If desired, you could also convert this to a dependent option via CMake’s CMakeDependentOption module, but the current guard plus clearer help text is sufficient.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3254b9a and cc76cff.

📒 Files selected for processing (1)
  • CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_COVERAGE=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, gcc, g++)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-centos-7
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-24.04, clang-14)

@pwhelan pwhelan mentioned this pull request Aug 26, 2025
3 tasks
@edsiper edsiper merged commit 2531d64 into master Aug 27, 2025
55 checks passed
@edsiper edsiper deleted the pwhelan-disable-unicode-encoder-without-simdutf branch August 27, 2025 12:54
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.

3 participants