Bug#873625: glib2.0: please make the output of gio-querymodules reproducible

Chris Lamb lamby at debian.org
Tue Aug 29 15:51:10 UTC 2017


Source: glib2.0
Version: 2.53.6-1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: fileordering
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that glib2.0 generates output that is not reproducible due to
inheriting the underlying filesystem ordering.

Patch attached.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/gio/gio-querymodules.c b/gio/gio-querymodules.c
index 667336a..cb92662 100644
--- a/gio/gio-querymodules.c
+++ b/gio/gio-querymodules.c
@@ -42,6 +42,7 @@ query_dir (const char *dirname)
 {
   GString *data;
   GDir *dir;
+  GList *list = NULL, *iterator = NULL;
   const char *name;
   char *cachename;
   char **(* query)  (void);
@@ -63,11 +64,16 @@ query_dir (const char *dirname)
   data = g_string_new ("");
 
   while ((name = g_dir_read_name (dir)))
+    list = g_list_prepend (list, g_strdup (name));
+
+  list = g_list_sort (list, (GCompareFunc) g_strcmp0);
+  for (iterator = list; iterator; iterator = iterator->next)
     {
       GModule *module;
       gchar     *path;
       char **extension_points;
 
+      name = iterator->data;
       if (!is_valid_module_name (name))
 	continue;
 
@@ -80,6 +86,7 @@ query_dir (const char *dirname)
 	  g_module_symbol (module, "g_io_module_query", (gpointer) &query);
 
 	  if (query)
+      printf("------------------------------------------------ %s\n", name);
 	    {
 	      extension_points = query ();
 
@@ -100,6 +107,7 @@ query_dir (const char *dirname)
     }
 
   g_dir_close (dir);
+  g_list_free_full (list, g_free);
 
   cachename = g_build_filename (dirname, "giomodule.cache", NULL);
 


More information about the pkg-gnome-maintainers mailing list