Skip to content

Fix test_uds link on 64-bit glibc 2.40+ - #20

Open
stelfrag wants to merge 1 commit into
netdata:mainfrom
stelfrag:fix-uds-eintr-wrap-time64
Open

stelfrag wants to merge 1 commit into
netdata:mainfrom
stelfrag:fix-uds-eintr-wrap-time64

Conversation

@stelfrag

@stelfrag stelfrag commented Nov 24, 2026 •

Copy link
Copy Markdown

Problem

test_uds no longer links on 64-bit glibc 2.40 and later (and 2.39 builds with the stable-branch backport): undefined reference to '__sendmsg64'.
The __sendmsg64 EINTR wrapper in the test fixture was guarded on __USE_TIME_BITS64, which glibc now also defines on 64-bit targets, where libc has no __sendmsg64.
Since the Linux CI runners moved to Ubuntu 26.04, this fails the Runtime Safety, CodeQL (C/C++ POSIX) and Codacy Coverage jobs on main; the same failure blocks #19.

Change

  • The wrapper is guarded on defined(__GLIBC__) && defined(__USE_TIME_BITS64) && __TIMESIZE == 32, the condition glibc itself uses to redirect sendmsg to __sendmsg64; it also works with headers older than glibc's __USE_TIME64_REDIRECTS macro.
  • Test fixture only; no library code changes. SOW-0074 records the analysis.

Compatibility

  • 64-bit glibc builds no longer compile the wrapper; they never reference __sendmsg64.
  • 32-bit builds with legacy 32-bit time_t already omitted it and are unchanged.
  • glibc ABIs with a default 32-bit time_t built with _TIME_BITS=64 still compile it and still intercept the redirected call.

Testing

  • x86_64 glibc 2.41: test_uds failed to link before; it links and passes after, and CTest passes 32/32.
  • i386 glibc with _FILE_OFFSET_BITS=64 _TIME_BITS=64: the library references __sendmsg64, the wrapper intercepts it, the EINTR injection checks pass, and CTest passes 14/14.
  • i386 glibc with legacy time_t: CTest passes 14/14.
  • armv7-gnu-time64 and aarch64-gnu are covered by the PR's Linux target CI jobs.

Summary by cubic

Fixes the test_uds link failure on 64-bit glibc 2.40+, where the __sendmsg64 EINTR wrapper was built even though libc exports no such symbol.

  • The wrapper was guarded on __USE_TIME_BITS64, which glibc 2.40+ also sets on 64-bit targets; the guard now matches glibc's own redirect condition (__TIMESIZE == 32).
  • Test fixture only, no library changes; 32-bit _TIME_BITS=64 builds still intercept the redirected call.
  • Adds the SOW-0074 record documenting the analysis and validation.

Written for commit bfd4f66. Summary will update on new commits.

View guided diff

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a test link failure on newer glibc versions while preserving the expected behavior for 32-bit time64 and legacy builds.
  • Documentation
    • Added notes on the issue, expected behavior, and validation across supported configurations.

The __sendmsg64 EINTR wrapper was guarded on __USE_TIME_BITS64, which
glibc 2.40 also defines on 64-bit targets, where libc has no
__sendmsg64. Guard it on the condition glibc uses for its sendmsg
redirect instead.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The __sendmsg64 wrapper guard now requires glibc, __USE_TIME_BITS64, and __TIMESIZE == 32. A completed SOW records the change, acceptance criteria, and validation results.

Changes: UDS wrapper guard

Layer / File(s) Summary
Wrapper guard and validation record
tests/fixtures/c/uds_eintr_wrap.c, .agents/sow/done/SOW-0074-20261124-uds-eintr-wrap-glibc-time64.md
The __sendmsg64 wrapper condition now also requires __TIMESIZE == 32. The SOW documents the guard and validation evidence.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ktsaou

Merge Risk: Minimal · up to bfd4f

This change fixes a test link failure on 64-bit glibc 2.40+ and affects only a test fixture, with no library behavior change. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a fix for the test_uds link failure on 64-bit glibc 2.40+. The raw summary and objectives confirm the change narrows the __sendmsg64 wrapper guard in the test fixture …
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.
Full details: Title check

Explanation

The title names the main change: a fix for the test_uds link failure on 64-bit glibc 2.40+. The raw summary and objectives confirm the change narrows the __sendmsg64 wrapper guard in the test fixture to glibc, __USE_TIME_BITS64, and __TIMESIZE == 32, which avoids an unresolved reference on 64-bit targets. The title is specific and concise, and it does not describe anything absent from the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e1d2212b-51e6-4636-9dc2-cd90f88bc660
Commits

Reviewing files that changed from the base of the PR and between 1ff116f and bfd4f66.

Files selected for processing: 2

  • .agents/sow/done/SOW-0074-20261124-uds-eintr-wrap-glibc-time64.md
  • tests/fixtures/c/uds_eintr_wrap.c

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@stelfrag
stelfrag marked this pull request as ready for review November 25, 2026 08:24
@stelfrag
stelfrag requested a review from ktsaou November 25, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant