Skip to content

fix(install): robust kernel-version parser in AF_XDP runtime probe#86

Merged
skullcrushercmd merged 1 commit intomainfrom
fix/afxdp-probe-kernel-version-parser
Apr 28, 2026
Merged

fix(install): robust kernel-version parser in AF_XDP runtime probe#86
skullcrushercmd merged 1 commit intomainfrom
fix/afxdp-probe-kernel-version-parser

Conversation

@skullcrushercmd
Copy link
Copy Markdown
Contributor

Summary

probe_afxdp_runtime_available reported "kernel <5.10 or libxdp.so missing" on c6in.metal Debian 13 + kernel 6.12.74 even though both prerequisites were satisfied. The previous parameter-expansion parser silently mishandled some 3-component release shapes (e.g. 6.12.74+deb13+1-amd64); the failure mode reported in PR #65 issuecomment-4339242358 (anygpt-52) was a generic false with no indication of which check fired, leaving the operator to guess.

Fix

  • parse_kernel_major_minor() uses awk -F'[.-]' so 3-component releases like 6.12.74-cloud-amd64, 5.10.0-13-amd64, 6.12.74+deb13+1-amd64, and 5.4.282-rt all parse cleanly. Returns "MAJOR MINOR" on stdout; "0 0" on parse failure.
  • probe_afxdp_runtime_available emits a one-line stderr explanation whenever it returns false so operators can see which check fired ("kernel 4.19 < 5.10", "libxdp.so not in ldconfig -p", "could not parse kernel version"). Quiet on success.
  • apply_afxdp_availability captures the probe stderr and includes the reason in its summary log — replaces the hardcoded "kernel <5.10 or libxdp.so missing" line that was wrong half the time.
  • ANYSCAN_INSTALL_LOAD_ONLY=1 hook lets the unit test source the script without triggering main().

Test plan

  • bash tools/test-install-worker-bundle-afxdp-probe.sh — 21/21 pass
  • bash tools/test-install-worker-bundle-eni-discovery.sh — existing test still green (regression check)
  • parse_kernel_major_minor across 8 release shapes (clean 3-component, +deb13, -cloud-amd64, -rt, 4.x, 2-component, 1-component, empty)
  • probe_afxdp_runtime_available with stubbed uname + ldconfig: c6in.metal 6.12.74 + libxdp → true (the bug 5 repro)
  • Boundary tests at 4.19, 5.9, 5.10, 5.11
  • libxdp.so missing → false + stderr names the missing library
  • Empty/non-numeric uname → false + stderr names parse failure

🤖 Generated with Claude Code

probe_afxdp_runtime_available reported "kernel <5.10 or libxdp.so
missing" on c6in.metal Debian 13 + kernel 6.12.74 even though both
prerequisites were satisfied. The previous parameter-expansion parser
silently mishandled some 3-component release shapes; the failure
mode reported in PR #65 issuecomment-4339242358 (anygpt-52) was a
generic "false" with no indication of which check fired, leaving
the operator to guess.

Fix:

- New parse_kernel_major_minor() helper uses awk -F'[.-]' so 3-
  component releases like 6.12.74-cloud-amd64, 5.10.0-13-amd64,
  6.12.74+deb13+1-amd64, and 5.4.282-rt all parse cleanly. Returns
  "MAJOR MINOR" on stdout, "0 0" on parse failure.

- probe_afxdp_runtime_available emits a one-line stderr explanation
  whenever it returns "false" so the operator can immediately see
  which check fired ("kernel 4.19 < 5.10", "libxdp.so not in
  ldconfig -p", "could not parse kernel version"). Quiet on success.

- apply_afxdp_availability captures the probe stderr and includes
  the reason in its summary log line — replaces the previous
  hardcoded "kernel <5.10 or libxdp.so missing" that was wrong half
  the time.

- ANYSCAN_INSTALL_LOAD_ONLY=1 hook lets unit tests source the script
  for hermetic helper testing without triggering main().

Test (new tools/test-install-worker-bundle-afxdp-probe.sh, 21 cases):

- parse_kernel_major_minor across 8 release shapes (clean 3-component,
  +deb13 suffix, -cloud-amd64 suffix, -rt suffix, 4.x, 2-component,
  1-component, empty).
- probe_afxdp_runtime_available with stubbed uname + ldconfig:
  c6in.metal 6.12.74 + libxdp → true (the bug 5 repro).
  Kernel 4.19 too old → false + stderr names the version.
  Kernel 5.9 vs 5.10 vs 5.11 boundary correctness.
  libxdp.so missing → false + stderr names the missing library.
  Empty/non-numeric uname → false + stderr names parse failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@skullcrushercmd skullcrushercmd merged commit 360c108 into main Apr 28, 2026
@skullcrushercmd skullcrushercmd deleted the fix/afxdp-probe-kernel-version-parser branch April 28, 2026 22:31
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2cffa8eb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread install-worker-bundle.sh
Comment on lines +1112 to +1113
if [ "${ANYSCAN_INSTALL_LOAD_ONLY:-0}" = "1" ]; then
return 0 2>/dev/null || exit 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict test load-only hook to sourced usage

ANYSCAN_INSTALL_LOAD_ONLY=1 now causes the installer to return/exit before main even when the script is executed normally, so a leaked environment variable (for example from a parent shell, CI job, or service environment) turns installation/update into a silent no-op with exit code 0. This hook should only short-circuit when the file is being sourced for tests, otherwise production invocations can skip all install steps.

Useful? React with 👍 / 👎.

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