Context
GNU Make now has a --shuffle option that simulates non-deterministic ordering of target prerequisites. See https://trofi.github.io/posts/238-new-make-shuffle-mode.html, and also previous work in Debian by Santiago Vila.
While make always processes prerequisites left-to-right when running sequentially, prerequisites can be evaluated in an arbitrary order when building in parallel (make -j). This option is thus useful to trigger and debug issues that occur when building in parallel.
The --shuffle option can take an optional parameter: --shuffle=reverse evaluates prerequisites in reverse order (which is useful when testing packages and reproducing failures); --shuffle=random (the default) uses a random order, that can later be forced using --shuffle=<seed>.
Mass bug filing
Discussion on debian-devel: https://lists.debian.org/debian-devel/2025/05/msg00037.html
another list of bugs filed: https://udd.debian.org/cgi-bin/bts-usertags.cgi?user=lucas%40debian.org&tag=ftbfs-shuffle
How to debug issues
- Build with make --shuffle (make --trace is probably useful as well)
GNUMAKEFLAGS='--shuffle --trace' dpkg-buildpackage
- Or force a --shuffle mode or seed (if you used --shuffle=random, which is the default, previously):
GNUMAKEFLAGS='--shuffle=reverse --trace' dpkg-buildpackage GNUMAKEFLAGS='--shuffle=1847628928 --trace' dpkg-buildpackage
Note that --shuffle is passed to downstream make instances (through the MAKEFLAGS environment variables). It thus detects both bugs in debian/rules and in upstream Makefiles.
Example bugs with patches
https://bugs.debian.org/1104428 (brltty)
https://bugs.debian.org/1104430 (libcache-memcached-fast-perl)
https://bugs.debian.org/1104751 (bedtools)
https://bugs.debian.org/1104756 (swirc)
https://bugs.debian.org/1104757 (flexml)
Known issues
Some packages use bmake (BSD make), that is incompatible with setting GNUMAKEFLAGS to --shuffle. What happens is that GNU Make sets MAKEFLAGS to --shuffle, which bmake does not understand. Affected packages are:
bsdowl csh herisvm libmaa libnbcompat lowdown makefs mk-configure paexec runawk udfclient xidle