[rancid] Re: clogin bug setting prompt
Casey T. Deccio
ctdecci at sandia.gov
Thu Feb 28 00:26:01 UTC 2008
On Wed, 2008-02-27 at 11:36 -0700, Casey T. Deccio wrote:
> Apologies if this is known already. I am running RANCID 2.3.1 with
> expect 5.42.1. In clogin there is a bug in setting the prompt
> appropriately for switches using the "xyz> (enable)" prompt (or any
> other prompts including characters with special regex meaning--besides
> brackets). The parentheses from the $expect_out(buffer) are not escaped
> when the prompt variable is updated, so when "expect -re $prompt {}" is
> called, the prompt matches "xyz> enable" but not "xyz> (enable)". I've
> attached a patch to clogin (it includes other characters too, just in
> case they may need to be escaped also).
I think the patch I created is the wrong fix in the wrong place. I'm
guessing the substitution I refer to in the patch is meant for escaping
only the square brackets, so TCL does not interpret them as a command.
It was not intended to escape regex atoms.
The appropriate escaping of regex atoms is performed in the first ~25
lines of the run_commands proc. The problem is that this code isn't run
if the -s switch is used. Maybe it would be most beneficial to define a
proc that returned a reprompt, which was then called after getting the
"full prompt"? Then the resulting $reprompt could be used by both the
run_commands proc and subsequent commands for the file.
Casey
More information about the Rancid-discuss
mailing list