Re: [rancid] FXOS debugging

heasley <[email protected]>
Newsgroups gmane.network.rancid
Message-ID <[email protected]>
Fri, Nov 30, 2018 at 03:47:23PM +0000, Ryan West:
> John,
> 
> Still hitting the same issue and replicated it on a fresh Ubuntu 18.04 LTS with 8.6 expect/tcl loaded on it.
> 
> > invalid command name "^-"
>     while executing
> "^-"
>     invoked from within
> "expect {
>             -re "\b+"                           { exp_continue }
>             -re "^\[^\n\r *]*$reprompt"         { send_user -- "$expect_out(buffer)"
>                                                 }
>             -re "^\[^\n\r]*$reprom..."
>     (procedure "run_commands" line 36)
>     invoked from within
> "run_commands $prompt $command"
>     ("foreach" body line 206)
>     invoked from within
> "foreach router [lrange $argv $i end] {
>     set router [string tolower $router]
>     # attempt at platform switching.
>     set platform ""
>     send_user ..."
>     (file "/home/rwest/bin/fxlogin" line 870)

I do not see the cause in the code or the debug output.  And, I do not
have a device to test against.  running fxlogin against an IOS device
works fine.

maybe start with making sure that you are using the most recent alpha
version of fxlogin.  diffs since rancid 3.7 are attached.

> Thanks,
> 
> -ryan
> 
> -----Original Message-----
> From: heasley <[email protected]> 
> Sent: Wednesday, November 28, 2018 5:54 PM
> To: Ryan West <[email protected]>
> Cc: heasley <[email protected]>; [email protected]
> Subject: Re: [rancid] FXOS debugging
> 
> Wed, Nov 28, 2018 at 04:09:40PM +0000, Ryan West:
> > Same error -
> > 
> > Here is the list of installed TCL packages:
> > 
> > libtcl8.5:amd64
> > libtcl8.6:amd64 
> > tcl             
> > tcl-expect:amd64
> > tcl8.5          
> > tcl8.6          
> > 
> > On a 9.6 Debian version.  It's just this script that this throwing errors as well.
> 
> Why (how) do you have tcl 8.5 and 8.6?  Please make sure that expect is linked with 8.6.

_______________________________________________
Rancid-discuss mailing list
[email protected]
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
fxlogin.in.diff (text/x-diff, 2.8 KB)
Index: bin/fxlogin.in
===================================================================
--- bin/fxlogin.in	(revision 3835)
+++ bin/fxlogin.in	(working copy)
@@ -76,11 +76,12 @@
 	    }
 
 	    # handle escaped ;s in commands, and ;; and ^;
-	    regsub -all {([^\\]);;} $command "\\1;\u002;" esccommand
-	    regsub {^;} $esccommand "\u002;" command
-	    set sep "\\1\u001"
-	    regsub -all {([^\\])\;} $command "$sep" esccommand
-	    set sep "\u001"
+	    regsub -all {([^\\]);} $command "\\1\u0002;" esccommand
+	    regsub -all {([^\\]);;} $esccommand "\\1;\u0002;" command
+	    regsub {^;} $command "\u0002;" esccommand
+	    regsub -all {[\\];} $esccommand ";" command
+	    regsub -all {\u0002;} $command "\u0002" esccommand
+	    set sep "\u0002"
 	    set commands [split $esccommand $sep]
 	    set num_commands [llength $commands]
 	    set rshfail 0
@@ -356,7 +357,7 @@
 
 # Run commands given on the command line.
 proc run_commands { prompt command } {
-    global do_saveconfig in_proc platform
+    global do_interact do_saveconfig in_proc platform
     set in_proc 1
 
     # leave the prompt alone for fxos
@@ -374,11 +375,12 @@
     log_user 0
 
     # handle escaped ;s in commands, and ;; and ^;
-    regsub -all {([^\\]);;} $command "\\1;\u002;" esccommand
-    regsub {^;} $esccommand "\u002;" command
-    set sep "\\1\u001"
-    regsub -all {([^\\])\;} $command "$sep" esccommand
-    set sep "\u001"
+    regsub -all {([^\\]);} $command "\\1\u0002;" esccommand
+    regsub -all {([^\\]);;} $esccommand "\\1;\u0002;" command
+    regsub {^;} $command "\u0002;" esccommand
+    regsub -all {[\\];} $esccommand ";" command
+    regsub -all {\u0002;} $command "\u0002" esccommand
+    set sep "\u0002"
     set commands [split $esccommand $sep]
     set num_commands [llength $commands]
     # the pager can not be turned off on the PIX, so we have to look
@@ -385,11 +387,7 @@
     # for the "More" prompt.  the extreme is equally obnoxious in pre-12.3 XOS,
     # with a global switch in the config.
     for {set i 0} {$i < $num_commands} { incr i} {
-	if { [lindex $commands $i] == "\u002" } {
-	    send -- "\r"
-	} else {
-	    send -- "[subst -nocommands [lindex $commands $i]]\r"
-	}
+	send -- "[subst -nocommands [lindex $commands $i]]\r"
 	expect {
 	    -re "\b+"				{ exp_continue }
 	    -re "^\[^\n\r *]*$reprompt"		{ send_user -- "$expect_out(buffer)"
@@ -397,7 +395,7 @@
 	    -re "^\[^\n\r]*$reprompt."		{ send_user -- "$expect_out(buffer)"
 						  exp_continue
 						}
-	    -re "^[^-]*--More--\[^\r\n]*[\r\n]+"	{ # fxos FTP pager
+	    -re "^\[^-]*--More--\[^\r\n]*\[\r\n]+"	{ # fxos FTP pager
 						  send " "
 						  exp_continue
 						}
@@ -428,6 +426,11 @@
     }
     log_user 1
 
+    if { $do_interact == 1 } {
+	interact
+	return 0
+    }
+
     if { [string compare "extreme" "$platform"] } {
 	send -h "exit\r"
     } else {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.