If building your software requires processing several inputs at once, make sure the order is stable across builds.
A typical example is creating an archive from the content of a directory. Most filesystems do not guarantee that listing files in a directory will always result in the same order.
Makefile will result in unreproducible
a) List all inputs explicitly and ensure they will be processed in that order.
b) Sort inputs:
Watch out for locale-related issues
When sorting inputs, one must ensure that the sorting order is not affected by the system locale settings. Some locales will not distinguish between uppercase and lowercase characters.
tar will by default use the filesystem order when
A solution is to use
sort but the following might still
have differences when run under different locales:
The locale used to sort files must be specified to avoid any surprises:
This might not be the only change required for Tar and other archive formats as they usually embed more metadata problems.