[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dateutils: FTBFS on hurd-i386 (for review)



Source: dateutils
Version: 2.7-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd

Hi,

Currently dateutils fails to build from source due to PATH_MAX being
used, and that constant is not defined on GNU/Hurd. The attached patch
avoid using PATH_MAX by redefining the function mkfifofn() to allocate
the string buf there and free the allocated buffers expfn and actfn in
the calling function differ() when not needed any longer. All 610 tests
run in the testsuite pass and they are a requisite for the package to
build.

Thanks!


--- a/test/clittool.c	2014-01-29 16:08:23.000000000 +0100
+++ b/test/clittool.c	2014-05-10 15:55:30.000000000 +0200
@@ -619,10 +619,15 @@
 	return;
 }
 
+
 static void
-mkfifofn(char *restrict buf, size_t bsz, const char *key, unsigned int tid)
+mkfifofn(char **buf, const char *key, unsigned int tid)
 {
-	snprintf(buf, bsz, "%s output  %x", key, tid);
+  	size_t len = strlen(key) + 9 + 4 + 1;
+  	*buf = malloc(len);
+  	if (*buf == NULL)
+  	  fprintf(stderr, "malloc failed\n");
+  	snprintf(*buf, len, "%s output  %x", key, tid);
 	return;
 }
 
@@ -670,8 +675,8 @@
 #if !defined L_tmpnam
 # define L_tmpnam	(PATH_MAX)
 #endif	/* !L_tmpnam */
-	static char expfn[PATH_MAX];
-	static char actfn[PATH_MAX];
+	char *expfn;
+	char *actfn;
 	pid_t difftool = -1;
 
 	assert(!clit_bit_fd_p(exp));
@@ -681,11 +686,11 @@
 		error("cannot prepare in file `%s'", exp.d);
 		goto out;
 	} else if (!clit_bit_fn_p(exp) &&
-		   (mkfifofn(expfn, sizeof(expfn), "expected", ctx->test_id),
+		   (mkfifofn(&expfn, "expected", ctx->test_id),
 		    mkfifo(expfn, 0666) < 0)) {
 		error("cannot create fifo `%s'", expfn);
 		goto out;
-	} else if (mkfifofn(actfn, sizeof(actfn), "actual", ctx->test_id),
+	} else if (mkfifofn(&actfn, "actual", ctx->test_id),
 		   mkfifo(actfn, 0666) < 0) {
 		error("cannot create fifo `%s'", actfn);
 		goto out;
@@ -701,7 +706,7 @@
 
 	case 0:;
 		/* i am the child */
-		static char *const diff_opt[] = {
+	  	char *diff_opt[] = {
 			"diff",
 			"-u",
 			expfn, actfn, NULL,
@@ -763,9 +768,11 @@
 out:
 	if (*expfn && !clit_bit_fn_p(exp)) {
 		unlink(expfn);
+		free(expfn);
 	}
 	if (*actfn) {
 		unlink(actfn);
+		free(actfn);
 	}
 	return difftool;
 }

Reply to: