Source: liblucy-perl
Version: 0.3.3-6
Severity: wishlist
Tags: patch fileordering
User: reproducible-builds@lists.alioth.debian.org
Usertags: fileordering
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that liblucy-perl could not be built reproducibly.
The class hierarchy in Autobinding.pm is not sorted, which also causes
generated C files to be unreproducible.

The attached patch fixes this by sorting the file list retrieved by the
S_find_cfh function.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible2.patch b/debian/patches/reproducible2.patch
new file mode 100644
index 0000000..12f8866
--- /dev/null
+++ b/debian/patches/reproducible2.patch
@@ -0,0 +1,30 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Sort list of files searched by S_find_cfh in readdir order
+
+--- a/clownfish/src/CFCHierarchy.c
++++ b/clownfish/src/CFCHierarchy.c
+@@ -115,6 +115,16 @@
+     }
+ }
+ 
++/* From qsort(3) */
++static int cmpstringp(const void *p1, const void *p2)
++{
++    /* The actual arguments to this function are "pointers to
++     * pointers to char", but strcmp(3) arguments are "pointers
++     * to char", hence the following cast plus dereference */
++
++    return strcmp(* (char * const *) p1, * (char * const *) p2);
++}
++
+ static char**
+ S_find_cfh(char *dir, char **cfh_list, size_t num_cfh) {
+     void *dirhandle = CFCUtil_opendir(dir);
+@@ -152,6 +162,7 @@
+         }
+     }
+ 
++    qsort(cfh_list, num_cfh, sizeof(char*), cmpstringp);
+     FREEMEM(full_path);
+     CFCUtil_closedir(dirhandle, dir);
+     return cfh_list;
diff --git a/debian/patches/series b/debian/patches/series
index 4818597..c968218 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 mips-unaligned-access.patch
 reproducible.patch
+reproducible2.patch

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to