gtk-queryimmodules.c-Make-the-output-deterministic.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From: Chris Lamb <chris@chris-lamb.co.uk>
  2. Date: Fri, 25 Aug 2017 16:24:38 +0100
  3. Subject: gtk/queryimmodules.c: Make the output deterministic.
  4. Whilst working on the Reproducible Builds effort [0], we noticed that
  5. queryimmodules generates non-reproducible output as it iterates over the
  6. filesystem without sorting.
  7. Patch attached.
  8. [0] https://reproducible-builds.org/
  9. Signed-off-by: Chris Lamb <lamby@debian.org>
  10. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=786528
  11. Bug-Debian: https://bugs.debian.org/872729
  12. Applied-upstream: 2.24.33, commit:78c34e11c3021cdf1f2f6beadad9c40c6da76464
  13. ---
  14. gtk/queryimmodules.c | 10 ++++++++--
  15. 1 file changed, 8 insertions(+), 2 deletions(-)
  16. diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
  17. index a91ea47..e87391b 100644
  18. --- a/gtk/queryimmodules.c
  19. +++ b/gtk/queryimmodules.c
  20. @@ -204,13 +204,19 @@ int main (int argc, char **argv)
  21. if (dir)
  22. {
  23. const char *dent;
  24. + GList *list = NULL, *iterator = NULL;
  25. while ((dent = g_dir_read_name (dir)))
  26. + list = g_list_prepend (list, g_strdup (dent));
  27. +
  28. + list = g_list_sort (list, (GCompareFunc) strcmp);
  29. + for (iterator = list; iterator; iterator = iterator->next)
  30. {
  31. - if (g_str_has_suffix (dent, SOEXT))
  32. - error |= query_module (dirs[i], dent, contents);
  33. + if (g_str_has_suffix (iterator->data, SOEXT))
  34. + error |= query_module (dirs[i], iterator->data, contents);
  35. }
  36. + g_list_free_full (list, g_free);
  37. g_dir_close (dir);
  38. }