Python ntpq
Eric S. Raymond
esr at thyrsus.com
Sun Nov 27 12:31:57 UTC 2016
Achim Gratz <Stromeko at nexgo.de>:
> Eric S. Raymond writes:
> > ...or maybe not. Rather klugey fix pushed. Complain if it needs
> > futher work.
>
> Breaks as follows:
>
> pi at raspberrypi2:~/ntpsec $ ntpq/ntpq -p -c "cv &1" -c "cv &2"
> remote refid st t when poll reach delay offset jitter
> ==============================================================================
> NMEA(0) .uBx8. 0 l 10 16 377 0.000 -4.070 2.224
> oNMEA(1) .NavS. 0 l 9 16 377 0.000 -0.001 0.003
> ptbtime1.ptb.de .PTB. 1 u 9 64 377 27.571 0.751 0.081
> ptbtime2.ptb.de .PTB. 1 u 18 64 377 27.396 0.783 0.098
> ptbtime3.ptb.de .PTB. 1 u - 64 377 25.930 0.111 0.132
> Traceback (most recent call last):
> File "ntpq/ntpq", line 1590, in <module>
> interpreter.onecmd(cmd)
> File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
> return func(arg)
> File "ntpq/ntpq", line 1082, in do_cv
> self.do_clockvar(line)
> File "ntpq/ntpq", line 1072, in do_clockvar
> self.__dolist(line.split()[1:], assoc, ntp.packet.CTL_OP_READCLOCK, ntp.ntpc.TYPE_CLOCK)
> File "ntpq/ntpq", line 456, in __dolist
> variables = self.session.readvar(associd, varlist, op)
> File "/usr/lib/python2.7/dist-packages/ntp/packet.py", line 1139, in readvar
> return collections.OrderedDict(items)
> File "/usr/lib/python2.7/dist-packages/ntp/packet.py", line 1110, in __parse_varlist
> response += c
> TypeError: 'str' object does not support item assignment
Not reproducing here. I get:
esr at snark:~/software/ntp-rescue/ntpsec$ ntpq/ntpq -p -c "cv &1" -c "cv &2"
remote refid st t when poll reach delay offset jitter
=================================================================================
us.pool.ntp.org .POOL. 16 p - 64 0 0.000 0.000 0.001
-104.131.53.252 209.51.161.238 2 u 54 1024 377 8.349 2.995 2.124
-104.156.99.226 164.67.62.194 2 u 876 1024 377 80.653 7.029 19.653
-mirror 199.233.236.226 3 u 1049 1024 377 29.468 2.902 0.394
-mis.wci.com 131.107.13.100 2 u 37 1024 377 78.478 2.798 3.091
*level1e.cs.unc.edu .PPS. 1 u 189 1024 377 31.141 0.426 0.784
-66.241.101.63 169.254.0.2 2 u - 1024 377 61.246 8.378 4.832
+helium.constant.co 128.59.0.245 2 u 954 1024 377 12.912 -1.199 1.149
-enigma.wiredgoats. 64.142.122.38 2 u 44 1024 377 78.486 3.660 0.893
+mail.coldnorthadmi 132.246.11.231 2 u 58 1024 377 10.804 -0.017 0.589
***Server error code BADASSOC
***Server error code BADASSOC
Possibly this is a Python-3-specific issue? Not that that doesn't mean
we should fix it.
> Also, it seems that association indices can't be used if you do not
> print any peer list:
>
> pi at raspberrypi2:~/ntpsec $ ntpq/ntpq -c "cv &1" -c "cv &2"
> No such index.
> No such index.
>
> I havent tracked when it was broken, but I assume this is a missing
> initialization and was always there.
That is correct. It was like that in C ntpq.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
More information about the devel
mailing list