Skip to content

install.sh: prefix cross-compile outputs with gopacket-#13

Merged
psycep merged 1 commit intomainfrom
dist-prefix
Apr 22, 2026
Merged

install.sh: prefix cross-compile outputs with gopacket-#13
psycep merged 1 commit intomainfrom
dist-prefix

Conversation

@psycep
Copy link
Copy Markdown
Collaborator

@psycep psycep commented Apr 22, 2026

Summary

Follow-up to #12. The native install already renamed each tool to gopacket-<toolname> before copying to /usr/local/bin, but the portable and windows cross-compile targets dropped raw binaries like ping.exe, net.exe, reg.exe, attrib.exe, services.exe into ./dist/.

Surfaced during the Windows lab smoke test: when the test .bat ran ping -n 1 <target> from the directory where the binaries lived, cmd.exe's PATH resolution picked up the local ping.exe (gopacket's ping tool) before the Windows built-in, producing a confusing [-] Invalid source IPv4 address: -n error.

Changes

  • install.sh applies the same normalization (lowercase, underscores to hyphens) and gopacket- prefix the native install already uses, but at build time for cross-compile targets.
  • Native behavior is unchanged: ./bin/ still gets raw names so install_native can prefix them on copy to INSTALL_DIR.

Before:

./dist/windows/ping.exe
./dist/windows/net.exe
./dist/windows/reg.exe

After:

./dist/windows/gopacket-ping.exe
./dist/windows/gopacket-net.exe
./dist/windows/gopacket-reg.exe

Test plan

  • ./install.sh --target windows --build-only produces 63 gopacket-<tool>.exe files in ./dist/windows/
  • ./install.sh --target portable --build-only produces 63 gopacket-<tool> files in ./dist/portable/
  • ./install.sh --target native --build-only still produces raw names in ./bin/ (install_native renames on copy, unchanged behavior)
  • Collision-prone tools (ping, net, reg, attrib, services, getarch, netview, ping6, registry-read) all come out as gopacket-<name>

The native install already renamed each tool to gopacket-<toolname>
before copying to /usr/local/bin, but the portable and windows cross-
compile targets dropped raw binaries like ping.exe, net.exe, reg.exe,
attrib.exe, services.exe into ./dist/. When a user copies one of those
to a Windows host and runs it from the same directory, cmd.exe's PATH
resolution picks up the local binary before the Windows built-in of
the same name, shadowing tools users rely on. The portable target on
Linux has the same risk for binaries named ping, net, etc.

Applies the same normalization (lowercase, underscores to hyphens)
and gopacket- prefix the native install already uses, but at build
time for the cross-compile targets. Native behavior is unchanged:
./bin/ still gets raw names so install_native can prefix on copy.
@psycep psycep merged commit dd189fb into main Apr 22, 2026
2 checks passed
@psycep psycep deleted the dist-prefix branch April 22, 2026 17:36
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