use --picky-developer for samba-ctdb autobuild target

Stefan (metze) Metzmacher metze at samba.org
Tue Dec 16 04:08:59 MST 2014


Hi Amitay,

the attached patches pass autobuild on ubuntu 10.04 now.

metze

Am 15.12.2014 um 14:25 schrieb Amitay Isaacs:
> On Mon, Dec 15, 2014 at 9:13 PM, Amitay Isaacs <amitay at gmail.com> wrote:
> 
>> On Mon, Dec 15, 2014 at 8:28 PM, Stefan (metze) Metzmacher <
>> metze at samba.org> wrote:
>>
>>> Hi,
>>>
>>> here're 2 patches to enable --picky-developer for the samba-ctdb
>>> autobuild target.
>>> This makes sure we don't introduce new compiler warnings into the
>>> --with-cluster-support
>>> related code.
>>>
>>> metze
>>>
>>
>> Pushed to autobuild.
>>
>> Amitay.
>>
> 
> Hi Metze,
> 
> Looks like gcc 4.4.3 does not like this code:
> 
>         dbgtext(fmt, ap);
> 
> I don't get any errors with gcc 4.8.3 on fedora.
> 
> [2855/4262] Compiling ctdb/server/ctdb_logging.c
> cc1: warnings being treated as errors
> ../ctdb/server/ctdb_logging.c: In function 'ctdb_tevent_logging':
> ../ctdb/server/ctdb_logging.c:333: error: format not a string literal,
> argument types not checked
> Waf: Leaving directory `/memdisk/amitay/a/b23502/samba-ctdb/bin'
> Build failed:  -> task failed (err #1):
> 	{task: cc ctdb_logging.c -> ctdb_logging_8.o}
> make: *** [all] Error 1
> 
> Amitay.
> 
-------------- next part --------------
From 71cd67378dbc67540e4a7258f22763c829e5834f Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Tue, 16 Dec 2014 11:30:53 +0100
Subject: [PATCH 1/4] lib/util: provide a dbgtext_va() function which takes
 va_list

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 lib/util/debug.c | 24 +++++++++++++++++++-----
 lib/util/debug.h |  1 +
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/lib/util/debug.c b/lib/util/debug.c
index 750ad25..1634d71 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -1063,17 +1063,14 @@ full:
 
 ***************************************************************************/
 
- bool dbgtext( const char *format_str, ... )
+static inline bool __dbgtext_va(const char *format_str, va_list ap) PRINTF_ATTRIBUTE(1,0);
+static inline bool __dbgtext_va(const char *format_str, va_list ap)
 {
-	va_list ap;
 	char *msgbuf = NULL;
 	bool ret = true;
 	int res;
 
-	va_start(ap, format_str);
 	res = vasprintf(&msgbuf, format_str, ap);
-	va_end(ap);
-
 	if (res != -1) {
 		format_debug_text(msgbuf);
 	} else {
@@ -1082,3 +1079,20 @@ full:
 	SAFE_FREE(msgbuf);
 	return ret;
 }
+
+ bool dbgtext_va(const char *format_str, va_list ap)
+{
+	return __dbgtext_va(format_str, ap);
+}
+
+ bool dbgtext(const char *format_str, ... )
+{
+	va_list ap;
+	bool ret;
+
+	va_start(ap, format_str);
+	ret = __dbgtext_va(format_str, ap);
+	va_end(ap);
+
+	return ret;
+}
diff --git a/lib/util/debug.h b/lib/util/debug.h
index 27c319b..67d122f 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -42,6 +42,7 @@
 #define MAX_DEBUG_LEVEL 1000
 #endif
 
+bool dbgtext_va(const char *, va_list ap) PRINTF_ATTRIBUTE(1,0);
 bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
 bool dbghdrclass( int level, int cls, const char *location, const char *func);
 bool dbghdr( int level, const char *location, const char *func);
-- 
1.9.1


From 366bdb66df535b2de252e03fde2bf3938086995c Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 15 Dec 2014 14:54:18 +0100
Subject: [PATCH 2/4] ctdb/server: add format string checking to
 ctdb_tevent_logging()

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 ctdb/server/ctdb_logging.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ctdb/server/ctdb_logging.c b/ctdb/server/ctdb_logging.c
index 85dbfcf..129bdc9 100644
--- a/ctdb/server/ctdb_logging.c
+++ b/ctdb/server/ctdb_logging.c
@@ -310,6 +310,10 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
 static void ctdb_tevent_logging(void *private_data,
 				enum tevent_debug_level level,
 				const char *fmt,
+				va_list ap) PRINTF_ATTRIBUTE(3, 0);
+static void ctdb_tevent_logging(void *private_data,
+				enum tevent_debug_level level,
+				const char *fmt,
 				va_list ap)
 {
 	enum debug_level lvl = DEBUG_CRIT;
@@ -330,7 +334,7 @@ static void ctdb_tevent_logging(void *private_data,
 	}
 
 	if (lvl <= DEBUGLEVEL) {
-		dbgtext(fmt, ap);
+		dbgtext_va(fmt, ap);
 	}
 }
 
-- 
1.9.1


From 5275fb8f336bbe9b662ea98e7de52c2ce9d595c7 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Wed, 10 Dec 2014 23:00:43 +0100
Subject: [PATCH 3/4] s3:lib: fix allocation check in messages_ctdbd.c

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source3/lib/messages_ctdbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 53aeb1f..dbca103 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -113,7 +113,7 @@ static int messaging_ctdb_send(struct server_id src,
 	}
 
 	buf = talloc_array(talloc_tos(), uint8_t, buflen);
-	if (buflen == NULL) {
+	if (buf == NULL) {
 		return ENOMEM;
 	}
 	iov_buf(iov, iovlen, buf, buflen);
-- 
1.9.1


From 695fbc160b57a5e1c6efbc79d7d6a2ae90cdbe1a Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 8 Dec 2014 10:30:56 +0100
Subject: [PATCH 4/4] script/autobuild.py: use --picky-developer for the
 samba-ctdb target

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 script/autobuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/script/autobuild.py b/script/autobuild.py
index ba08e52..e776df8 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -60,7 +60,7 @@ tasks = {
 
 
                      # build samba with cluster support against this ctdb:
-                     ("samba-configure", "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} ./configure.developer ${PREFIX} --with-selftest-prefix=./bin/ab --with-cluster-support --bundled-libraries=!tdb", "text/plain"),
+                     ("samba-configure", "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} ./configure.developer --picky-developer ${PREFIX} --with-selftest-prefix=./bin/ab --with-cluster-support --bundled-libraries=!tdb", "text/plain"),
                      ("samba-make", "make", "text/plain"),
                      ("samba-check", "./bin/smbd -b | grep CLUSTER_SUPPORT", "text/plain"),
                      ("samba-install", "make install", "text/plain"),
-- 
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141216/d321bd8a/attachment.pgp>


More information about the samba-technical mailing list