[rancid] Re: clogin bug setting prompt

john heasley heas at shrubbery.net
Wed Feb 27 20:35:31 UTC 2008


Wed, Feb 27, 2008 at 10:36:14AM -0800, Casey T. Deccio:
> 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).

Not escaping the () grouping atoms for Catalyst prompts is definitely a bug,
thanks.

I suppose not escaping the . atom is also a bug; is there a reason that you
only applied this fix to Catalyst prompts?

As for the +?{} atoms, these simply seem inappropriate for prompts.  Just
as '(enable)' rather offensive.  I feel inclined to suggest that the
configuration should be fixed rather than make this change.  Is that short
sighted?

> --- clogin	2008-02-27 10:26:09.000000000 -0800
> +++ clogin.new	2008-02-27 10:26:47.000000000 -0800
> @@ -751,7 +751,7 @@
>  				}
>  	-re "^.+> \\\(enable\\\)"	{
>  				  set junk $expect_out(0,string);
> -				  regsub -all "\[\]\[]" $junk {\\&} prompt;
> +				  regsub -all "\[\]\[\(\)+.?{}]" $junk {\\&} prompt;
>  				}
>      }
>  

> _______________________________________________
> 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