Skip to content

Linux: twcore release builds, Linux CI, NIC list skips unplugged interfaces and ranks physical first - #170

Merged
fylorn merged 2 commits into
mainfrom
linux/release-nics
Sep 24, 2026
Merged

fylorn merged 2 commits into
mainfrom
linux/release-nics

Conversation

@fylorn

@fylorn fylorn commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Part of Linux support for ThinkWatch Lite.

Release (release.yml)

  • New twcore-linux matrix: x86_64-unknown-linux-gnu on ubuntu-22.04, aarch64-unknown-linux-gnu on ubuntu-22.04-arm (both native; the arm64 runner label is listed for public repos in GitHub's hosted-runner reference).
  • Self-check like macOS: file must show the right architecture, --version must match the tag, and the highest GLIBC_x.y symbol version from objdump -T must be ≤ 2.35 (Ubuntu 22.04, the desktop app's floor). Guards against a runner image bump silently raising the glibc requirement.
  • Assets twcore-<triple> + twcore-<triple>.sha256 (<sha> <name>), same as the other platforms.
  • glibc rather than musl static: the desktop app needs glibc 2.35+ anyway; the reasons are in the workflow comment.
  • Rehearsal run (workflow_dispatch on this branch, publishes nothing): see comment below.

CI (ci.yml)

  • New linux job on ubuntu-22.04: clippy, cargo test --workspace, and scripts/smoke.sh.
  • smoke.sh: ask GNU stat -c first; BSD stat -f '%Lp' means "filesystem status" on GNU and still exits 0, so the old fallback order never fell back. Honours CARGO_TARGET_DIR.

NICs (tw-config/src/nics.rs)

  • list() now requires IFF_UP | IFF_RUNNING: an unplugged NIC, a disconnected Wi-Fi, or an idle docker0/br-* (up, has an address, no carrier) no longer appears. getifaddrs on glibc and macOS copies the link's flags onto each address entry, so the per-address check is a per-interface check.
  • Sort key gains "physical": on Linux an interface is physical when /sys/class/net/<name>/device exists. Virtual ones (docker0, br-*, veth*, virbr*, tailscale0, wg*, tun*) are still listed, after physical ones; loopback stays last. macOS and Windows treat every interface as physical, so their order is unchanged (verified on a Mac: list()/by_name() output identical before/after).
  • exists() is unchanged.
  • Message code change: gw.listen.nic_no_addr → gw.listen.nic_offline ("Interface {name} is not connected right now. Check the cable or the Wi-Fi connection."). A disconnected interface often still has an address, so "has no address" became wrong once IFF_RUNNING filters it. BindError::NicHasNoAddr → BindError::NicOffline. Lite needs the translation for the new code.

Other cfg(unix) audit (outside tw-adopt)

  • lockfile test used pid 999999 as "cannot exist"; Linux pid_max is 4194304 under systemd, so it now spawns and reaps a child and uses that pid.
  • --parent watcher: already compares the original pid via kill(pid, 0), never getppid(), so reparenting to systemd --user (a subreaper, not pid 1) is fine; comment updated to say so.
  • Everything else (private_dir, store/history/blobs/db modes, control socket, SUN_PATH_MAX = min(104, 108), SIGTERM, HOME) holds on Linux as written.

🤖 Generated with Claude Code

@fylorn

fylorn commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Release rehearsal (workflow_dispatch on this branch, nothing published): https://github.com/ThinkWatchProject/ThinkWatch-Core/actions/runs/35974388792 — all four jobs green. Both Linux binaries: file shows the right arch (x86-64 / ARM aarch64), --version 0.42.0, highest glibc symbol version needed: 2.34 (limit 2.35).

fylorn and others added 2 commits September 24, 2026 18:33
…s unplugged and virtual-first interfaces

- release.yml: build twcore natively for x86_64-unknown-linux-gnu
  (ubuntu-22.04) and aarch64-unknown-linux-gnu (ubuntu-22.04-arm); check the
  architecture with `file`, the version against the tag, and fail if the
  binary needs a glibc newer than 2.35. Same asset and .sha256 naming as the
  other platforms. glibc, not musl: the desktop app needs glibc 2.35 anyway.
- ci.yml: an ubuntu-22.04 job running clippy, the workspace tests and the
  smoke script. smoke.sh now asks GNU stat first (BSD `stat -f` means
  something else on GNU and still exits 0) and honours CARGO_TARGET_DIR.
- nics: list only interfaces that are up *and* running (IFF_RUNNING), so an
  unplugged NIC or an idle docker0/br-* no longer shows up; on Linux,
  interfaces backed by a device (/sys/class/net/<name>/device) sort before
  virtual ones. exists() is unchanged.
- A bound interface that is present but unusable now reports
  gw.listen.nic_offline ("is not connected right now") instead of
  gw.listen.nic_no_addr: a disconnected interface often still has an
  address.
- lockfile test no longer assumes pid 999999 cannot exist (Linux pid_max is
  4194304 under systemd); the --parent watcher comment covers
  systemd --user as the subreaper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its handler writes the headers and the body in two small sends; with Nagle
the body waits for the ACK of the headers, and Linux delays that ACK by
40ms on a pooled connection, so every request through the gateway looked
40ms slower on the Linux runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 97ff2c9 into main Sep 24, 2026
4 checks passed
@fylorn
fylorn deleted the linux/release-nics branch September 24, 2026 10:43
@fylorn fylorn mentioned this pull request Sep 24, 2026
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