Skip to content

fix(make): probe the dev database with /dev/tcp instead of nc - #21

Merged
vthwang merged 1 commit into
mainfrom
nc
Jul 31, 2026
Merged

fix(make): probe the dev database with /dev/tcp instead of nc#21
vthwang merged 1 commit into
mainfrom
nc

Conversation

@geoffturk

Copy link
Copy Markdown
Member

make dev guards on the shared dev database being reachable, so that a missing make forward-db tunnel fails with an instruction rather than a bare "connection refused". The guard used nc -z, which is not installed by default on every distro — Arch among them. Where it is absent the probe fails for the wrong reason and the target refuses to start with the tunnel up and healthy, which reads as a broken port-forward and sends you debugging kubectl.

  • Makefile:56: open a bash /dev/tcp socket instead of shelling out to netcat. No external dependency, and it distinguishes "port closed" from "tool missing" by construction, because there is no tool.

The probe is wrapped in an explicit bash -c rather than left to make's default /bin/sh: /dev/tcp is a bash feature, and on Debian-family systems /bin/sh is dash, which does not have it.

`make dev` guards on the shared dev database being reachable, so that a
missing `make forward-db` tunnel fails with an instruction rather than a
bare "connection refused". The guard used `nc -z`, which is not installed
by default on every distro — Arch among them. Where it is absent the
probe fails for the wrong reason and the target refuses to start with the
tunnel up and healthy, which reads as a broken port-forward and sends you
debugging kubectl.

- `Makefile:56`: open a bash `/dev/tcp` socket instead of shelling out to
  netcat. No external dependency, and it distinguishes "port closed" from
  "tool missing" by construction, because there is no tool.

The probe is wrapped in an explicit `bash -c` rather than left to make's
default `/bin/sh`: `/dev/tcp` is a bash feature, and on Debian-family
systems `/bin/sh` is dash, which does not have it.

Signed-off-by: Geoff Turk <geoff@ic3.dev>
@geoffturk
geoffturk requested a review from vthwang July 31, 2026 09:24
@vthwang
vthwang merged commit 4fb87f0 into main Jul 31, 2026
1 check passed
@vthwang
vthwang deleted the nc branch July 31, 2026 17:09
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.

2 participants