Bug#872729: gtk+2.0: please make the immodules.cache files reproducible

Chris Lamb lamby at debian.org
Sun Aug 20 15:16:06 UTC 2017


Source: gtk+2.0
Version: 2.24.31-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: toolchain filesystemordering
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

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
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
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);
               }
 


More information about the pkg-gnome-maintainers mailing list