Skip to content

Config: fix incorrect assignment of kernel version between major and minor#8797

Merged
edsiper merged 1 commit intofluent:masterfrom
thenamehasbeentake:config_kernel_version
May 15, 2024
Merged

Config: fix incorrect assignment of kernel version between major and minor#8797
edsiper merged 1 commit intofluent:masterfrom
thenamehasbeentake:config_kernel_version

Conversation

@thenamehasbeentake
Copy link
Contributor

Config: fix incorrect assignment of kernel version between major and minor


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.

…minor

Signed-off-by: xiaobaowen <xiaobaowen@deeproute.ai>
@patrick-stephens
Copy link
Contributor

We probably should add some simple tests to verify this and prevent future regressions

@thenamehasbeentake
Copy link
Contributor Author

We probably should add some simple tests to verify this and prevent future regressions

This is a simple fix like typo.

Add logs before function flb_config_init return.

--- a/src/flb_config.c
+++ b/src/flb_config.c
@@ -380,7 +380,10 @@ struct flb_config *flb_config_init()
     /* Regex support */
     flb_regex_init();
 #endif
-
+    if (config->kernel) {
+        flb_info("kernel info major: %u, minor: %u, patch: %u",
+                    config->kernel->major, config->kernel->minor, config->kernel->patch);
+    }
     return config;
 }

My env:

root@e5e6538ee184:/fluent-bit/build# uname -r
5.4.0-150-generic

Linux kernels have version numbers in the format x.y.z. x is the major release number, y is the minor revision number, and z is the patch number.

before:

root@e5e6538ee184:/fluent-bit/build# ./bin/fluent-bit   -c  /tmp/fluent-bit-test.yaml
[2024/05/08 08:12:26] [ info] kernel info major: 4, minor: 5, patch: 0

after:

root@e5e6538ee184:/fluent-bit/build# ./bin/fluent-bit   -c  /tmp/fluent-bit-test.yaml
[2024/05/08 08:10:49] [ info] kernel info major: 5, minor: 4, patch: 0

@edsiper
Copy link
Member

edsiper commented May 15, 2024

I cannot believe I introduced that bug 9 years ago! thanks for fixing it!

@edsiper edsiper merged commit d9c3d59 into fluent:master May 15, 2024
markuman pushed a commit to markuman/fluent-bit that referenced this pull request May 29, 2024
…minor (fluent#8797)

Signed-off-by: xiaobaowen <xiaobaowen@deeproute.ai>
Co-authored-by: xiaobaowen <xiaobaowen@deeproute.ai>
Signed-off-by: Markus Bergholz <git@osuv.de>
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