Re: [rancid] FXOS debugging
Fri, Nov 30, 2018 at 03:47:23PM +, 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 > Sent: Wednesday, November 28, 2018 5:54 PM > To: Ryan West > Cc: heasley ; Rancid-discuss@shrubbery.net > Subject: Re: [rancid] FXOS debugging > > Wed, Nov 28, 2018 at 04:09:40PM +, 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. 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 { ___ Rancid-discuss mailing list Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: [rancid] FXOS debugging
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) Thanks, -ryan -Original Message- From: heasley Sent: Wednesday, November 28, 2018 5:54 PM To: Ryan West Cc: heasley ; Rancid-discuss@shrubbery.net Subject: Re: [rancid] FXOS debugging Wed, Nov 28, 2018 at 04:09:40PM +, 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 Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: [rancid] FXOS debugging
Wed, Nov 28, 2018 at 04:09:40PM +, 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 Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: [rancid] FXOS debugging
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. Thanks, -ryan -Original Message- From: heasley Sent: Wednesday, November 28, 2018 1:55 AM To: Ryan West Cc: Rancid-discuss@shrubbery.net Subject: Re: [rancid] FXOS debugging Tue, Nov 27, 2018 at 04:34:22PM +, Ryan West: > send: sending "show model\r" to { exp5 } 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 "/usr/local/rancid/bin/fxlogin" line 870) hmm, i suspect this is a tcl bug. are you perhaps using some crusty Centos with an old tcl? you could try changing: -re "^\[^-]*--More--\[^\r\n]*\[\r\n]+" { # fxos FTP pager to -re -- "^\[^-]*--More--\[^\r\n]*\[\r\n]+" { # fxos FTP pager ___ Rancid-discuss mailing list Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: [rancid] FXOS debugging
Tue, Nov 27, 2018 at 04:34:22PM +, Ryan West: > send: sending "show model\r" to { exp5 } > 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 "/usr/local/rancid/bin/fxlogin" line 870) hmm, i suspect this is a tcl bug. are you perhaps using some crusty Centos with an old tcl? you could try changing: -re "^\[^-]*--More--\[^\r\n]*\[\r\n]+" { # fxos FTP pager to -re -- "^\[^-]*--More--\[^\r\n]*\[\r\n]+" { # fxos FTP pager ___ Rancid-discuss mailing list Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: [rancid] FXOS debugging
Tue, Nov 27, 2018 at 03:55:46PM +, Ryan West: > Hello, > > I've attempted to login via fxrancid, but I'm not entirely sure where it's > failing. Here is the debug when trying to run one command with fxrancid -d > > > And here it fails when trying to run the same command but with a command > fxlogin -d -c 'show model' you have to include the information that preceeded this and i need to see the complete and unaltered prompt. > expect: does "> " (spawn_id exp5) match glob pattern "Login failed"? no > "% (Bad passwords|Authentication failed)"? (No Gate, RE only) gate=yes re=no > "Press any key to continue"? no > "Enter Selection: "? Gate "Enter Selection: "? gate=no > "Press the key [^\r\n]+[\r\n]+"? Gate "Press the key *"? gate=no > "@[^\r\n]+ ([Pp]assword|passwd|Enter password for [^ :]+):"? (No Gate, RE > only) gate=yes re=no > "Enter passphrase.*: "? Gate "Enter passphrase*: "? gate=no > "([Uu]sername|Login|login|user name|User):"? (No Gate, RE only) gate=yes re=no > "([Pp]assword|passwd|Enter password for [^ :]+):"? (No Gate, RE only) > gate=yes re=no > "^([^ >]*)(>|#)"? (No Gate, RE only) gate=yes re=yes > expect: set expect_out(0,string) ">" > expect: set expect_out(1,string) "" > expect: set expect_out(2,string) ">" > expect: set expect_out(spawn_id) "exp5" > expect: set expect_out(buffer) ">" > send: sending "show model\r" to { exp5 } > 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 "/usr/local/rancid/bin/fxlogin" line 870) ___ Rancid-discuss mailing list Rancid-discuss@shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss