From: W.C.A. Wijngaards Date: Fri, 25 Jun 2021 08:12:40 +0000 (+0200) Subject: Analysis workflow, debug output. X-Git-Tag: release-1.13.2rc1~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ed49bf45f5f16b0baeb9a3005d9cb8af9e51497;p=thirdparty%2Funbound.git Analysis workflow, debug output. --- diff --git a/.github/workflows/analysis_ports.yml b/.github/workflows/analysis_ports.yml index 5b39c7c28..0cd8bd412 100644 --- a/.github/workflows/analysis_ports.yml +++ b/.github/workflows/analysis_ports.yml @@ -234,6 +234,8 @@ jobs: make # specific test output if echo "i686-mingw64" | grep -i -e linux -e dragonfly >/dev/null; then echo yes; else echo no; fi + if echo "i686-mingw64" | grep -i -e linux >/dev/null; then echo yeslinux; else echo nolinux; fi + if echo "i686-mingw64" | grep -i -e dragonfly >/dev/null; then echo yesdragonfly; else echo nodragonfly; fi make testbound.exe; ./testbound.exe -s # make testbound; ./testbound.exe -p testdata/acl.rpl -o -vvvv make testbound.exe; ./testbound.exe -p testdata/auth_nsec3_ent.rpl -o -vvvv diff --git a/compat/ctime_r.c b/compat/ctime_r.c index b6bc12208..d6133cb02 100644 --- a/compat/ctime_r.c +++ b/compat/ctime_r.c @@ -23,6 +23,7 @@ ctime_r_cleanup(void) char *ctime_r(const time_t *timep, char *buf) { char* result; + printf("unbound_ctime_r called\n"); if(!ctime_r_init) { /* still small race where this init can be done twice, * which is mostly harmless */ diff --git a/testcode/fake_event.c b/testcode/fake_event.c index 901880ce6..a19a1ec0d 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -599,7 +599,7 @@ autotrust_check(struct replay_runtime* runtime, struct replay_moment* mom) log_err("should be: %s", p->str); fatal_exit("autotrust_check failed"); } - if(line[0]) line[strlen(line)-1] = 0; /* remove newline */ + strip_end_white(line); expanded = macro_process(runtime->vars, runtime, p->str); if(!expanded) fatal_exit("could not expand macro line %d", lineno); @@ -652,7 +652,7 @@ tempfile_check(struct replay_runtime* runtime, struct replay_moment* mom) log_err("should be: %s", p->str); fatal_exit("tempfile_check failed"); } - if(line[0]) line[strlen(line)-1] = 0; /* remove newline */ + strip_end_white(line); expanded = macro_process(runtime->vars, runtime, p->str); if(!expanded) fatal_exit("could not expand macro line %d", lineno); @@ -1717,7 +1717,7 @@ struct comm_point* outnet_comm_point_for_tcp(struct outside_network* outnet, addr_to_str((struct sockaddr_storage*)to_addr, to_addrlen, addrbuf, sizeof(addrbuf)); if(verbosity >= VERB_ALGO) { - if(buf[0] != 0) buf[strlen(buf)-1] = 0; /* del newline*/ + strip_end_white(buf); log_info("tcp to %s: %s", addrbuf, buf); } log_assert(sldns_buffer_limit(query)-LDNS_HEADER_SIZE >= 2); @@ -1807,7 +1807,7 @@ int comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet, addr_to_str((struct sockaddr_storage*)addr, addrlen, addrbuf, sizeof(addrbuf)); if(verbosity >= VERB_ALGO) { - if(buf[0] != 0) buf[strlen(buf)-1] = 0; /* del newline*/ + strip_end_white(buf); log_info("udp to %s: %s", addrbuf, buf); } log_assert(sldns_buffer_limit(packet)-LDNS_HEADER_SIZE >= 2); diff --git a/testcode/replay.c b/testcode/replay.c index 1077a6d08..69f1544db 100644 --- a/testcode/replay.c +++ b/testcode/replay.c @@ -124,8 +124,7 @@ replay_range_delete(struct replay_range* rng) free(rng); } -/** strip whitespace from end of string */ -static void +void strip_end_white(char* p) { size_t i; @@ -227,7 +226,7 @@ read_file_content(FILE* in, int* lineno, struct replay_moment* mom) if(strncmp(line, "FILE_END", 8) == 0) { return; } - if(line[0]) line[strlen(line)-1] = 0; /* remove newline */ + strip_end_white(line); if(!cfg_strlist_insert(last, strdup(line))) fatal_exit("malloc failure"); last = &( (*last)->next ); @@ -249,7 +248,7 @@ read_assign_step(char* remain, struct replay_moment* mom) if(eq != '=') fatal_exit("no '=' in assign: %s", remain); remain += skip; - if(remain[0]) remain[strlen(remain)-1]=0; /* remove newline */ + strip_end_white(remain); mom->string = strdup(remain); if(!mom->variable || !mom->string) fatal_exit("out of memory"); @@ -689,7 +688,7 @@ do_macro_ctime(char* arg) return NULL; } ctime_r(&tt, buf); - if(buf[0]) buf[strlen(buf)-1]=0; /* remove trailing newline */ + strip_end_white(buf); return strdup(buf); } diff --git a/testcode/replay.h b/testcode/replay.h index 5132cdacb..0271dff03 100644 --- a/testcode/replay.h +++ b/testcode/replay.h @@ -425,6 +425,9 @@ int replay_var_compare(const void* a, const void* b); /** get oldest enabled fake timer */ struct fake_timer* replay_get_oldest_timer(struct replay_runtime* runtime); +/** strip whitespace from end of string */ +void strip_end_white(char* p); + /** * Create variable storage * @return new or NULL on failure. diff --git a/testcode/testbound.c b/testcode/testbound.c index a7cf27a73..c92900142 100644 --- a/testcode/testbound.c +++ b/testcode/testbound.c @@ -168,7 +168,7 @@ spool_temp_file_name(int* lineno, FILE* cfg, char* id) id++; if(*id == '\0') fatal_exit("TEMPFILE_NAME must have id, line %d", *lineno); - id[strlen(id)-1]=0; /* remove newline */ + strip_end_white(id); fake_temp_file("_temp_", id, line, sizeof(line)); fprintf(cfg, "\"%s\"\n", line); } @@ -185,7 +185,7 @@ spool_temp_file(FILE* in, int* lineno, char* id) id++; if(*id == '\0') fatal_exit("TEMPFILE_CONTENTS must have id, line %d", *lineno); - id[strlen(id)-1]=0; /* remove newline */ + strip_end_white(id); fake_temp_file("_temp_", id, line, sizeof(line)); /* open file and spool to it */ spool = fopen(line, "w"); @@ -205,7 +205,7 @@ spool_temp_file(FILE* in, int* lineno, char* id) char* tid = parse+17; while(isspace((unsigned char)*tid)) tid++; - tid[strlen(tid)-1]=0; /* remove newline */ + strip_end_white(tid); fake_temp_file("_temp_", tid, l2, sizeof(l2)); snprintf(line, sizeof(line), "$INCLUDE %s\n", l2); } @@ -230,7 +230,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id) id++; if(*id == '\0') fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno); - id[strlen(id)-1]=0; /* remove newline */ + strip_end_white(id); fake_temp_file("_auto_", id, line, sizeof(line)); /* add option for the file */ fprintf(cfg, "server: auto-trust-anchor-file: \"%s\"\n", line);