107.3. trippy-0.13.0
Network diagnostic combining traceroute and ping, with per-hop loss and jitter
| Version | 0.13.0, release 1 |
| Shelf | net-diag — Network diagnostics, capture, measurement and low-level socket tools |
| Phase | 41_system (System), 782 of 1047 in build order |
| Licence | Apache-2.0 |
| Homepage | https://trippy.rs/ |
| Build time | 4.9 SBU |
| Installed size | 10.0 MiB in 6 files |
| Recipe | ports/core/net-diag/trippy/kpkgbuild |
About
Trippy is a traceroute and ping in one terminal program, trip: it traces the route to a host continuously and shows, for each hop, the loss, latency and jitter. It is built from its Rust vendor bundle with no network.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/net-diag.txt:
Which hop is losing packets and by how much, continuously — the question on a link that works except when it does not. Needs CAP_NET_RAW, granted deliberately rather than shipped setuid.
Sources
trippy-0.13.0.tar.gz(20.1 MiB)
sha25672e598d2e0b947e8bc46706021c511f169b7e7634a734c326e492e0f30725c35
upstream: https://github.com/fujiapple852/trippy/archive/refs/tags/0.13.0.tar.gz
archive copy: sources-3/net-diag--trippy-0.13.0.tar.gztrippy-vendor-0.13.0.tar.xz(23.1 MiB)
sha2569b5cfce1a0df0c3db76da9fb0db5e3f4f502e661d1e3f8b80d6df68b81671fa5
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-3/net-diag--trippy-vendor-0.13.0.tar.xz
Dependencies
Depends on: rust.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install trippy'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-diag/trippy.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/net-diag/trippy
echo '72e598d2e0b947e8bc46706021c511f169b7e7634a734c326e492e0f30725c35 trippy-0.13.0.tar.gz' | sha256sum -c -
echo '9b5cfce1a0df0c3db76da9fb0db5e3f4f502e661d1e3f8b80d6df68b81671fa5 trippy-vendor-0.13.0.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/trippy
SRC=$SRC_ROOT/trippy-0.13.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf trippy-0.13.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline
install -Dm755 target/release/trip $PKG/usr/bin/trip
install -d "$PKG/usr/share/man/man1"
target/release/trip --generate-man > "$PKG/usr/share/man/man1/trip.1"
install -d "$PKG/usr/share/bash-completion/completions" \
"$PKG/usr/share/zsh/site-functions" "$PKG/usr/share/fish/vendor_completions.d"
target/release/trip --generate bash > "$PKG/usr/share/bash-completion/completions/trip"
target/release/trip --generate zsh > "$PKG/usr/share/zsh/site-functions/_trip"
target/release/trip --generate fish > "$PKG/usr/share/fish/vendor_completions.d/trip.fish"
The switches, and why each is set:
--generate-man—tripprints its own manual page, rendered from its command-line definition;build.shruns the program it has just built to writetrip.1. The three--generate bash|zsh|fishruns after it write the shell completions the same way.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/trippy, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf trippy-0.13.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/trippy, and runs the triggers its paths call for.
Contents
Installed programs: trip.
Installed directories: /usr/share/licenses/trippy.
Short descriptions
trip |
A network diagnostic tool |
Notes
trip opens raw sockets, which Linux allows only with CAP_NET_RAW. The package installs it with neither a setuid bit nor a file capability: run it as root, or grant the capability yourself with setcap CAP_NET_RAW+p /usr/bin/trip, which upstream’s privileges guide documents and which trip raises into its effective set itself and drops once the sockets are open. See setuid binaries. Its --unprivileged mode is supported on macOS only, so on KDOS it is not a way round the capability.
A reinstall or upgrade of the package replaces /usr/bin/trip and with it any capability set on the file, so the setcap has to be run again.