]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Analysis workflow, debug output.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Jun 2021 08:12:40 +0000 (10:12 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Jun 2021 08:12:40 +0000 (10:12 +0200)
.github/workflows/analysis_ports.yml
compat/ctime_r.c
testcode/fake_event.c
testcode/replay.c
testcode/replay.h
testcode/testbound.c

index 5b39c7c28e5863c384107fd70d72f86bf2188abb..0cd8bd412a94f6b9304fcb9be88f76578e3913f3 100644 (file)
@@ -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
index b6bc12208a23aacf28271b6e507e77a22a84f97c..d6133cb02f5fed0083d3d64713ce1f2012988687 100644 (file)
@@ -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 */
index 901880ce630bb6d1757ab9fdc79a2565b227ddfc..a19a1ec0d6027756f51443ce5dd0d33d07849048 100644 (file)
@@ -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);
index 1077a6d08d8e50d7d15a8feff1e00c6bc427f7b8..69f1544db8739c52c0b2112cac7ba81d48e53e4e 100644 (file)
@@ -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);
 }
 
index 5132cdacbd47310f4e416b13247295a3bea69dcd..0271dff0393b466476366d60e5e9ec5d24134f17 100644 (file)
@@ -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.
index a7cf27a73ea683c1a71704114da60642def05b71..c92900142870fbd6da7e48d323db46eddf81ef58 100644 (file)
@@ -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);