[Git][NTPsec/ntpsec][ifstats-changes] 15 commits: Tweak for getting started after DNS lookup works.

Ian Bruene gitlab at mg.gitlab.com
Sun May 7 19:01:00 UTC 2017


Ian Bruene pushed to branch ifstats-changes at NTPsec / ntpsec


Commits:
7cd59ba5 by Hal Murray at 2017-05-05T11:37:13-07:00
Tweak for getting started after DNS lookup works.

- - - - -
c84f6eac by Hal Murray at 2017-05-05T23:44:48-07:00
Fix dtolft() on NetBSD, issue 264

- - - - -
2dc1de27 by Hal Murray at 2017-05-05T23:53:24-07:00
Simplify FDF_RoundTrip

- - - - -
c0b9c454 by Gary E. Miller at 2017-05-06T13:08:08-07:00
packet auth: remove undocumented DEFFAULT_NTPKEYS.

No way to disable, undocumented, and bad security.

- - - - -
fa95bdc5 by Gary E. Miller at 2017-05-06T13:22:32-07:00
waf: pep8 fixes  pythonize-header

- - - - -
e8fed58c by Gary E. Miller at 2017-05-06T13:24:44-07:00
waf: fix minor pep8 nits.

- - - - -
ebb1f2d2 by Gary E. Miller at 2017-05-06T13:30:01-07:00
waf: minor pep8 fixes in wscript's.

- - - - -
206042b6 by Gary E. Miller at 2017-05-06T13:37:36-07:00
waf: several minor pep8 fixes in wscript's.

- - - - -
ed969508 by Gary E. Miller at 2017-05-06T13:41:08-07:00
ntpviz: minor pep8 tweaks

- - - - -
f7ae0c86 by Gary E. Miller at 2017-05-06T13:51:10-07:00
tests: minor pep8 tweaks.  BTW, this test has existing failures...

- - - - -
ad66e469 by Hal Murray at 2017-05-06T16:20:01-07:00
Hack to dance around bug in older Bison.  Issue 287

- - - - -
e8455cce by Eric S. Raymond at 2017-05-07T09:19:44-04:00
Address GitLab issue #296: compiler warning (gcc 7.0.1): lfpfunc.c

Simplify some tests so they don't throw compiler warnings.

- - - - -
036db9df by Eric S. Raymond at 2017-05-07T11:22:41-04:00
Address GitLab issue #294: compiler warning (gcc 7.0.1): refclock_neoclock

Harden the code against changes in unit block member sizes. This
should suppress some warnings.

- - - - -
3570afc0 by Eric S. Raymond at 2017-05-07T12:02:33-04:00
Address GitLab issue 295: compiler warning (gcc 7.0.1): ntp_loopfilter.c

Attempt to suppress fallthrough warning assuming GNU warning level 3.

- - - - -
19d683db by Ian Bruene at 2017-05-07T14:00:20-05:00
Fixes formatting error, and makes ifstats less brittle.

Previous bugfix neglected to remove the column from the header.

IfstatsSummary.summary() now properly handles missing values, previous
version pretended to, but would have failed anyway.

- - - - -


18 changed files:

- docs/wscript
- include/ntp_fp.h
- ntpclients/ntpviz
- ntpd/ntp_config.c
- ntpd/ntp_loopfilter.c
- ntpd/ntp_proto.c
- ntpd/refclock_neoclock.c
- ntpd/wscript
- pylib/packet.py
- pylib/util.py
- pylib/wscript
- tests/libntp/lfpfunc.c
- tests/pylib/test_util.py
- tests/wscript
- wafhelpers/check_cap.py
- wafhelpers/check_pthread.py
- wafhelpers/pythonize-header
- wscript


Changes:

=====================================
docs/wscript
=====================================
--- a/docs/wscript
+++ b/docs/wscript
@@ -35,6 +35,6 @@ def build(ctx):
     )
 
     # Install HTML
-    ctx.install_files('${HTMLDIR}', extra
-                      + [x.change_ext(".html").name for x in doc_source])
+    ctx.install_files('${HTMLDIR}', extra +
+                      [x.change_ext(".html").name for x in doc_source])
     ctx.install_files('${HTMLDIR}', image_source, relative_trick=True)


