[rancid] clogin doesn't send explicitly set new lines

heasley heas at shrubbery.net
Thu May 16 15:22:09 UTC 2013


Wed, May 15, 2013 at 03:38:13PM -0400, Aliaksei Sheshka:
> Hi!
> 
> I'm facing rather strange clogin issue.
> Consider file :
> ----begin nyy-r14-confg.sample file ---
> sh clock
> copy system:/running-config tftp://10.18.15.11/nyy-r14-confg
> 
> 
> 
> 
> sh clock
> ----end nyy-r14-confg.sample file ---
> There are four lines with '\n' only.
> My idea was that:
> cisco says -> Address or name of remote host [10.18.15.11]?
> clogin sends -> '\n'
> cisco says -> Destination filename [nyy-r14-confg]?
> clogin sends -> '\n'
> And then two times '\n' just for test.
> Nope, clogin just stuck. Debug message for "$clogin -d -t 3600 -x
> nyy-r14-confg.sample nyy-r14" :
> 
> expect: does "Address or name of remote host [10.18.15.11]? "
> (spawn_id exp6) match regular expression "\u0008+"? (No Gate, RE only)
> gate=yes re=no
> "^[^\n\r *]*nyy-r14([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? Gate "*nyy-r14*"? gate=no
> "^[^\n\r]*nyy-r14([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? Gate "*nyy-r14*"? gate=no
> "^--More--[\r\n]+"? Gate "--More--*"? gate=no
> "[^\r\n]*[\n\r]+"? (No Gate, RE only) gate=yes re=no
> "[^\r\n]*Press <SPACE> to cont[^\r\n]*"? Gate "*Press <SPACE> to cont*"? gate=no
> "^ *--More--[^\n\r]*"? Gate "*--More--*"? gate=no
> "^<-+ More -+>[^\n\r]*"? (No Gate, RE only) gate=yes re=no

its looking for stuff that matches the prompt regex it has concocted:
^[^\n\r]*nyy-r14([^#>\r\n]+)?[#>](\([^)\r\n]+\))?.

if you want to embed commands in commands with alternate prompting, they
must be embedded on one line:
show clock
copy blah blah\n\n
show clock

or use the -s option instead and see rancid/share/*.exp.
> And then nothing, timeout.
> System is Debian wheezy
> expect                           5.44.1.15-4
> rancid                           2.3.8-3
> 
> I added some lines:
> $diff /usr/lib/rancid/bin/clogin.orig /usr/lib/rancid/bin/clogin
> 707a708,715
> >          -re "Destination filename" {
> >                                                   send_user -- "$expect_out(buffer)"
> >                                                   send "\n"
> >                                                   exp_continue }
> >            -re "Address or name of remote host" {
> >                                                   send_user -- "$expect_out(buffer)"
> >                                                   send "\n"
> >                                                   exp_continue }
> 
> and that suddenly fixed the issue.
> 
> That puzzled me, because I had a FreeBSD system with expect 5.44 and
> rancid 2.3.6 and the same nyy-r14-confg.sample was processed without
> any issues.
> What could be wrong ?
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss


More information about the Rancid-discuss mailing list