bin/182098: [patch] Change kldxref fts_open ordering so it produces a consistent linker.hints between machines of the same architecture.
jilles at stack.nl
Sun Sep 15 22:50:02 UTC 2013
The following reply was made to PR bin/182098; it has been noted by GNATS.
From: Jilles Tjoelker <jilles at stack.nl>
To: bug-followup at FreeBSD.org, dereks at lifeofadishwasher.com
Subject: Re: bin/182098: [patch] Change kldxref fts_open ordering so it
produces a consistent linker.hints between machines of the same
Date: Mon, 16 Sep 2013 00:39:58 +0200
In PR bin/182098, you wrote:
> Currently there an issue with linker.hints being different between
> machines that create binary update for freebsd-update.
> 'kldxref /boot/kernel/' will produce different linker.hints due to the
> way the fts_open() traverses the file system:
In the interest of reproducible builds, your patch seems a good idea. It
seems unattractive to run kldxref /boot/kernel on every machine.
The implementation of compare() seems unnecessarily complex though. In
find -s, the fts_names are simply passed to strcoll() (here, strcmp()
would be better). The trickery with the length may cause inconsistent
results if one filename is a prefix of another (rare).
This change may also expose a latent bug with kldxref -R: it does not
work properly if a directory contains both files that need a mention in
a hints file and subdirectories, and at least one such file appears
after a subdirectory. Because your change alters the traversal order, it
might break a use of kldxref -R that previously happened to work. You
can make it work reliably by sorting FTS_D entries after other entries.
More information about the freebsd-bugs