From 0d8032842c6b2a30ae207ffa9118463b8b8f82fe Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 12:36:27 +0200 Subject: [PATCH 01/10] Fix compilation warnings in dlz_perl_driver.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dlz_perl_driver.c: In function ‘dlz_version’: dlz_perl_driver.c:116:27: warning: unused parameter ‘flags’ [-Wunused-parameter] 116 | dlz_version(unsigned int *flags) { | ~~~~~~~~~~~~~~^~~~~ In file included from /usr/lib64/perl5/CORE/perl.h:5685, from dlz_perl_driver.c:33: dlz_perl_driver.c: In function ‘dlz_allnodes’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:151:17: note: in expansion of macro ‘POPs’ 151 | POPs; | ^~~~ dlz_perl_driver.c: In function ‘dlz_allowzonexfr’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:251:17: note: in expansion of macro ‘POPs’ 251 | POPs; | ^~~~ dlz_perl_driver.c: In function ‘dlz_findzonedb’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:328:17: note: in expansion of macro ‘POPs’ 328 | POPs; | ^~~~ dlz_perl_driver.c: In function ‘dlz_lookup’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:407:17: note: in expansion of macro ‘POPs’ 407 | POPs; | ^~~~ dlz_perl_driver.c:472:1: error: no previous prototype for ‘missing_perl_method’ [-Werror=missing-prototypes] 472 | missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl) | ^~~~~~~~~~~~~~~~~~~ dlz_perl_driver.c: In function ‘missing_perl_method’: dlz_perl_driver.c:485:9: error: ISO C90 forbids array ‘full_name’ whose size cannot be evaluated [-Werror=vla] 485 | char full_name[BUF_LEN]; | ^~~~ dlz_perl_driver.c: In function ‘dlz_create’: dlz_perl_driver.c:613:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 613 | if (missing_method_name = missing_perl_method(perl_class_name, my_perl)) | ^~~~~~~~~~~~~~~~~~~ /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:657:17: note: in expansion of macro ‘POPs’ 657 | POPs; | ^~~~ dlz_perl_driver.c:502:15: warning: unused variable ‘init_args’ [-Wunused-variable] 502 | char *init_args[] = { NULL, NULL }; | ^~~~~~~~~ (cherry picked from commit be928dbba29088a966d7fb93ab9dfe3c9417ad37) --- contrib/dlz/modules/perl/dlz_perl_driver.c | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/contrib/dlz/modules/perl/dlz_perl_driver.c b/contrib/dlz/modules/perl/dlz_perl_driver.c index 9bbcfc2b0b..88edc0ced0 100644 --- a/contrib/dlz/modules/perl/dlz_perl_driver.c +++ b/contrib/dlz/modules/perl/dlz_perl_driver.c @@ -37,6 +37,8 @@ #include +#define BUF_LEN 64 /* Should be big enough, right? hah */ + /* Enable debug logging? */ #if 0 #define carp(...) cd->log(ISC_LOG_INFO, __VA_ARGS__); @@ -79,7 +81,7 @@ EXTERN_C void boot_DLZ_Perl(pTHX_ CV *cv); EXTERN_C void xs_init(pTHX) { - char *file = __FILE__; + const char *file = __FILE__; dXSUB_SYS; /* DynaLoader is a special case */ @@ -114,6 +116,7 @@ b9_add_helper(config_data_t *state, const char *helper_name, void *ptr) { int dlz_version(unsigned int *flags) { + UNUSED(flags); return (DLZ_DLOPEN_VERSION); } @@ -148,7 +151,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) { SPAGAIN; if (SvTRUE(ERRSV)) { - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: allnodes for zone %s died in eval: %s", zone, SvPV_nolen(ERRSV)); @@ -248,7 +251,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { * it away so we don't leave junk on the stack for the next * caller. */ - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: allowzonexfr died in eval: %s", SvPV_nolen(ERRSV)); @@ -325,7 +328,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, * it away so we don't leave junk on the stack for the next * caller. */ - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: findzone died in eval: %s", SvPV_nolen(ERRSV)); retval = ISC_R_FAILURE; @@ -404,7 +407,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, SPAGAIN; if (SvTRUE(ERRSV)) { - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: lookup died in eval: %s", SvPV_nolen(ERRSV)); retval = ISC_R_FAILURE; @@ -470,14 +473,13 @@ CLEAN_UP_AND_RETURN: return (retval); } -const char * +static const char * #ifdef MULTIPLICITY missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl) #else /* ifdef MULTIPLICITY */ missing_perl_method(const char *perl_class_name) #endif /* ifdef MULTIPLICITY */ { - const int BUF_LEN = 64; /* Should be big enough, right? hah */ char full_name[BUF_LEN]; const char *methods[] = { "new", "findzone", "lookup", NULL }; int i = 0; @@ -499,8 +501,7 @@ isc_result_t dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, ...) { config_data_t *cd; - char *init_args[] = { NULL, NULL }; - char *perlrun[] = { "", NULL, "dlz perl", NULL }; + char *perlrun[] = { (char *)"", NULL, (char *)"dlz perl", NULL }; char *perl_class_name; int r; va_list ap; @@ -610,9 +611,10 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, } #ifdef MULTIPLICITY - if (missing_method_name = missing_perl_method(perl_class_name, my_perl)) + if ((missing_method_name = missing_perl_method(perl_class_name, + my_perl))) #else /* ifdef MULTIPLICITY */ - if (missing_method_name = missing_perl_method(perl_class_name)) + if ((missing_method_name = missing_perl_method(perl_class_name))) #endif /* ifdef MULTIPLICITY */ { cd->log(ISC_LOG_ERROR, @@ -654,7 +656,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, LEAVE; if (SvTRUE(ERRSV)) { - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl '%s': new died in eval: %s", dlzname, SvPV_nolen(ERRSV)); goto CLEAN_UP_PERL_AND_FAIL; From 2a52f343a340c8cfa680313e98d395af4dc745c4 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 14:36:49 +0200 Subject: [PATCH 02/10] Fix warnings in dlz_mysqldyn_mod.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dlz_mysqldyn_mod.c: In function ‘dlz_findzonedb’: dlz_mysqldyn_mod.c:1079:73: warning: unused parameter ‘methods’ [-Wunused-parameter] 1079 | dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ dlz_mysqldyn_mod.c:1080:34: warning: unused parameter ‘clientinfo’ [-Wunused-parameter] 1080 | dns_clientinfo_t *clientinfo) { | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~ dlz_mysqldyn_mod.c: In function ‘dlz_lookup’: dlz_mysqldyn_mod.c:1111:63: warning: unused parameter ‘methods’ [-Wunused-parameter] 1111 | dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ dlz_mysqldyn_mod.c: In function ‘build_query’: dlz_mysqldyn_mod.c:465:19: warning: pointer ‘item’ used after ‘free’ [-Wuse-after-free] 465 | item = DLZ_LIST_NEXT(item, link)) dlz_mysqldyn_mod.c:470:17: note: call to ‘free’ here 470 | free(item); | ^~~~~~~~~~ (cherry picked from commit 587ea10567d05a405c75f2e31b3ef918233d9f8e) --- contrib/dlz/modules/include/dlz_list.h | 14 ++++++++++++++ contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c | 9 ++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/contrib/dlz/modules/include/dlz_list.h b/contrib/dlz/modules/include/dlz_list.h index 202bc0690a..077ae89a73 100644 --- a/contrib/dlz/modules/include/dlz_list.h +++ b/contrib/dlz/modules/include/dlz_list.h @@ -54,3 +54,17 @@ #define DLZ_LIST_PREV(elt, link) ((elt)->link.prev) #define DLZ_LIST_NEXT(elt, link) ((elt)->link.next) + +#define DLZ_LIST_UNLINK(list, elt, link) \ + do { \ + if ((elt)->link.next != NULL) \ + (elt)->link.next->link.prev = (elt)->link.prev; \ + else \ + (list).tail = (elt)->link.prev; \ + if ((elt)->link.prev != NULL) \ + (elt)->link.prev->link.next = (elt)->link.next; \ + else \ + (list).head = (elt)->link.next; \ + (elt)->link.prev = (void *)(-1); \ + (elt)->link.next = (void *)(-1); \ + } while (0) diff --git a/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c b/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c index 9af5a7e692..bdd0bccdc6 100644 --- a/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c +++ b/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c @@ -461,9 +461,8 @@ build_query(mysql_data_t *state, mysql_instance_t *dbi, const char *command, fail: va_end(ap1); - for (item = DLZ_LIST_HEAD(arglist); item != NULL; - item = DLZ_LIST_NEXT(item, link)) - { + while ((item = DLZ_LIST_HEAD(arglist)) != NULL) { + DLZ_LIST_UNLINK(arglist, item, link); if (item->arg != NULL) { free(item->arg); } @@ -1078,6 +1077,8 @@ dlz_destroy(void *dbdata) { isc_result_t dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) { + UNUSED(methods); + UNUSED(clientinfo); isc_result_t result = ISC_R_SUCCESS; mysql_data_t *state = (mysql_data_t *)dbdata; MYSQL_RES *res; @@ -1110,6 +1111,8 @@ isc_result_t dlz_lookup(const char *zone, const char *name, void *dbdata, dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo) { + UNUSED(methods); + UNUSED(clientinfo); isc_result_t result; mysql_data_t *state = (mysql_data_t *)dbdata; bool found = false; From 48c3891603abbca14089e93c64c190996d761703 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 15:23:45 +0200 Subject: [PATCH 03/10] Fix compilation warnings in dlz_sqlite3_dynamic.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dlz_sqlite3_dynamic.c: In function ‘dlz_sqlite3_fetch_row’: dlz_sqlite3_dynamic.c:447:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 447 | if (rs->pnRow > 0U && rs->curRow < rs->pnRow) { | ^ dlz_sqlite3_dynamic.c:447:50: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare] 447 | if (rs->pnRow > 0U && rs->curRow < rs->pnRow) { | ^ (cherry picked from commit 60f68dc0d62a87c44c20afbdb8ccdf93bc0826db) --- contrib/dlz/modules/sqlite3/dlz_sqlite3_dynamic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/dlz/modules/sqlite3/dlz_sqlite3_dynamic.c b/contrib/dlz/modules/sqlite3/dlz_sqlite3_dynamic.c index 40d1820616..be6c6d7664 100644 --- a/contrib/dlz/modules/sqlite3/dlz_sqlite3_dynamic.c +++ b/contrib/dlz/modules/sqlite3/dlz_sqlite3_dynamic.c @@ -75,11 +75,11 @@ typedef struct { * SQLite3 result set */ typedef struct { - char **pazResult; /* Result of the query */ - int pnRow; /* Number of result rows */ - int pnColumn; /* Number of result columns */ - unsigned int curRow; /* Current row */ - char *pzErrmsg; /* Error message */ + char **pazResult; /* Result of the query */ + int pnRow; /* Number of result rows */ + int pnColumn; /* Number of result columns */ + int curRow; /* Current row */ + char *pzErrmsg; /* Error message */ } sqlite3_res_t; /* forward references */ @@ -444,7 +444,7 @@ static char ** dlz_sqlite3_fetch_row(sqlite3_res_t *rs) { char **retval = NULL; if (rs != NULL) { - if (rs->pnRow > 0U && rs->curRow < rs->pnRow) { + if (rs->pnRow > 0 && rs->curRow < rs->pnRow) { int index = (rs->curRow + 1) * rs->pnColumn; retval = &rs->pazResult[index]; rs->curRow++; From f47990aa6e80518d58c21405d287cb46dcb00579 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 15:42:16 +0200 Subject: [PATCH 04/10] Fix compilation warnings in dlz_wildcard_dynamic.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dlz_wildcard_dynamic.c: In function ‘dlz_lookup’: dlz_wildcard_dynamic.c:227:14: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable] 227 | bool origin = true; | ^~~~~~ dlz_wildcard_dynamic.c: In function ‘dlz_lookup’: dlz_wildcard_dynamic.c:252:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 252 | cd->record = "@"; | ^ dlz_wildcard_dynamic.c: In function ‘dlz_authority’: dlz_wildcard_dynamic.c:328:22: warning: unused variable ‘origin’ [-Wunused-variable] 328 | bool origin; | ^~~~~~ dlz_wildcard_dynamic.c:312:25: warning: unused variable ‘name’ [-Wunused-variable] 312 | const char *p, *name = "@"; | ^~~~ dlz_wildcard_dynamic.c: In function ‘dlz_create’: dlz_wildcard_dynamic.c:441:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 441 | for (i = 4; i < argc; i += 4) { | ^ (cherry picked from commit 76c8c58d5472d70330187a88e7a7f8b206e3f1e6) --- contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c b/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c index 3cb3ee1106..df22eaf688 100644 --- a/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c +++ b/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c @@ -224,7 +224,6 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, const char *p; char *namebuf; nrr_t *nrec; - bool origin = true; #if DLZ_DLOPEN_VERSION >= 2 UNUSED(methods); @@ -249,9 +248,8 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, strncpy(namebuf, zone, len - 1); namebuf[len - 1] = '\0'; cd->record = namebuf; - origin = false; } else if (p == zone) { - cd->record = "@"; + cd->record = (char *)"@"; } /* Write info message to log */ @@ -309,7 +307,7 @@ dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) { config_data_t *cd = (config_data_t *)dbdata; char *querystring = NULL; nrr_t *nrec; - const char *p, *name = "@"; + const char *p; p = shortest_match(cd->zone_pattern, zone); if (p == NULL) { @@ -325,7 +323,6 @@ dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) { result = ISC_R_NOTFOUND; nrec = DLZ_LIST_HEAD(cd->rrs_list); while (nrec != NULL) { - bool origin; if (strcmp("@", nrec->name) == 0) { isc_result_t presult; @@ -391,7 +388,8 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, ...) { config_data_t *cd; char *endp; - int i, def_ttl; + unsigned int i; + int def_ttl; nrr_t *trec = NULL; isc_result_t result; const char *helper_name; From e23fb140fa58e223a341cc8a57209bd35985a63b Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 15:49:34 +0200 Subject: [PATCH 05/10] Fix statement may fall through warnings in dlz_ldap_dynamic.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dlz_ldap_dynamic.c: In function ‘dlz_create’: dlz_ldap_dynamic.c:971:20: warning: this statement may fall through [-Wimplicit-fallthrough=] 971 | if (result != ISC_R_SUCCESS) { | ^ dlz_ldap_dynamic.c:974:9: note: here 974 | case 11: | ^~~~ dlz_ldap_dynamic.c:976:20: warning: this statement may fall through [-Wimplicit-fallthrough=] 976 | if (result != ISC_R_SUCCESS) { | ^ dlz_ldap_dynamic.c:979:9: note: here 979 | case 10: | ^~~~ dlz_ldap_dynamic.c:980:20: warning: this statement may fall through [-Wimplicit-fallthrough=] 980 | if (strlen(argv[9]) > 0) { | ^ dlz_ldap_dynamic.c:987:9: note: here 987 | case 9: | ^~~~ (cherry picked from commit 99912ed2f727c87c7f1e0f0062205857951d029a) --- contrib/dlz/modules/ldap/dlz_ldap_dynamic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c index 48f4b63262..ce1c50c44a 100644 --- a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c +++ b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c @@ -971,11 +971,13 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, if (result != ISC_R_SUCCESS) { goto cleanup; } + FALLTHROUGH; case 11: result = dlz_ldap_checkURL(ldap, argv[10], 3, "all nodes"); if (result != ISC_R_SUCCESS) { goto cleanup; } + FALLTHROUGH; case 10: if (strlen(argv[9]) > 0) { result = dlz_ldap_checkURL(ldap, argv[9], 3, @@ -984,6 +986,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, goto cleanup; } } + FALLTHROUGH; case 9: result = dlz_ldap_checkURL(ldap, argv[8], 3, "lookup"); if (result != ISC_R_SUCCESS) { From d25dc2356300aff20cacce794cc8ac4a4d140a82 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 15:50:15 +0200 Subject: [PATCH 06/10] Leverage CFLAGS from environment in contrib Makefiles (cherry picked from commit 4affc436d3c24ac29a12a712913ebf271fdc648d) --- contrib/dlz/example/Makefile | 2 +- contrib/dlz/modules/bdbhpt/Makefile | 2 +- contrib/dlz/modules/filesystem/Makefile | 2 +- contrib/dlz/modules/ldap/Makefile | 2 +- contrib/dlz/modules/mysql/Makefile | 2 +- contrib/dlz/modules/mysqldyn/Makefile | 2 +- contrib/dlz/modules/sqlite3/Makefile | 2 +- contrib/dlz/modules/wildcard/Makefile | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/dlz/example/Makefile b/contrib/dlz/example/Makefile index c4479403e2..5c66ba1f31 100644 --- a/contrib/dlz/example/Makefile +++ b/contrib/dlz/example/Makefile @@ -16,7 +16,7 @@ # this means this Makefile is not portable, so the testsuite # skips this test on platforms where it doesn't build -CFLAGS=-Wall -fPIC -g +CFLAGS += -Wall -fPIC -g all: dlz_example.so diff --git a/contrib/dlz/modules/bdbhpt/Makefile b/contrib/dlz/modules/bdbhpt/Makefile index 45080af743..29d6b94cc6 100644 --- a/contrib/dlz/modules/bdbhpt/Makefile +++ b/contrib/dlz/modules/bdbhpt/Makefile @@ -26,7 +26,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include +CFLAGS += -fPIC -g -I../include BDB_LIBS=-ldb all: dlz_bdbhpt_dynamic.so diff --git a/contrib/dlz/modules/filesystem/Makefile b/contrib/dlz/modules/filesystem/Makefile index 40ecb79c5b..6c5470f343 100644 --- a/contrib/dlz/modules/filesystem/Makefile +++ b/contrib/dlz/modules/filesystem/Makefile @@ -26,7 +26,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include +CFLAGS += -fPIC -g -I../include all: dlz_filesystem_dynamic.so diff --git a/contrib/dlz/modules/ldap/Makefile b/contrib/dlz/modules/ldap/Makefile index 8e86e3ef97..d9b6ff5bfe 100644 --- a/contrib/dlz/modules/ldap/Makefile +++ b/contrib/dlz/modules/ldap/Makefile @@ -26,7 +26,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include +CFLAGS += -fPIC -g -I../include LDAP_LIBS=-lldap all: dlz_ldap_dynamic.so diff --git a/contrib/dlz/modules/mysql/Makefile b/contrib/dlz/modules/mysql/Makefile index 606dcefe6c..5d0904c13f 100644 --- a/contrib/dlz/modules/mysql/Makefile +++ b/contrib/dlz/modules/mysql/Makefile @@ -26,7 +26,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include $(shell mysql_config --cflags) +CFLAGS += -fPIC -g -I../include $(shell mysql_config --cflags) MYSQL_LIBS=$(shell mysql_config --libs) all: dlz_mysql_dynamic.so diff --git a/contrib/dlz/modules/mysqldyn/Makefile b/contrib/dlz/modules/mysqldyn/Makefile index 38fe4ff9b1..f78cd2ff2e 100644 --- a/contrib/dlz/modules/mysqldyn/Makefile +++ b/contrib/dlz/modules/mysqldyn/Makefile @@ -26,7 +26,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include $(shell mysql_config --cflags) +CFLAGS += -fPIC -g -I../include $(shell mysql_config --cflags) MYSQL_LIBS=$(shell mysql_config --libs) all: dlz_mysqldyn_mod.so diff --git a/contrib/dlz/modules/sqlite3/Makefile b/contrib/dlz/modules/sqlite3/Makefile index b7861ded55..1532921b95 100644 --- a/contrib/dlz/modules/sqlite3/Makefile +++ b/contrib/dlz/modules/sqlite3/Makefile @@ -26,7 +26,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include +CFLAGS += -fPIC -g -I../include SQLITE3_LIBS=-lsqlite3 all: dlz_sqlite3_dynamic.so diff --git a/contrib/dlz/modules/wildcard/Makefile b/contrib/dlz/modules/wildcard/Makefile index d09a83a8be..087a3538e9 100644 --- a/contrib/dlz/modules/wildcard/Makefile +++ b/contrib/dlz/modules/wildcard/Makefile @@ -27,7 +27,7 @@ prefix = /usr libdir = $(prefix)/lib/bind9 -CFLAGS=-fPIC -g -I../include +CFLAGS += -fPIC -g -I../include all: dlz_wildcard_dynamic.so From c49b5d9d1dfe58ad20c36200dd6feeafad2047c5 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 16:20:53 +0200 Subject: [PATCH 07/10] Build contrib dlz modules in the CI (cherry picked from commit 4a4a91b012ce4b5021a702e34e98da604886017f) --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eb4086493c..65eb7d55bc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -277,7 +277,9 @@ stages: - *configure - *check_readline_setup - make -j${BUILD_PARALLEL_JOBS:-1} -k all V=1 + - test -z "${BUILD_CONTRIB}" || for DIR in contrib/dlz/modules/*; do test -f "${DIR}/Makefile" && CFLAGS="${CFLAGS} -Werror" make -C "${DIR}"; done - test -z "${RUN_MAKE_INSTALL}" || make DESTDIR="${INSTALL_PATH}" install + - test -z "${RUN_MAKE_INSTALL}" -o -z "${BUILD_CONTRIB}" || for DIR in contrib/dlz/modules/*; do test -f "${DIR}/Makefile" && make -C "${DIR}" DESTDIR="${INSTALL_PATH}" install; done - test -z "${RUN_MAKE_INSTALL}" || DESTDIR="${INSTALL_PATH}" sh util/check-make-install - if [[ "${CFLAGS}" == *"-fsanitize=address"* ]]; then ( ! grep -F AddressSanitizer config.log ); fi - test -z "${CROSS_COMPILATION}" || grep -F -A 1 "checking whether we are cross compiling" config.log | grep -q "result.*yes" @@ -693,9 +695,11 @@ unit:gcc:buster:amd64: gcc:bullseye:amd64: variables: + BUILD_CONTRIB: 1 CC: gcc CFLAGS: "${CFLAGS_COMMON} --coverage -O0" EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_LIBEDIT}" + RUN_MAKE_INSTALL: 1 <<: *debian_bullseye_amd64_image <<: *build_job @@ -1100,10 +1104,12 @@ unit:clang:tsan: clang:bullseye:amd64: variables: + BUILD_CONTRIB: 1 CC: ${CLANG} CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion" # See https://gitlab.isc.org/isc-projects/bind9/-/issues/3444 EXTRA_CONFIGURE: "--without-jemalloc" + RUN_MAKE_INSTALL: 1 <<: *debian_bullseye_amd64_image <<: *build_job From 2d747f7312b818bf158db638aba413031a48c1ea Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 18:53:09 +0200 Subject: [PATCH 08/10] Disable compound-token-split-by-macro warning with Clang Perl DLZ module compilation with Clang produces the following warning: /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32' #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START { \ ^~~~~~~~~~ /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/perl.h:666:29: note: expanded from macro 'STMT_START' # define STMT_START (void)( /* gcc supports "({ STATEMENTS; })" */ ^ /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:150:5: note: '{' token is here ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/x86_64-linux-gnu/perl/5.32/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32' #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START { \ ^ (cherry picked from commit 69b7e4362d091d68e478e1c0080a0ce3640af78f) --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 65eb7d55bc..85ae7b9dc3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1101,12 +1101,14 @@ unit:clang:tsan: artifacts: true # Jobs for Clang builds on Debian 11 "bullseye" (amd64) +# The -Wno-compound-token-split-by-macro option prevents warning when compiling +# Perl DLZ module with Clang against Perl older than version 5.35.2. clang:bullseye:amd64: variables: BUILD_CONTRIB: 1 CC: ${CLANG} - CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion" + CFLAGS: "${CFLAGS_COMMON} -Wenum-conversion -Wno-compound-token-split-by-macro" # See https://gitlab.isc.org/isc-projects/bind9/-/issues/3444 EXTRA_CONFIGURE: "--without-jemalloc" RUN_MAKE_INSTALL: 1 From 56abbea62cc9c938739f87844bb40e9ca2045037 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 20:55:30 +0200 Subject: [PATCH 09/10] Add install target for Perl DLZ module Perl DLZ module Makefile lacked "install" target, add it as we want to test DLZ module installation in the CI. (cherry picked from commit 35e44978b5bfa43f345e8b628f02021636d1c516) --- contrib/dlz/modules/perl/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/dlz/modules/perl/Makefile b/contrib/dlz/modules/perl/Makefile index f423d17bcd..ec99e0008d 100644 --- a/contrib/dlz/modules/perl/Makefile +++ b/contrib/dlz/modules/perl/Makefile @@ -57,3 +57,7 @@ $(LIBNAME): dlz_perl_driver.o dlz_perl_callback_clientinfo.o dlz_perl_callback.o clean: rm -f dlz_perl_driver.o dlz_perl_driver.so dlz_perl_callback_clientinfo.c dlz_perl_callback_clientinfo.o dlz_perl_callback.c dlz_perl_callback.o + +install: dlz_perl_driver.so + mkdir -p $(DESTDIR)$(libdir) + install dlz_perl_driver.so $(DESTDIR)$(libdir) From 65cc92404267cb3735f8143a0fcc045237cc9611 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Mon, 30 May 2022 21:23:47 +0200 Subject: [PATCH 10/10] Help gcovr find contrib files (cherry picked from commit 445a90fb7879b5e273376364e1be2181c5cf34e9) --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 85ae7b9dc3..a08ba81b76 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1503,6 +1503,8 @@ gcov: - for SRC in dns isc; do for DST in dns isc ns; do cp -f "lib/${SRC}/include/${SRC}"/*.h "lib/${DST}/"; done; done - find bin lib -maxdepth 1 -mindepth 1 -type d -exec cp -f lib/isc/include/isc/buffer.h "{}" \; - cp -f lib/isc/include/isc/buffer.h lib/isc/netmgr/buffer.h + # Help gcovr find dlz_dbi.c file + - for DST in ldap mysql mysqldyn sqlite3 wildcard; do cp contrib/dlz/modules/common/dlz_dbi.c "contrib/dlz/modules/${DST}"; done # Generate XML file in the Cobertura XML format suitable for use by GitLab # for the purpose of displaying code coverage information in the diff view # of a given merge request.