Re: [rancid] clogin commenting script commands following multiple blanks lines

Erik Muller <[email protected]>
Newsgroups gmane.network.rancid
Message-ID <[email protected]>
On 10/24/18 13:28 , heasley wrote:
> Sat, Sep 29, 2018 at 03:19:00PM -0700, Erik Muller:
>> 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
> 
> I believe that patch addresses this bug.


That definitely fixes the blanks-may-comment-the-next-line issue, though it looks like it also breaks handling of escaped ;s as well.

before:
$ clogin-3.8 -c 'sh ip bgp nei | inc 1\; ; show ver | inc ^Model Num' fl1-as01
...
fl1-as01#sh ip bgp nei | inc 1;
  Route to peer address reachability Up: 1; Down: 0
  Connections established 1; dropped 0


with patch:
$ clogin -c 'sh ip bgp nei | inc 1\; ; show ver | inc ^Model Num' fl1-as01
...
fl1-as01#sh ip bgp nei | inc 1
BGP neighbor is x.x.x.x,  remote AS 4200000000, external link



And it seems to eat leading semicolon comments as well:

$ cat ~/clogin-blanks-test2
show bridge
; just a comment
$ clogin -x ~/clogin-blanks-test2 fl1-as01.polaris.corp
...
fl1-as01#show bridge
fl1-as01#
fl1-as01#
fl1-as01#
fl1-as01# just a comment
          ^
% Invalid input detected at '^' marker.



_______________________________________________
Rancid-discuss mailing list
[email protected]
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.