Skip to content

fix(check-tool-updates): replace GNU-only tac and date -d <RFC> so socat lookup works on macOS - #26

Merged
potiuk merged 1 commit into
mainfrom
fix/check-tool-updates-bsd-date
May 1, 2026
Merged

fix(check-tool-updates): replace GNU-only tac and date -d <RFC> so socat lookup works on macOS#26
potiuk merged 1 commit into
mainfrom
fix/check-tool-updates-bsd-date

Conversation

@potiuk

@potiuk potiuk commented May 1, 2026

Copy link
Copy Markdown
Member

Summary

Two pre-existing GNU-isms in tools/agent-isolation/check-tool-updates.sh's socat upstream-lookup helper broke the script's socat reporting on macOS BSD coreutils. Both surfaced via verify-secure-config reporting upstream lookup failed for socat on the maintainer's macOS host.

  • tac — walks a sorted version list newest-to-oldest. Not in BSD coreutils. Folded into the preceding sort invocation: sort -uV | tacsort -uVr. Identical output, one fewer external binary.
  • date -d "$mtime" — parses the server's Last-Modified header into an epoch. GNU-only; BSD date(1) only accepts -jf <format> for arbitrary parsing and does not understand RFC 2822 / RFC 7231 date strings. Delegated parsing to python3's email.utils.parsedate_to_datetime, which is the stdlib HTTP-date parser and is available everywhere python3 is. Same module is already used elsewhere in this script (the GitHub releases path).

Verified end-to-end on macOS — socat now reports ✓ up to date instead of upstream lookup failed.

Test plan

  • bash -n tools/agent-isolation/check-tool-updates.sh (syntax check) passes.
  • Run end-to-end on macOS — socat row shows ✓ up to date (or upgrade candidate if a newer aged-past-cooldown release exists at run time), not upstream lookup failed.
  • Run end-to-end on Linux too (CI ubuntu-latest) — socat row also resolves; no GNU-only fallback was relied on.
  • prek run --files tools/agent-isolation/check-tool-updates.sh clean.

…o socat lookup works on macOS

Two pre-existing GNU-isms in the socat upstream-lookup helper
broke the script on macOS BSD coreutils:

- `tac` (used to walk a sorted version list newest-to-oldest)
  is not in BSD coreutils. Folded the reversal into the
  preceding `sort` invocation: `sort -uV` + `tac` becomes
  `sort -uVr`. Identical output, no extra binary needed.

- `date -d "$mtime"` (used to parse the server's
  `Last-Modified` HTTP header into an epoch timestamp) is
  GNU-only. BSD `date(1)` accepts only `-jf <format>` for
  arbitrary parsing and does not understand RFC 2822 / RFC 7231
  date strings out of the box. Delegated parsing to python3's
  `email.utils.parsedate_to_datetime`, which is the stdlib
  HTTP-date parser and is available everywhere python3 is.
  Same module is already used elsewhere in this script.

Verified end-to-end on macOS — `socat` now reports
`✓ up to date` instead of `upstream lookup failed (rate limit
/ network)`.

Generated-by: Claude Code (Opus 4.7)
@potiuk
potiuk merged commit a9dbf6a into main May 1, 2026
6 checks passed
@potiuk
potiuk deleted the fix/check-tool-updates-bsd-date branch May 1, 2026 15:38
@andreahlert andreahlert added the mode:platform Substrate / infra — not a mode (sandbox, CI, validators) label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mode:platform Substrate / infra — not a mode (sandbox, CI, validators)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants