[rancid] cygwin + long hostname = clogin hang

john heasley heas at shrubbery.net
Tue Aug 24 05:25:17 UTC 2010


Mon, Aug 23, 2010 at 05:44:33PM -0400, Lee:
> clogin hangs when I use it from cygwin to ssh into a cisco switch with
> a long hostname.
> 
> It looks like a bug in cygwin expect causes the timeout.  The
>         expect {
>             -re $reprompt       { }
> at line 611 fails if I've got a long hostname configured on the cisco switch:

likely means that the regex library is broken.  the length is not entirely
arbitrary.

> expect: does "2ndFloorLibrarySW>" (spawn_id 4) match regular
> expression "2ndFloorLib([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
> "[\n\r]+"? no
> expect: timed out
> 
> If I change the pattern to include more of the hostname the match works:
> expect: does "2ndFloorLibrarySW>" (spawn_id 4) match regular
> expression "2ndFloorLibrar([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? yes
> expect: set expect_out(0,string) "2ndFloorLibrarySW>"
> expect: set expect_out(1,string) "ySW"
> expect: set expect_out(spawn_id) "4"
> expect: set expect_out(buffer) "2ndFloorLibrarySW>"
> 
> so my work-around is to use up to 21 characters of the hostname in
> reprompt.  Line 610 changes from
>   regsub -all {^(.{1,11}).*([#>])$} $prompt
> {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
> to
>   regsub -all {^(.{1,21}).*([#>])$} $prompt
> {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
> 
> 
> And then at clogin line 423, if a timeout happens clogin hangs until I
> open task manager and kill the ssh process (<ctrl>C in the terminal
> window doesn't kill it).  The 'catch{close}; catch{wait};' doesn't end
> the ssh session.  Adding a 'send "exit\r"' fixes the hang for me:

maybe try the linux/solaris expect patches.

you could also try a unix box


More information about the Rancid-discuss mailing list