Skip to content

fix(linux-host): read Wi-Fi devices from sysfs without find - #176

Merged
Mearman merged 1 commit into
mainfrom
fix/wifi-device-probe-sysfs-loop
Nov 3, 2026
Merged

Mearman merged 1 commit into
mainfrom
fix/wifi-device-probe-sysfs-loop

Conversation

@Mearman

@Mearman Mearman commented Nov 3, 2026

Copy link
Copy Markdown
Member

The networkd path from #174 read Wi-Fi interfaces with find -L /sys/class/net -mindepth 2 -maxdepth 2 -name phy80211. On a real sysfs each /sys/class/net/<name> links to a device directory with a subsystem link back to the class directory, so GNU find follows it, prints the match, reports "File system loop detected" and exits 1. The task has no failed_when, so the play failed on the i5.

The probe is now a shell glob (for phy in "$1"/*/phy80211), skipping the unmatched literal with [ -e ], so there is nothing to loop and a host without Wi-Fi gives empty output and exit 0. It is the only place in the roles, plugins or tests that walks sysfs with find; the others (stat/cat on fixed paths) do not traverse.

The test sysfs was flat directories, which is why the stand-in hid it. It is now a real tree with the real symlinks, read by the real shell. Before: with GNU find first on PATH, test_wifi_power_save_under_networkd_is_a_udev_rule_a_unit_iw_and_the_radio_now fails on the old task with find: File system loop detected and rc 1 (macOS's BSD find does not fail, so it only fails here with GNU find on PATH; CI's Ubuntu runner has it). After: all 90 test_linux_host tests pass with GNU find first on PATH.

The kernel probe ran `find -L` over /sys/class/net. Each entry there is
a symlink to a device directory whose `subsystem` link points back at
the class directory, so GNU find follows it, reports a file system loop
and exits 1 after printing its matches, which failed the play on a real
host.

A shell glob over `<dir>/*/phy80211` has no traversal to loop and exits 0
with no output when no interface has a phy.

The test sysfs is now a real directory tree with the same symlinks
(class entry -> device directory holding phy80211 and a subsystem link
back), read by the real shell, so a find that follows links fails it.
@Mearman
Mearman marked this pull request as ready for review November 3, 2026 00:41
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-11-03T00:41:50.040491Z
We couldn’t complete this review. Comment @codex security review to try again.
4c01e44 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@Mearman
Mearman merged commit 65dc685 into main Nov 3, 2026
14 checks passed
@Mearman
Mearman deleted the fix/wifi-device-probe-sysfs-loop branch November 3, 2026 00:42
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.20.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant