Source: gtk+2.0
Version: 2.24.31-2
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: toolchain filesystemordering
X-Debbugs-Cc: [email protected]
Hi,
Whilst working on the Reproducible Builds effort [0], we noticed that
queryimmodules generates non-reproducible output as it iterates over the
filesystem without sorting.
Patch attached.
[0] https://reproducible-builds.org/
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
index a91ea47..c6a7558 100644
--- a/gtk/queryimmodules.c
+++ b/gtk/queryimmodules.c
@@ -204,13 +204,19 @@ int main (int argc, char **argv)
if (dir)
{
const char *dent;
+ GSList *list = NULL, *iterator = NULL;
while ((dent = g_dir_read_name (dir)))
+ list = g_slist_prepend (list, g_strdup (dent));
+
+ list = g_slist_sort (list, (GCompareFunc) strcmp);
+ for (iterator = list; iterator; iterator = iterator->next)
{
- if (g_str_has_suffix (dent, SOEXT))
- error |= query_module (dirs[i], dent, contents);
+ if (g_str_has_suffix (iterator->data, SOEXT))
+ error |= query_module (dirs[i], iterator->data,
contents);
}
+ g_slist_free (list);
g_dir_close (dir);
}