[rancid] cygwin + long hostname = clogin hang

john heasley heas at shrubbery.net
Fri Aug 27 16:00:12 UTC 2010


Fri, Aug 27, 2010 at 10:06:25AM -0400, Lee:
> On 8/24/10, john heasley <heas at shrubbery.net> wrote:
> > 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.
> 
> Just out of curiosity - what made you pick up to the first 11 chars of
> the prompt?

i do not remember exactly how I arrived at 11, but it is a balance of
being as long as possible to be unique and maintaining the match when in
configure mode (see -x and -s).

>   <.. snip regex problem description ..>
> >>
> >> 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.
> 
> Is there some situation where sending "exit\r" after getting a timeout
> would be a bad idea?

you may not have a file descriptor to write to, but otherwise i doubt it.
its as easy to just close the connection and it then the script does not
need to consider state of the device, though it means that it relies upon
the device to clean-up.


More information about the Rancid-discuss mailing list