install.sh: prefix cross-compile outputs with gopacket-#13
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 likeping.exe,net.exe,reg.exe,attrib.exe,services.exeinto./dist/.Surfaced during the Windows lab smoke test: when the test
.batranping -n 1 <target>from the directory where the binaries lived,cmd.exe's PATH resolution picked up the localping.exe(gopacket's ping tool) before the Windows built-in, producing a confusing[-] Invalid source IPv4 address: -nerror.Changes
install.shapplies the same normalization (lowercase, underscores to hyphens) andgopacket-prefix the native install already uses, but at build time for cross-compile targets../bin/still gets raw names soinstall_nativecan prefix them on copy toINSTALL_DIR.Before:
After:
Test plan
./install.sh --target windows --build-onlyproduces 63gopacket-<tool>.exefiles in./dist/windows/./install.sh --target portable --build-onlyproduces 63gopacket-<tool>files in./dist/portable/./install.sh --target native --build-onlystill produces raw names in./bin/(install_native renames on copy, unchanged behavior)ping,net,reg,attrib,services,getarch,netview,ping6,registry-read) all come out asgopacket-<name>