cisco hostname too long

john heasley heas at shrubbery.net
Wed Jan 4 17:01:15 UTC 2006


Wed, Jan 04, 2006 at 02:47:34PM +0200, Sotiris Tsimbonis:
> Hi everyone,
> 
> Recently I faced a problem where rancid could not fetch the config of a 
> new router in my network. The logfile reported the following:
> 
> ------------------------------------------------------------------------
> couldn't compile regular expression pattern: parentheses () not balanced
>     while executing
> "expect -nobrace -re {pcsrouter\(02\([^#>\r\n]+)?[#>](\([^)\r\n]+\))?} 
> {} -re {[
> ^M]+} { exp_continue }"
>     invoked from within
> "expect {
>             -re $reprompt       {}
>             -re "\[\n\r]+"      { exp_continue }
>         }"
>     (procedure "run_commands" line 23)
>     invoked from within
> "run_commands $prompt $command"
>     ("foreach" body line 144)
>     invoked from within
> "foreach router [lrange $argv $i end] {
>     set router [string tolower $router]
>     send_user "$router\n"
> 
>     # Figure out prompt.
>     # Since autoena..."
>     (file "/opt/rancid/bin/clogin" line 617)^M
> !
> ------------------------------------------------------------------------
> 
> The problem was the hostname length, which was more than 14 characters 
> long..
> 
> My solution was to change line 511 of clogin, and put a bigger number 
> instead of 14 (say, 24) ...and the problem was solved :-)

The regex does not exactly limit the length of the hostname, it grabs up
to the first 14 characters, which IOS truncates the name to when entering
config mode (see -x).  w/o truncation, the regex would not match.

my router's configured hostname is "somereallylonghostnamehere" and it
works fine.  Something else is wrong; if altering the size of the bound
atom fixes it, it may be an expect or regex library problem.  what is
the full hostname?



More information about the Rancid-discuss mailing list