Quick and dirty Dockerfile that will build a patched binary and source package for MTR on Ubuntu 24. They still ship a broken version on Ubuntu which does not include the necessary fixes.
You only need Docker and this command:
docker build --rm --output type=local,dest=output/ https://gist.github.com/icedream/f34af692ae6a2d63986f149a9001ca54/raw/Dockerfile
This will automatically fetch the Dockerfile, run it, and output the files to a output/
subdirectory. You can install the packages from there with apt install -y <path-to-deb>
or dpkg -i <path-to-deb>
.
You can also run the embedded comparison test. First mtr call should fail and log, second mtr call should succeed:
docker build --rm --progress plain --target test https://gist.github.com/icedream/f34af692ae6a2d63986f149a9001ca54/raw/Dockerfile
Test should look something like this:
#20 [test 4/7] RUN if mtr -r -m 2 -G 1 -Z 1 -i 1 -c 1 localhost; then echo "does not crash anymore" && exit 1; else echo "yep, crashes, let's replace it"; fi
#20 2.038 *** buffer overflow detected ***: terminated
#20 2.134 Aborted (core dumped)
#20 2.134 yep, crashes, let's replace it
#20 DONE 2.2s
#21 [test 5/7] COPY --from=0 /usr/src/*+icedream.* /var/tmp
#21 DONE 0.1s
#22 [test 6/7] RUN DEBIAN_FRONTEND=noninteractive apt install -y /var/tmp/mtr-tiny*+icedream.*.deb
[...]
#23 [test 7/7] RUN if ! mtr -r -m 2 -G 1 -Z 1 -i 1 -c 1 localhost; then echo "patched version crashes..." && exit 1; else echo "yep, fixed"; fi
#23 2.010 Start: 2024-10-09T14:40:20+0000
#23 2.010 HOST: buildkitsandbox Loss% Snt Last Avg Best Wrst StDev
#23 2.010 1.|-- localhost 0.0% 1 0.0 0.0 0.0 0.0 0.0
#23 2.010 yep, fixed
#23 DONE 2.0s