[rancid] '>' in default prompt causes problems for zrancid

Tore Anderson tore at fud.no
Wed Apr 23 07:37:55 UTC 2014


* Tore Anderson

> I haven't yet been able to fully understand why the ">" match is causing
> problems, but I did notice that it causes $prompt_match to always be set
> to ">" at lines 576-579 of clogin.in:
> 
>         -re "$prompt"           {
>                                   set prompt_match $expect_out(0,string);
>                                   break;
>                                 }
> 
> However, the routers in question don't use ">" in their prompt (they use
> "#"), so I don't think this can be right.

I've finally figured out what's going on here. It appears that when
$TERM is vt100 (and a bunch of others), vtysh prints out some
(invisible) terminal control codes before the actual prompt. These
include the '>' character, so that's why the prompt matching fails.

This is how the prompt looks when run through "cat -A", FWIW:

^[[?1h^[=^M^M^[[K^[[?1l^[>routername# $

Changing $TERM to something else solves the problem and these garbage
characters disappear. On my Ubuntu 12.04, the following values of $TERM
all seems to work OK:

ansi
cons25
cons25-debian
cygwin
Eterm
Eterm-color
hurd
linux
mach
mach-bold
mach-color
pcansi
sun
vt220
vt52
wsvt25
wsvt25m

Not sure which one of these is the most portable, but in any case, I
suggest changing the hard-coding of $TERM to "vt100" in zrancid to
either of these (or removing it so that it can be set from rancid.conf
instead). Suggested one-line patch attached.

Tore
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zrancid.patch
Type: text/x-patch
Size: 362 bytes
Desc: not available
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20140423/ed3e0c0a/attachment.bin>


More information about the Rancid-discuss mailing list