=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -168,7 +168,11 @@ static inline l_fp dtolfp(double d)
  * undefined return if d in NaN
  */
 {
-	return (l_fp)(llround(ldexp(d, 32)));
+/* Please check issue 264 before changing this to use llround
+ * https://gitlab.com/NTPsec/ntpsec/issues/264
+ * llround is broken on NetBSD, 2017-May-05
+ */
+	return (l_fp)(int64_t)(ldexp(d, 32));
 }
 
 static inline double lfptod(l_fp r)


=====================================
ntpclients/ntpviz
=====================================
--- a/ntpclients/ntpviz
+++ b/ntpclients/ntpviz
@@ -497,8 +497,8 @@ file.</p>
 
 """
 
-        ret = {'html': VizStats.table_head + stats.table
-               + stats_f.table + VizStats.table_tail + exp,
+        ret = {'html': VizStats.table_head + stats.table +
+               stats_f.table + VizStats.table_tail + exp,
                'plot': plot_template + plot_data + plot_data,
                'stats': [stats, stats_f],
                'title': "Local Clock Time/Frequency Offsets"}
@@ -589,8 +589,8 @@ file, and field 3 from the temp log .</p>
 
 """
 
-        ret = {'html': VizStats.table_head + stats_f.table
-               + table + VizStats.table_tail + exp,
+        ret = {'html': VizStats.table_head + stats_f.table +
+               table + VizStats.table_tail + exp,
                'plot': plot_template + plot_data + plot_data_t,
                'stats': stats,
                'title': "Local Frequency/Temp"}
@@ -732,8 +732,8 @@ than 20.  1 denotes the highest possible confidence level.  2 to 5 is good.
 Greater than 20 means there will be significant inaccuracy and error.</p>
 """
 
-        ret = {'html': VizStats.table_head + stats.table
-               + stats_tdop.table + VizStats.table_tail + exp,
+        ret = {'html': VizStats.table_head + stats.table +
+               stats_tdop.table + VizStats.table_tail + exp,
                'stats': [stats, stats_tdop],
                'title': "Local GPS",
                'plot': plot_template + plot_data + plot_data}
@@ -790,8 +790,8 @@ line at 0ppm.  Expected values of 99%-1% percentiles: 0.4ppm</p>
 
 <p>The Frequency Offset comes from field 4 of the loopstats log file.</p>
 """
-        ret = {'html': VizStats.table_head + stats.table
-               + VizStats.table_tail + exp,
+        ret = {'html': VizStats.table_head + stats.table +
+               VizStats.table_tail + exp,
                'plot': plot_template + plot_data,
                'stats': [stats],
                'title': "Local Clock Frequency Offset"}
@@ -857,8 +857,8 @@ plot \
  %(p1)s title "1st percentile"
 """ % out
 
-        ret = {'html': VizStats.table_head + stats.table
-               + VizStats.table_tail + exp,
+        ret = {'html': VizStats.table_head + stats.table +
+               VizStats.table_tail + exp,
                'plot': plot_template + plot_data,
                'stats': [stats],
                'title': title}
@@ -1189,8 +1189,8 @@ plot \
 <p>The Local Clock Offset is field 3 from the loopstats log file.</p>
 """
         # don't return stats, it's just a dupe
-        ret = {'html': VizStats.table_head + stats.table
-               + VizStats.table_tail + exp,
+        ret = {'html': VizStats.table_head + stats.table +
+               VizStats.table_tail + exp,
                'plot': plot_template + "".join(histogram_data) + "e\n",
                'stats': [],
                'title': "Local Clock Time Offset Histogram"}


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -42,6 +42,12 @@
 #include "ntp_scanner.h"
 #include "ntp_parser.tab.h"
 
+/* Hack to dance around bug in older Bison.  See Issue 287 */
+/* Similar for yydebug below */
+#ifndef yyparse
+  int yyparse (void);
+#endif
+
 /* NetInfo configuration locations */
 #ifdef HAVE_NETINFO_NI_H
 #define NETINFO_CONFIG_DIR "/config/ntp"
@@ -3017,6 +3023,10 @@ void readconfig(const char *config_file)
 
 	/*** BULK OF THE PARSER ***/
 #ifdef DEBUG
+#ifndef yydebug
+  /* See comment above for yyparse */
+  extern int yydebug;
+#endif
 	yydebug = !!(debug >= 5);
 #endif
 


=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -609,7 +609,7 @@ local_clock(
 
 			clock_frequency = direct_freq(fp_offset);
 
-			/* fall through to EVNT_SPIK */
+			/* falls through to EVNT_SPIK */
 
 		/*
 		 * In SPIK state we ignore succeeding outliers until
@@ -620,7 +620,7 @@ local_clock(
 			if (mu < clock_minstep)
 				return (0);
 
-			/* fall through to default */
+			/* falls through to default */
 
 		/*
 		 * We get here by default in NSET and FSET states and


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -2445,6 +2445,7 @@ if (NULL == server->dstadr)
 		server->nextdate = current_time;
 		peer_update_hash(server);
 		peer_xmit(server);
+		poll_update(server, server->hpoll);
 
 		msyslog(LOG_INFO, "Setup server %s", socktoa(rmtadr));
 		return;


=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -667,12 +667,19 @@ neoclock4x_control(int unit,
       tt = add_var(&out->kv_list, sizeof(tmpbuf)-1, RO|DEF);
       snprintf(tt, sizeof(tmpbuf)-1, "calc_utc=\"%s\"", tmpbuf);
 
-      tt = add_var(&out->kv_list, 40, RO|DEF);
-      snprintf(tt, 39, "radiosignal=\"%s\"", up->radiosignal);
-      tt = add_var(&out->kv_list, 40, RO|DEF);
-      snprintf(tt, 39, "antenna1=\"%d\"", up->antenna1);
-      tt = add_var(&out->kv_list, 40, RO|DEF);
-      snprintf(tt, 39, "antenna2=\"%d\"", up->antenna2);
+#define MAXINTSIZE	20	/* max % of decimal digits in integer */
+#define S_RADIOSIGNAL	sizeof(up->radiosignal) + 15
+      tt = add_var(&out->kv_list, S_RADIOSIGNAL+1, RO|DEF);
+      snprintf(tt, S_RADIOSIGNAL, "radiosignal=\"%s\"", up->radiosignal);
+#undef S_RADIOSIGNAL 
+#define S_ANTENNA1	MAXINTSIZE + 12
+      tt = add_var(&out->kv_list, S_ANTENNA1+1, RO|DEF);
+      snprintf(tt, S_ANTENNA1, "antenna1=\"%d\"", up->antenna1);
+#undef S_ANTENNA1
+#define S_ANTENNA2	MAXINTSIZE + 12
+      tt = add_var(&out->kv_list, S_ANTENNA2+1, RO|DEF);
+      snprintf(tt, S_ANTENNA2, "antenna2=\"%d\"", up->antenna2);
+#undef S_ANTENNA2
       tt = add_var(&out->kv_list, 40, RO|DEF);
       if('A' == up->timesource)
 	snprintf(tt, 39, "timesource=\"radio\"");
@@ -694,14 +701,21 @@ neoclock4x_control(int unit,
         snprintf(tt, 39, "dststatus=\"winter\"");
       else
         snprintf(tt, 39, "dststatus=\"unknown\"");
-      tt = add_var(&out->kv_list, 80, RO|DEF);
-      snprintf(tt, 79, "firmware=\"%s\"", up->firmware);
-      tt = add_var(&out->kv_list, 40, RO|DEF);
-      snprintf(tt, 39, "firmwaretag=\"%c\"", up->firmwaretag);
+#define S_FIRMWARE	sizeof(up->firmware) + 13 
+      tt = add_var(&out->kv_list, S_FIRMWARE+1, RO|DEF);
+      snprintf(tt, S_FIRMWARE, "firmware=\"%s\"", up->firmware);
+#undef S_FIRMWARE
+#define S_FIRMWARETAG	sizeof(up->firmware) + 15 
+      tt = add_var(&out->kv_list, S_FIRMWARETAG+1, RO|DEF);
+      snprintf(tt, S_FIRMWARETAG, "firmwaretag=\"%c\"", up->firmwaretag);
+#undef S_FIRMWARETAG
       tt = add_var(&out->kv_list, 80, RO|DEF);
       snprintf(tt, 79, "driver version=\"%s\"", NEOCLOCK4X_DRIVER_VERSION);
-      tt = add_var(&out->kv_list, 80, RO|DEF);
-      snprintf(tt, 79, "serialnumber=\"%s\"", up->serial);
+#define S_SERIAL	sizeof(up->serial) + 16
+      tt = add_var(&out->kv_list, S_SERIAL+1, RO|DEF);
+      snprintf(tt, S_SERIAL, "serialnumber=\"%s\"", up->serial);
+#undef S_SERIAL
+#undef MAXINTSIZE
     }
 }
 


=====================================
ntpd/wscript
=====================================
--- a/ntpd/wscript
+++ b/ntpd/wscript
@@ -19,7 +19,8 @@ def build(ctx):
 
         ctx(
             cwd=srcnode,
-            rule='VCS_EXTRA=`cat ${SRC[0]}` wafhelpers/autorevision.sh -o ${TGT[1].abspath()} -e VERSION -t h >${TGT[0].abspath()}',
+            rule='VCS_EXTRA=`cat ${SRC[0]}` wafhelpers/autorevision.sh '
+                 '-o ${TGT[1].abspath()} -e VERSION -t h >${TGT[0].abspath()}',
             source=["../VERSION", '../wafhelpers/autorevision.sh'],
             target=[target3, target4],
         )


=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -1060,8 +1060,8 @@ class ControlSession:
             except struct.error:
                 raise ControlException(SERR_UNSPEC)
 
-            if ((rpkt.version() > ntp.magic.NTP_VERSION
-                 or rpkt.version() < ntp.magic.NTP_OLDVERSION)):
+            if ((rpkt.version() > ntp.magic.NTP_VERSION or
+                    rpkt.version() < ntp.magic.NTP_OLDVERSION)):
                 if self.debug:
                     warn("Fragment received with version %d\n"
                          % rpkt.version())
@@ -1576,8 +1576,8 @@ Receive a nonce that can be replayed - combats source address spoofing
                 for i in range(len(span.entries)):
                     e = span.entries[len(span.entries) - i - 1]
                     incr = ", addr.%d=%s, last.%d=%s" % (i, e.addr, i, e.last)
-                    if ((len(req_buf) + len(incr)
-                         >= ntp.control.CTL_MAX_DATA_LEN)):
+                    if ((len(req_buf) + len(incr) >=
+                            ntp.control.CTL_MAX_DATA_LEN)):
                         break
                     else:
                         req_buf += incr
@@ -1637,8 +1637,6 @@ Receive a nonce that can be replayed - combats source address spoofing
         "Retrieve ifstats data."
         return self.__ordlist("ifstats")
 
-DEFAULT_KEYFILE = "/usr/local/etc/ntp.keys"
-
 
 class Authenticator:
     "MAC authentication manager for NTP packets."
@@ -1646,16 +1644,15 @@ class Authenticator:
     def __init__(self, keyfile=None):
         # We allow I/O and permission errors upward deliberately
         self.passwords = {}
-        if keyfile is None:
-            keyfile = DEFAULT_KEYFILE
-        for line in open(keyfile):
-            if '#' in line:
-                line = line[:line.index("#")]
-            line = line.strip()
-            if not line:
-                continue
-            (keyid, keytype, passwd) = line.split()
-            self.passwords[int(keyid)] = (keytype, passwd)
+        if keyfile is not None:
+            for line in open(keyfile):
+                if '#' in line:
+                    line = line[:line.index("#")]
+                line = line.strip()
+                if not line:
+                    continue
+                (keyid, keytype, passwd) = line.split()
+                self.passwords[int(keyid)] = (keytype, passwd)
 
     def __len__(self):
         return len(self.passwords)


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -1007,23 +1007,40 @@ class IfstatsSummary:
     "Reusable class for ifstats entry summary generation."
     header = """\
     interface name                                        send
- #  address/broadcast     drop flag ttl mc received sent failed peers   uptime
+ #  address/broadcast     drop flag ttl received sent failed peers   uptime
  """
-    width = 72
+    width = 74
+    # Numbers are the fieldsize
+    fields = {'name':  '%-24.24s',
+              'flags': '%4x',
+              'tl':    '%3d',
+              'rx':    '%6d',
+              'tx':    '%6d',
+              'txerr': '%6d',
+              'pc':    '%5d',
+              'up':    '%8d'}
 
     def summary(self, i, variables):
+        formatted = {}
+        for name in self.fields.keys():
+            value = variables.get(name, "?")
+            if value == "?":
+                fmt = value
+            else:
+                fmt = self.fields[name] % value
+            formatted[name] = fmt
         try:
-            s = ("%3u %-24.24s %c %4x %3d %6d %6d %6d %5d %8d\n    %s\n"
-                 % (i, variables['name'],
+            s = ("%3u %-24.24s %c %4s %3s %6s %6s %6s %5s %8s\n    %s\n"
+                 % (i, formatted['name'],
                     '.' if variables['en'] else 'D',
-                     variables.get('flags', '?'),
-                     variables.get('tl', '?'),
-                     variables.get('rx', '?'),
-                     variables.get('tx', '?'),
-                     variables.get('txerr', '?'),
-                     variables.get('pc', '?'),
-                     variables.get('up', '?'),
-                     variables.get('addr', '?')))
+                    formatted['flags'],
+                    formatted['tl'],
+                    formatted['rx'],
+                    formatted['tx'],
+                    formatted['txerr'],
+                    formatted['pc'],
+                    formatted['up'],
+                    variables.get('addr', '?')))
             if variables.get("bcast"):
                 s += "    %s\n" % variables['bcast']
         except TypeError:


=====================================
pylib/wscript
=====================================
--- a/pylib/wscript
+++ b/pylib/wscript
@@ -35,7 +35,8 @@ def build(ctx):
     ctx(
         before=['pyc', 'pyo'],
         cwd=srcnode,
-        rule='VCS_EXTRA=`cat ${SRC[0]}` ../wafhelpers/autorevision.sh -o ${TGT[1].abspath()} -e VERSION -t python >${TGT[0].name}',
+        rule='VCS_EXTRA=`cat ${SRC[0]}` ../wafhelpers/autorevision.sh '
+             '-o ${TGT[1].abspath()} -e VERSION -t python >${TGT[0].name}',
         source=["../VERSION", '../wafhelpers/autorevision.sh'],
         target=[target3, target4],
     )


=====================================
tests/libntp/lfpfunc.c
=====================================
--- a/tests/libntp/lfpfunc.c
+++ b/tests/libntp/lfpfunc.c
@@ -93,16 +93,6 @@ static int l_fp_signum(const l_fp first)
 	return (lfpuint(first) || lfpfrac(first));
 }
 
-static void l_fp_swap(l_fp * first, l_fp *second)
-{
-	l_fp temp = *second;
-
-	*second = *first;
-	*first = temp;
-
-	return;
-}
-
 //----------------------------------------------------------------------
 // testing the relational macros works better with proper predicate
 // formatting functions; it slows down the tests a bit, but makes for
@@ -239,6 +229,19 @@ TEST(lfpfunc, Absolute) {
 	return;
 }
 
+static const l_fp roundtab[] = {
+  0,
+  0x140000000,
+  0x1c0000000,
+  0xffffffff80000000,
+  0x7fffffff7fffffff,
+  0x7fffffffffffffff,
+  0x55555555aaaaaaaa,
+  0x5555555555555555,
+  0x8000000000000001
+};
+static const size_t round_cnt = (sizeof(roundtab)/sizeof(roundtab[0]));
+
 
 //----------------------------------------------------------------------
 // fp -> double -> fp roundtrip test
@@ -254,16 +257,14 @@ TEST(lfpfunc, FDF_RoundTrip) {
 	// and checks the difference in the two 'l_fp' values against
 	// that limit.
 
-	for (idx = 0; idx < addsub_cnt; ++idx) {
-                double op2, d;
-		l_fp op1 = lfpinit_u(addsub_tab[idx][0].l_ui,
-                                     addsub_tab[idx][0].l_uf);
-		op2 = lfptod(op1);
+	for (idx = 0; idx < round_cnt; ++idx) {
+		l_fp op1 = roundtab[idx];
+		double op2 = lfptod(op1);
 		l_fp op3 = dtolfp(op2);
 
 		l_fp temp = op1 - op3;
-		d = lfptod(temp);
-                /* cast to long unsigned int for 32 bit binaries */
+		double d = lfptod(temp);
+
                 snprintf(msg, sizeof(msg),
                          "\nop2: %f op3: %s diff %f not within %e",
                          op2, mfptoa(op3, 8), d, eps(op2));
@@ -291,9 +292,9 @@ TEST(lfpfunc, SignedRelOps) {
 
 		switch (cmp) {
 		case -1:
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
-			l_fp_swap(&op1, &op2);
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
+			TEST_ASSERT_TRUE (l_isgt(op2, op1));
+			TEST_ASSERT_FALSE(l_isgt(op1, op2));
+			break;
 		case 1:
 			TEST_ASSERT_TRUE (l_isgt(op1, op2));
 			TEST_ASSERT_FALSE(l_isgt(op2, op1));
@@ -304,6 +305,7 @@ TEST(lfpfunc, SignedRelOps) {
 			break;
 		default:
 			TEST_FAIL_MESSAGE("unexpected UCMP result: ");
+			break;
 		}
 	}
 
@@ -321,9 +323,9 @@ TEST(lfpfunc, UnsignedRelOps) {
 
 		switch (cmp) {
 		case -1:
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
-			l_fp_swap(&op1, &op2);
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
+			TEST_ASSERT_TRUE (l_isgtu(op2, op1));
+			TEST_ASSERT_FALSE(l_isgtu(op1, op2));
+			break;
 		case 1:
 			TEST_ASSERT_TRUE (l_isgtu(op1, op2));
 			TEST_ASSERT_FALSE(l_isgtu(op2, op1));


=====================================
tests/pylib/test_util.py
=====================================
--- a/tests/pylib/test_util.py
+++ b/tests/pylib/test_util.py
@@ -71,7 +71,7 @@ class TestPylibUtilMethods(unittest.TestCase):
                          ("-12.345678900987654321", -2))
         # Bizarre 2
         self.assertEqual(f("1234567890987654321000.00000000000042"),
-                           ("1.23456789098765432100000000000000042", 7))
+                         ("1.23456789098765432100000000000000042", 7))
         # Bizarre 3
         self.assertEqual(f("00000000.000000000000"),
                          ("0", -4))
@@ -213,25 +213,30 @@ class TestPylibUtilMethods(unittest.TestCase):
         # No scale
         self.assertEqual(ntp.util.stringfiltcooker(
             "1.02 34.5 0.67835 -23.0 9 6.7 1.00 .1"),
-            "   1.02    34.5 0.67835   -23.0       9     6.7    1.00     0.1 ms"
+            "   1.02    34.5 0.67835   -23.0       9     6.7    1.00     "
+            "0.1 ms"
         )
         # Scale to larger unit
         self.assertEqual(ntp.util.stringfiltcooker(
             "1000.02 3400.5 0.67835 -23.0 9001 6.7 1.00 1234"),
-            "1.00002  3.4005 0.00068 -0.0230   9.001  0.0067 0.00100   1.234 s"
+            "1.00002  3.4005 0.00068 -0.0230   9.001  0.0067 0.00100   "
+            "1.234 s"
         )
         # Scale to smaller unit
         self.assertEqual(ntp.util.stringfiltcooker(
             "0.470 0.420 0.430 0.500 0.460 0.4200 0.490 0.480"),
-            u"    470     420     430     500     460   420.0     490     480 \u03bcs")
+            u"    470     420     430     500     460   420.0     490     "
+            "480 \u03bcs")
         # Can't scale
         self.assertEqual(ntp.util.stringfiltcooker(
             "0.47 0.42 0.43 0.50 0.46 0.42 0.49 0.48"),
-            "   0.47    0.42    0.43    0.50    0.46    0.42    0.49    0.48 ms")
+            "   0.47    0.42    0.43    0.50    0.46    0.42    0.49    "
+            "0.48 ms")
         # Can't scale, only one value blocking
         self.assertEqual(ntp.util.stringfiltcooker(
             "0.47 0.4200 0.4300 0.5000 0.4600 0.4200 0.4900 0.4800"),
-            "   0.47  0.4200  0.4300  0.5000  0.4600  0.4200  0.4900  0.4800 ms")
+            "   0.47  0.4200  0.4300  0.5000  0.4600  0.4200  0.4900  "
+            "0.4800 ms")
 
     def test_unitrelativeto(self):
         f = ntp.util.unitrelativeto


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -7,7 +7,7 @@ def build(ctx):
         "unity/unity_fixture.c",
     ]
 
-    unity_config = ["UNITY_INCLUDE_DOUBLE","UNITY_SUPPORT_64"]
+    unity_config = ["UNITY_INCLUDE_DOUBLE", "UNITY_SUPPORT_64"]
 
     ctx(
         defines=unity_config,
@@ -77,7 +77,7 @@ def build(ctx):
             includes=["%s/tests/unity/" % srcnode,
                       "%s/tests/libparse/" % srcnode,
                       "%s/tests/common/" % srcnode
-            ] + ctx.env.PLATFORM_INCLUDES,
+                      ] + ctx.env.PLATFORM_INCLUDES,
             install_path=None,
             lib=["parse"],
             libpath=["libparse"],
@@ -87,7 +87,7 @@ def build(ctx):
         )
 
     ntpd_source = [
-#        "ntpd/filegen.c",
+        # "ntpd/filegen.c",
         "ntpd/leapsec.c",
         "ntpd/restrict.c",
     ] + common_source


=====================================
wafhelpers/check_cap.py
=====================================
--- a/wafhelpers/check_cap.py
+++ b/wafhelpers/check_cap.py
@@ -12,8 +12,8 @@ def check_cap(ctx):
     ctx.check_cc(header_name="sys/capability.h", mandatory=False)
     ctx.check_cc(lib="cap", comment="Capability library", mandatory=False)
 
-    if ((ctx.get_define("HAVE_SYS_CAPABILITY_H")
-         and ctx.get_define("HAVE_SYS_PRCTL_H") and ctx.env.LIB_CAP)):
+    if ((ctx.get_define("HAVE_SYS_CAPABILITY_H") and
+            ctx.get_define("HAVE_SYS_PRCTL_H") and ctx.env.LIB_CAP)):
         ctx.define("HAVE_LINUX_CAPABILITY", 1)
     else:
         pprint("RED", "Warning libcap and headers not installed")


=====================================
wafhelpers/check_pthread.py
=====================================
--- a/wafhelpers/check_pthread.py
+++ b/wafhelpers/check_pthread.py
@@ -21,8 +21,8 @@ def check_pthread_header_lib(ctx):
     ctx.check_cc(lib="thr", mandatory=False,
                  comment="thr library, required by some operating systems.")
 
-    if ((ctx.get_define("HAVE_PTHREAD_H")
-         and (ctx.env.LIB_PTHREAD or ctx.env.LIB_THR))):
+    if ((ctx.get_define("HAVE_PTHREAD_H") and
+            (ctx.env.LIB_PTHREAD or ctx.env.LIB_THR))):
         ctx.env.PTHREAD_HEADER_LIB = True
 
 


=====================================
wafhelpers/pythonize-header
=====================================
--- a/wafhelpers/pythonize-header
+++ b/wafhelpers/pythonize-header
@@ -12,28 +12,30 @@ Yes, SWIG can do something like this.  But it's heavyweight and would introduce
 another dependency.
 """
 
-import sys, re
+import re
+import sys
 
 patterns = (
     (re.compile(r"/\*(.*)\*/"), r"#\1"),
     (re.compile(r"^/\*"), r"#"),
     (re.compile(r"^ *\*/"), r"#"),
     (re.compile(r"^ \*"), r"#"),
-    (re.compile(r"^#define\s+([A-Za-z0-9_]+[ \t]+)(.*)"), r"\1= \2"), 
+    (re.compile(r"^#define\s+([A-Za-z0-9_]+[ \t]+)(.*)"), r"\1= \2"),
     (re.compile(r"^#define\s+([A-Za-z0-9_]+)\(([a-z_, ]*)\)"),
-     r"def \1(\2): return"), 
+     r"def \1(\2): return"),
     )
 
 skipstarters = ("struct", "union", "typedef struct", "typedef union")
 
 skippers = (
-    re.compile(r"^#include"), 
-    re.compile(r"^typedef.*;\s*$"), 
-    re.compile(r"^extern.*;\d*$"), 
+    re.compile(r"^#include"),
+    re.compile(r"^typedef.*;\s*$"),
+    re.compile(r"^extern.*;\d*$"),
     )
 
 impossibles = ("sizeof", "offsetof")
 
+
 def pythonize(rfp, wfp):
     "Pythonize a specified C header file."
     wfp.write("# This file was generated by pythonize-header;\n")


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -205,8 +205,8 @@ def configure(ctx):
         ctx.env.DISABLE_MANPAGE = True
 
     from waflib.Utils import subprocess
-    if ((os.path.exists(".git")
-         and ctx.find_program("git", var="BIN_GIT", mandatory=False))):
+    if ((os.path.exists(".git") and
+            ctx.find_program("git", var="BIN_GIT", mandatory=False))):
         ctx.start_msg("DEVEL: Getting revision")
         cmd = ["git", "log", "-1", "--format=%H"]
         p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
@@ -693,8 +693,8 @@ int main(int argc, char **argv) {
             # Sanity check...
             print("Compilation check failed but include exists %s" % hdr)
 
-    if ((ctx.get_define("HAVE_TIMEPPS_H")
-         or ctx.get_define("HAVE_SYS_TIMEPPS_H"))):
+    if ((ctx.get_define("HAVE_TIMEPPS_H") or
+            ctx.get_define("HAVE_SYS_TIMEPPS_H"))):
         ctx.define("HAVE_PPSAPI", 1, comment="Enable the PPS API")
 
     # Check for Solaris capabilities
@@ -772,8 +772,8 @@ int main(int argc, char **argv) {
     # file /usr/include/sys/timex.h for the particular
     # architecture to be in place."
     #
-    if ((ctx.get_define("HAVE_SYS_TIMEX_H")
-         and not ctx.options.disable_kernel_pll)):
+    if ((ctx.get_define("HAVE_SYS_TIMEX_H") and
+            not ctx.options.disable_kernel_pll)):
         ctx.define("HAVE_KERNEL_PLL", 1,
                    comment="Whether phase-locked loop for timing "
                    "exists and is enabled")
@@ -971,15 +971,16 @@ def afterparty(ctx):
     # Also, they need to be able to see the Python extension
     # module built in libntp.
     if ctx.cmd == 'clean' or ctx.cmd == 'distclean':
-        ctx.exec_command("rm -f wafhelpers/*.pyc pylib/__pycache__/*.pyc wafhelpers/__pycache__/*.pyc ntpd/version.h")
+        ctx.exec_command("rm -f wafhelpers/*.pyc pylib/__pycache__/*.pyc "
+                         "wafhelpers/__pycache__/*.pyc ntpd/version.h")
     for x in ("ntpclients",):
         # List used to be longer...
         path_build = ctx.bldnode.make_node("pylib")
         path_source = ctx.srcnode.make_node(x + "/ntp")
         relpath = "../" + path_build.path_from(ctx.srcnode)
         if ctx.cmd in ('install', 'build'):
-            if ((not path_source.exists()
-                 or os.readlink(path_source.abspath()) != relpath)):
+            if ((not path_source.exists() or
+                    os.readlink(path_source.abspath()) != relpath)):
                 try:
                     os.remove(path_source.abspath())
                 except OSError:
@@ -1098,12 +1099,14 @@ def build(ctx):
 
 def systemdenable(ctx):
     "Enable boot time start with systemd. Must run as root."
-    ctx.exec_command("cp etc/ntpd.service etc/ntp-wait.service /usr/lib/systemd/system/")
+    ctx.exec_command("cp etc/ntpd.service etc/ntp-wait.service "
+                     "/usr/lib/systemd/system/")
 
 
 def systemddisable(ctx):
     "Disable boot time start with systemd. Must run as root."
-    ctx.exec_command("rm -f /usr/lib/systemd/system/ntpd.service /usr/lib/systemd/system/ntp-wait.service")
+    ctx.exec_command("rm -f /usr/lib/systemd/system/ntpd.service "
+                     "/usr/lib/systemd/system/ntp-wait.service")
 
 #
 # Miscellaneous utility productions
@@ -1124,8 +1127,8 @@ def loccount(ctx):
 
 def cxfreeze(ctx):
     "Create standalone binaries from Python scripts."
-    ctx.exec_command("for prog in " + " ".join(python_scripts)
-                     + "; do cxfreeze $prog; done")
+    ctx.exec_command("for prog in " + " ".join(python_scripts) +
+                     "; do cxfreeze $prog; done")
 
 
 def linkcheck(ctx):



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/98d1b8597c981dba0f38d09247ae72e3fd3acaed...19d683db53cdb4d6af2607a775bb0faec3419230

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/98d1b8597c981dba0f38d09247ae72e3fd3acaed...19d683db53cdb4d6af2607a775bb0faec3419230
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170507/9f94f4d6/attachment.html>


More information about the vc mailing list