Skip to content

Catch alternating errors on MacOS/BSD#47

Open
AivanF wants to merge 1 commit into
denilsonsa:masterfrom
AivanF:master
Open

Catch alternating errors on MacOS/BSD#47
AivanF wants to merge 1 commit into
denilsonsa:masterfrom
AivanF:master

Conversation

@AivanF

@AivanF AivanF commented May 17, 2026

Copy link
Copy Markdown

On MacOS (and other BSDs), when the local network is down ping emits a ping: sendto: <reason> line on stderr immediately, then the matching Request timeout for icmp_seq N once it gives up — one pair per failed packet. The timeout line is already accounted for as a lost packet, but each sendto line falls through to the generic "other line" handler and clutters the output:

  • the 1:1 interleaving with Request timeout breaks the existing "Last message repeated N times" dedup,
  • different sendto reasons ("Network is down", "No route to host", "Host is down", ...) count as distinct lines and each gets printed at least once,
  • every such line triggers other_line_is_printed(), which moves the cursor past the stats and disrupts the live dots layout.

This adds an early branch in the awk main loop that silently drops lines matching ^ping: send(to|msg): /, mirroring the existing filters for blank lines and httping's error shutting down ssl noise. Packet-loss accounting is unchanged: the matching Request timeout still increments the counters and prints !.

Linux's iputils ping does not emit ping: sendto: / sendmsg: prefixed lines during the steady-state ping loop, so this is a no-op there. mockping.sh has been extended with an interleaved sendto/timeout block plus a recovery ping to exercise the path.

On MacOS (and other BSDs), when the local network is down `ping`
emits a `ping: sendto: <reason>` line on stderr immediately, then
the matching `Request timeout for icmp_seq N` once it gives up —
one pair per failed packet. The timeout line is already accounted
for as a lost packet, but each `sendto` line falls through to the
generic "other line" handler and clutters the output:

  - the 1:1 interleaving with `Request timeout` breaks the existing
    "Last message repeated N times" dedup,
  - different sendto reasons ("Network is down", "No route to host",
    "Host is down", ...) count as distinct lines and each gets
    printed at least once,
  - every such line triggers `other_line_is_printed()`, which moves
    the cursor past the stats and disrupts the live dots layout.

This adds an early branch in the awk main loop that silently drops
lines matching `^ping: send(to|msg): /`, mirroring the existing
filters for blank lines and httping's `error shutting down ssl`
noise. Packet-loss accounting is unchanged: the matching
`Request timeout` still increments the counters and prints `!`.

Linux's iputils `ping` does not emit `ping: sendto:` / `sendmsg:`
prefixed lines during the steady-state ping loop, so this is a
no-op there. `mockping.sh` has been extended with an interleaved
sendto/timeout block plus a recovery ping to exercise the path.
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