[rancid] clogin commenting script commands following multiple blanks lines
Erik Muller
erikm at buh.org
Sat Sep 29 22:19:00 UTC 2018
So here's an odd thing I just ran across. Running clogin with a script with multiple blank lines has some very unexpected behaviour. It looks like it's turning \n\n into \n;, with the net effect of commenting out any command that follows two blank lines. Reproducible on ubuntu 12.04 and OSX 10.13 with stock 3.8 source. Works as expected in 2.3.8 ubuntu packages.
The culprit is definitely in the "# handle escaped ;s in commands, and ;; and ^;" section of clogin (rolling that block back to what was in 2.3.8 fixes it), but trying to grok that in expect language to provide a real fix makes my head hurt, so I'll leave this as a bug report. Examples below.
thanks,
-e
3.8 output:
erikm at status:~/src/rancid-3.8$ cat ~/test1
show ip int br | inc 701
show ip int br | inc 701
erikm at status:~/src/rancid-3.8$ ~/rancidtest/bin/clogin -x ~/test1 csw1.xxx
spawn ssh -c aes192-ctr -x -l erikm csw1.xxx
...
csw1.xxx#terminal width 132
csw1.xxx#show ip int br | inc 701
Vlan701 10.254.248.1 YES manual up up
csw1.xxx#
csw1.xxx#;show ip int br | inc 701
csw1.xxx#
csw1.xxx#exit
Connection to csw1.xxx closed.
erikm at status:~/src/rancid-3.8$ cat ~/test2
show ip int br | inc 701
show ip int br | inc 1blanks
show ip int br | inc 2blanks
show ip int br | inc 3blanks
show ip int br | inc 4blanks
show ip int br | inc 5blanks
erikm at status:~/src/rancid-3.8$ ~/rancidtest/bin/clogin -x ~/test2 csw1.xxx
...
csw1.xxx#show ip int br | inc 701
Vlan701 10.254.248.1 YES manual up up
csw1.xxx#
csw1.xxx#show ip int br | inc 1blanks
csw1.xxx#
csw1.xxx#;show ip int br | inc 2blanks
csw1.xxx#
csw1.xxx#;
csw1.xxx#show ip int br | inc 3blanks
csw1.xxx#
csw1.xxx#;
csw1.xxx#
csw1.xxx#show ip int br | inc 4blanks
csw1.xxx#
csw1.xxx#;
csw1.xxx#
csw1.xxx#;show ip int br | inc 5blanks
csw1.xxx#
csw1.xxx#exit
Connection to csw1.xxx closed by remote host.
2.3.8 output:
erikm at status:~/src/rancid-3.8$ clogin -x ~/test2 csw1.xxx
...
csw1.xxx#show ip int br | inc 701
Vlan701 10.254.248.1 YES manual up up
csw1.xxx#
csw1.xxx#show ip int br | inc 1blanks
csw1.xxx#
csw1.xxx#
csw1.xxx#show ip int br | inc 2blanks
csw1.xxx#
csw1.xxx#
csw1.xxx#
csw1.xxx#show ip int br | inc 3blanks
csw1.xxx#
csw1.xxx#
csw1.xxx#
csw1.xxx#
csw1.xxx#show ip int br | inc 4blanks
csw1.xxx#
csw1.xxx#
csw1.xxx#
csw1.xxx#
csw1.xxx#
csw1.xxx#show ip int br | inc 5blanks
csw1.xxx#
csw1.xxx#exit
Connection to csw1.xxx closed.
More information about the Rancid-discuss
mailing list