Bug#835625: nikwi: please make the build reproducible

Chris Lamb lamby at debian.org
Sat Aug 27 18:00:53 UTC 2016


Source: nikwi
Version: 0.0.20120213-3
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: ordering
X-Debbugs-Cc: reproducible-builds at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], I noticed
that nikwi could not be built reproducibly.

Patch attached.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/debian/patches/reproducible_build.patch	1970-01-01 01:00:00.000000000 +0100
--- b/debian/patches/reproducible_build.patch	2016-08-27 18:51:19.004085540 +0100
@@ -0,0 +1,49 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby at debian.org>
+Last-Update: 2016-08-27
+
+--- nikwi-0.0.20120213.orig/src/tools/upack/upack.c
++++ nikwi-0.0.20120213/src/tools/upack/upack.c
+@@ -159,9 +159,9 @@ static void packFile(char *filename, cha
+ 
+ static void scanDirectory(char *dirname, char *path)
+ {
+-	DIR		*dir;
++	int		n;
+ 	char		*spath;
+-	struct dirent	*de;
++	struct dirent	*de, **namelist;
+ 	if (chdir(dirname))
+ 		return;
+ 	
+@@ -170,15 +170,15 @@ static void scanDirectory(char *dirname,
+ 		sprintf(spath, "%s/%s", path, dirname);
+ 	else
+ 		sprintf(spath, "%s", dirname);
+-	dir = opendir(".");
+-	if (!dir)
+-	{
++	n = scandir(".", &namelist, 0, alphasort);
++	if (n < 0) {
+ 		chdir("..");
+ 		printf("cannot open `%s'\n", dirname);
+ 		return;
+ 	}
+-	while ((de = readdir(dir)))
++	while (n--)
+ 	{
++		de = namelist[n];
+ 		if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, ".."))
+ 			continue;
+ 		if (chdir(de->d_name))
+@@ -199,8 +199,9 @@ static void scanDirectory(char *dirname,
+ 			}
+ 			scanDirectory(de->d_name, spath);
+ 		}
++		free(de);
+ 	}
+-	closedir(dir);
++	free(namelist);
+ 		
+ 	free(spath);
+ 	chdir("..");
--- a/debian/patches/series	2016-08-27 18:41:21.055719434 +0100
--- b/debian/patches/series	2016-08-27 18:51:16.784055046 +0100
@@ -4,3 +4,4 @@
 slashfx_main.patch
 uscript_type.patch
 big-endian.patch
+reproducible_build.patch


More information about the Pkg-games-devel mailing list