Package: dctl-tools
Version: 2.18
Severity: normal
Tags: patch

Hello,

trying to build dctrl-tools 2.18 in Ubuntu oneiric leads to a FTBFS
because of "error: format not a string literal and no format arguments"
[1]. The error comes from a wrong argument order for message() and some
missing format specifiers. Attached is a patch to fix it.

Regards,
Michael


1: 
https://launchpadlibrarian.net/70771161/buildlog_ubuntu-oneiric-i386.dctrl-tools_2.18_FAILEDTOBUILD.txt.gz
gcc  -g -Wall -Werror -std=gnu99 -Ilib -DENABLE_L_DEBUG -D_GNU_SOURCE 
-DSYSCONF=\"/etc\" -DHAVE_GETTEXT -DPACKAGE=\"dctrl-tools\" 
-DLOCALEDIR=\"/usr/share/locale\"  -DVERSION=\"2.18\" 
-DMAINTAINER='"dctrl-tools developers 
<dctrl-tools-de...@lists.alioth.debian.org>"' -c -o grep-dctrl/grep-dctrl.o 
grep-dctrl/grep-dctrl.c
In file included from grep-dctrl/grep-dctrl.c:35:0:
lib/msg.h: In function 'debug_message':
lib/msg.h:115:3: error: format not a string literal and no format arguments 
[-Werror=format-security]
lib/msg.h: In function 'errno_msg':
lib/msg.h:140:2: error: format not a string literal and no format arguments 
[-Werror=format-security]
lib/msg.h: In function 'enomem':
lib/msg.h:148:3: error: format not a string literal and no format arguments 
[-Werror=format-security]
lib/msg.h: In function 'fatal_enomem':
lib/msg.h:154:3: error: format not a string literal and no format arguments 
[-Werror=format-security]
cc1: all warnings being treated as errors
diff -Nru dctrl-tools-2.18/grep-dctrl/rc.c dctrl-tools-2.18ubuntu1/grep-dctrl/rc.c
--- dctrl-tools-2.18/grep-dctrl/rc.c	2010-12-04 11:31:28.000000000 +0100
+++ dctrl-tools-2.18ubuntu1/grep-dctrl/rc.c	2011-04-30 21:16:39.000000000 +0200
@@ -64,14 +64,14 @@
 		return false;
 	}
 	if (stat.st_uid != 0 && stat.st_uid != getuid()) {
-		message(L_IMPORTANT, _("not owned by you or root, ignoring"),
-			fname);
+		message(L_IMPORTANT, fname,
+			_("not owned by you or root, ignoring"));
 		return false;
 	}
 	if ((stat.st_mode & (S_IWGRP | S_IWOTH)) != 0) {
-		message(L_IMPORTANT, _("write permissions for "
-				       "group or others, ignoring"),
-			fname);
+		message(L_IMPORTANT, fname,
+			_("write permissions for "
+			  "group or others, ignoring"));
 		return false;
 	}
 	return true;
@@ -109,11 +109,11 @@
 		return (struct ifile){ .mode = m_error, .s = 0 };
 	}
 
-	message(L_INFORMATIONAL, _("reading config file"), fname);
+	message(L_INFORMATIONAL, fname, _("reading config file"));
 
 	f = fopen(fname, "r");
 	if (f == 0) {
-		message(L_INFORMATIONAL, strerror(errno), fname);
+		message(L_INFORMATIONAL, fname, "%s", strerror(errno));
 		return (struct ifile){ .mode = m_error, .s = 0 };
 	}
 
@@ -136,8 +136,8 @@
 
 		line = getaline (f);
 		if (line == 0) {
-			message(L_FATAL, _("read failure or out of memory"),
-				fname);
+			message(L_FATAL, fname,
+				_("read failure or out of memory"));
 			fail();
 		}
 
diff -Nru dctrl-tools-2.18/join-dctrl/join-dctrl.c dctrl-tools-2.18ubuntu1/join-dctrl/join-dctrl.c
--- dctrl-tools-2.18/join-dctrl/join-dctrl.c	2010-12-04 11:31:28.000000000 +0100
+++ dctrl-tools-2.18ubuntu1/join-dctrl/join-dctrl.c	2011-04-30 21:03:15.000000000 +0200
@@ -91,7 +91,7 @@
                 for (size_t i = 0; i < 2; i++) {
                         if (key == the_other_key[i]) continue;
                         if (args->join_field[0] != NULL) {
-                                message(L_FATAL, 0, gettext(errmsg[i]));
+                                message(L_FATAL, 0, "%s", gettext(errmsg[i]));
                                 fail();
                         }
                 }
diff -Nru dctrl-tools-2.18/lib/msg.h dctrl-tools-2.18ubuntu1/lib/msg.h
--- dctrl-tools-2.18/lib/msg.h	2010-12-04 11:31:29.000000000 +0100
+++ dctrl-tools-2.18ubuntu1/lib/msg.h	2011-04-30 21:12:32.000000000 +0200
@@ -112,7 +112,7 @@
 debug_message (const char * s, const char * fname)
 {
 #ifdef INCLUDE_DEBUG_MSGS
-  message (L_DEBUG, s, fname);
+  message (L_DEBUG, fname, "%s", s);
 #endif
 }
 
@@ -137,7 +137,7 @@
 inline static void
 errno_msg(int severity, char const * fname)
 {
-	message(severity, strerror(errno), fname);
+	message(severity, fname, "%s", strerror(errno));
 }
 
 #define enomem_msg _("cannot find enough memory")
@@ -145,13 +145,13 @@
 inline static void
 enomem (const char * fname)
 {
-  message (L_IMPORTANT, enomem_msg, fname);
+  message (L_IMPORTANT, fname, enomem_msg);
 }
 
 inline static void
 fatal_enomem (const char * fname)
 {
-  message(L_FATAL, enomem_msg, fname);
+  message(L_FATAL, fname, enomem_msg);
   fail();
 }
 

Reply via email to