Does ntpq have a command line history mechanism?

Eric S. Raymond esr at thyrsus.com
Sat Dec 23 20:24:32 UTC 2017


Matthew Selsky via devel <devel at ntpsec.org>:
> On Fri, Dec 22, 2017 at 06:42:00AM -0500, Eric S. Raymond via devel wrote:
> > Hal Murray via devel <devel at ntpsec.org>:
> > > 
> > > I was expecting one, but I get things like this:
> > > ntpq> ^[[A^[[A^[[B
> > > ***Command `' ambiguous
> > > ntpq> 
> > > 
> > > That was up-arrow, up-arrow, down-arrow
> > > 
> > > Is there some package I need to install?
> > 
> > Up arrow and down arrow should work already.  I am shocked to find that
> > they do not.
> > 
> > This is a serious regression.  Who removed the import of readline, and why?
> 
> I removed it.  See:
> https://gitlab.com/NTPsec/ntpsec/commit/c5ed321067a939c2d360fb78145a6bd314e16e22
> 
> The Cmd module should be importing readline for us, when available, since 2001. See:
> https://github.com/python/cpython/commit/66b6e192b9d0437029f8fd7aa9f381bb4e9ed248
> 
> @Hal, can you double-check that the readline python module is importable on your system?  You might need libedit or GNU readline installed.
> 
> Would it help to add an informational check for this python module in waf's configure?

Alas. I don't think so.

Hal's bug replicates on my Ubuntu 16.10. I remember
up-arrow/down-arrow working correctly, but I don't remember when.

I tried adding an explict import just after the import from future:

try:
    import readline
    print("Import OK")
except:
    pass

I do see "import OK", so readline is available, but control keys continue
to fail (Ctl-P and Ctl-N also don't work).

On the other hand, the following trivial use of cmd.Cmd works correctly.

----------------------------------------------------------------
import cmd, readline

class SampleInterpreter(cmd.Cmd):
    def __init__(self):
        cmd.Cmd.__init__(self)
    def do_echo(self, line):
        "Sample echo command."
        print line

me = SampleInterpreter()
me.cmdloop("Hello World")
----------------------------------------------------------------

This is highly annoying. We've done someting in our interpreter that busts
that feature, but it is not obvious what.  Perhaps the polyglot changes?

I'll dig into this further when I get back from sword class
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.




More information about the devel mailing list