fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

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

Open thenamehasbeentake opened this issue 1 year ago • 2 comments

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.

thenamehasbeentake avatar May 06 '24 10:05 thenamehasbeentake

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

patrick-stephens avatar May 07 '24 12:05 patrick-stephens

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

thenamehasbeentake avatar May 08 '24 08:05 thenamehasbeentake

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

edsiper avatar May 15 '24 14:05 edsiper