Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor - fix analytics_build_info #12354

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

underhood
Copy link
Contributor

@underhood underhood commented Mar 9, 2022

Summary

While doing other stuff (which will use output of this function) I noticed analytics_build_info() will produce wrong output if db-engine is not compiled in.
This fixes it with macro and removes related TODO comment.

Any decent compiler will remove the conditional jump (related to first variable) as its value is known at compile time in every case (conflating it to just the needed buffer_strcat calls without ifs). Sample from gcc:

gdb disassemble
   0x000000000041248b <+79>:    mov    $0x83a475,%esi
   0x0000000000412490 <+84>:    mov    %rbx,%rdi
   0x0000000000412493 <+87>:    call   0x42444c <buffer_strcat>
   0x0000000000412498 <+92>:    mov    $0x83a489,%esi
   0x000000000041249d <+97>:    mov    %rbx,%rdi
   0x00000000004124a0 <+100>:   call   0x42444c <buffer_strcat>
   0x00000000004124a5 <+105>:   mov    $0x83a493,%esi
   0x00000000004124aa <+110>:   mov    %rbx,%rdi
   0x00000000004124ad <+113>:   call   0x42444c <buffer_strcat>
   0x00000000004124b2 <+118>:   mov    $0x83a49b,%esi
   0x00000000004124b7 <+123>:   mov    %rbx,%rdi
   0x00000000004124ba <+126>:   call   0x42444c <buffer_strcat>
   0x00000000004124bf <+131>:   mov    $0x83a4a6,%esi
   0x00000000004124c4 <+136>:   mov    %rbx,%rdi
   0x00000000004124c7 <+139>:   call   0x42444c <buffer_strcat>
   0x00000000004124cc <+144>:   mov    $0x83a4ac,%esi
   0x00000000004124d1 <+149>:   mov    %rbx,%rdi
   0x00000000004124d4 <+152>:   call   0x42444c <buffer_strcat>
   0x00000000004124d9 <+157>:   mov    $0x83a4b2,%esi
   0x00000000004124de <+162>:   mov    %rbx,%rdi
   0x00000000004124e1 <+165>:   call   0x42444c <buffer_strcat>
   0x00000000004124e6 <+170>:   mov    $0x83a4b8,%esi
   0x00000000004124eb <+175>:   mov    %rbx,%rdi
   0x00000000004124ee <+178>:   call   0x42444c <buffer_strcat>
   0x00000000004124f3 <+183>:   mov    $0x83a4d1,%esi
   0x00000000004124f8 <+188>:   mov    %rbx,%rdi
   0x00000000004124fb <+191>:   call   0x42444c <buffer_strcat>
   0x0000000000412500 <+196>:   mov    $0x83a4d7,%esi
   0x0000000000412505 <+201>:   mov    %rbx,%rdi
   0x0000000000412508 <+204>:   call   0x42444c <buffer_strcat>
   0x000000000041250d <+209>:   mov    $0x83a4dd,%esi
   0x0000000000412512 <+214>:   mov    %rbx,%rdi
   0x0000000000412515 <+217>:   call   0x42444c <buffer_strcat>
Test Plan

Build agent without dbengine. Output of curl 127.0.0.1:19999/api/v1/info | jq .buildinfo should not start with |

Before |Native HTTPS|Netdata Cloud..., after Native HTTPS|Netdata Cloud...

Additional Information

@underhood underhood requested review from MrZammler and stelfrag and removed request for vkalintiris March 9, 2022 20:01
@thiagoftsm thiagoftsm self-requested a review March 10, 2022 12:28
Copy link
Contributor

@MrZammler MrZammler left a comment

Choose a reason for hiding this comment

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

Thanks Timo.

@underhood underhood merged commit 4116afa into netdata:master Mar 10, 2022
@underhood underhood deleted the fix_buildinfo_analytics branch March 10, 2022 15:15
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.

None yet

3 participants