Discussion:
[rancid] "upgrade" to 3.1 breaks par?
Dan Anderson
2014-09-24 21:09:13 UTC
Permalink
I "upgraded" by installation from 2.3.8 to 3.1 this morning. By upgrade, I
mean "back up, rm -rf etc bin var share lib, make install" and I keep
getting par syntax errors in the logs:

Trying to get all of the configs.

usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]

=====================================

Getting missed routers: round 1.

usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]

=====================================

Getting missed routers: round 2.

usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]

=====================================

Getting missed routers: round 3.

usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]

=====================================

Getting missed routers: round 4.

usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]



I ended up moving the par binary out of the way and restoring the perl
version from 2.3.8 and it seems to have resolved my issue for now, but it's
not really an ideal fix.

I chucked an "echo" after the call to par in control_rancid and got this:

par -q -n 5 -c 'rancid-fe "{}"' /usr/local/rancid/var/home/routers.up


I haven't spent a lot of time on this at the moment, but I thought I would
see if anyone else has run across this (I didn't see anything in the
archives for the last few months) and might have an easy fix.
--
Dan
John Heasley
2014-09-25 14:12:56 UTC
Permalink
Post by Dan Anderson
Trying to get all of the configs.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 1.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 2.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 3.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 4.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
I ended up moving the par binary out of the way and restoring the perl version from 2.3.8 and it seems to have resolved my issue for now, but it's not really an ideal fix.
par -q -n 5 -c 'rancid-fe "{}"' /usr/local/rancid/var/home/routers.up
I haven't spent a lot of time on this at the moment, but I thought I would see if anyone else has run across this (I didn't see anything in the archives for the last few months) and might have an easy fix.
Another user had a problem like this; they were on some embedded platform version of linux. I had no manner of helping them. What are you using?
Post by Dan Anderson
--
Dan
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Dan Anderson
2014-09-25 15:07:07 UTC
Permalink
It's a Raspberry Pi running Raspian. I can get you access to the box if
you'd like it.
Post by Dan Anderson
I "upgraded" by installation from 2.3.8 to 3.1 this morning. By upgrade, I
mean "back up, rm -rf etc bin var share lib, make install" and I keep
Trying to get all of the configs.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 1.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 2.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 3.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 4.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
I ended up moving the par binary out of the way and restoring the perl
version from 2.3.8 and it seems to have resolved my issue for now, but it's
not really an ideal fix.
par -q -n 5 -c 'rancid-fe "{}"' /usr/local/rancid/var/home/routers.up
I haven't spent a lot of time on this at the moment, but I thought I would
see if anyone else has run across this (I didn't see anything in the
archives for the last few months) and might have an easy fix.
Another user had a problem like this; they were on some embedded platform
version of linux. I had no manner of helping them. What are you using?
--
Dan
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Dan
Heasley
2014-09-25 19:02:10 UTC
Permalink
It's a Raspberry Pi running Raspian. I can get you access to the box if you'd like it.
Iirc, thats what that user had, so yes please.
Post by John Heasley
Post by Dan Anderson
Trying to get all of the configs.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 1.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 2.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 3.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
=====================================
Getting missed routers: round 4.
usage: par [-dfiqx] [-n #] [-p n] [-l logfile] [-c command] [<command file>]
I ended up moving the par binary out of the way and restoring the perl version from 2.3.8 and it seems to have resolved my issue for now, but it's not really an ideal fix.
par -q -n 5 -c 'rancid-fe "{}"' /usr/local/rancid/var/home/routers.up
I haven't spent a lot of time on this at the moment, but I thought I would see if anyone else has run across this (I didn't see anything in the archives for the last few months) and might have an easy fix.
Another user had a problem like this; they were on some embedded platform version of linux. I had no manner of helping them. What are you using?
Post by Dan Anderson
--
Dan
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Dan
heasley
2014-09-26 16:50:36 UTC
Permalink
Post by Dan Anderson
It's a Raspberry Pi running Raspian. I can get you access to the box if
you'd like it.
This patch fixes the issue. Thanks for the help, Dan.

Index: bin/hpuifilter.c
===================================================================
--- bin/hpuifilter.c (revision 2872)
+++ bin/hpuifilter.c (working copy)
@@ -109,6 +109,8 @@
#include <termios.h>
#if HAVE_UTIL_H
# include <util.h>
+#elif HAVE_LIBUTIL_H
+# include <libutil.h>
#endif

#define BUFSZ (LINE_MAX * 2)
@@ -141,13 +143,13 @@
{
extern char *optarg;
extern int optind;
- char ch,
- hbuf[BUFSZ], /* hlogin buffer */
+ char hbuf[BUFSZ], /* hlogin buffer */
ptyname[FILENAME_MAX + 1],
tbuf[BUFSZ], /* telnet/ssh buffer */
tbufstr[5] = {ESC, '\x07', '\r', '\n', '\0'};
int bytes, /* bytes read/written */
devnull,
+ i,
rval = EX_OK,
ptym, /* master pty */
ptys; /* slave pty */
@@ -167,8 +169,8 @@
if (strrchr(progname, '.') != NULL)
*(strrchr(progname, '.')) = '\0';

- while ((ch = getopt(argc, argv, "dhvt:")) != -1 )
- switch (ch) {
+ while ((i = getopt(argc, argv, "dhvt:")) != -1 )
+ switch (i) {
case 'd':
debug++;
break;
Index: bin/par.c
===================================================================
--- bin/par.c (revision 2872)
+++ bin/par.c (working copy)
@@ -138,7 +138,6 @@
{
extern char *optarg;
extern int optind;
- char ch;
time_t t;
int i,
line;
@@ -167,8 +166,8 @@
} else
errfp = stderr;

- while ((ch = getopt(argc, argv, "defhiqxvc:e:l:n:p:")) != -1 )
- switch (ch) {
+ while ((i = getopt(argc, argv, "defhiqxvc:e:l:n:p:")) != -1 )
+ switch (i) {
case 'c': /* command to run */
c_opt = optarg;
break;
@@ -912,7 +911,7 @@

/* first line might be a command */
if (*line == 1) {
- switch ((buf[0] = fgetc(*F))) {
+ switch ((e = fgetc(*F))) {
case EOF:
goto ERR;
break;
@@ -933,7 +932,7 @@
}
break;
default:
- ungetc(buf[0], *F);
+ ungetc(e, *F);
if (*cmd == NULL && c_opt != NULL)
if ((e = line_split(c_opt, cmd))) {
/* XXX: is strerror(e) right? */
Index: bin/clogin.in
===================================================================
--- bin/clogin.in (revision 2872)
+++ bin/clogin.in (working copy)
@@ -656,7 +656,7 @@
for {set i 0} {$i < $num_commands} { incr i} {
send -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
- -re "\b+" { exp_continue }
+ -re "^\b+" { exp_continue }
-re "^\[^\n\r *]*$reprompt" { send_user -- "$expect_out(buffer)"
}
-re "^\[^\n\r]*$reprompt." { send_user -- "$expect_out(buffer)"
Index: bin/fnlogin.in
===================================================================
--- bin/fnlogin.in (revision 2872)
+++ bin/fnlogin.in (working copy)
@@ -455,6 +455,10 @@
expect -re $prompt; send -- "end\r"
expect -re $prompt;

+# see http://www.shrubbery.net/pipermail/rancid-discuss/2011-July/005787.html
+ # this is the only way i see to get rid of more prompts in o/p..grrrrr
+ log_user 0
+
set sep "\\1\u001"
regsub -all {([^\\])\;} $command "$sep" esccommand
set sep "\u001"
@@ -466,10 +470,12 @@
-re "$prompt" { send "\r"
sleep 0.5
}
- -gl "--More--" { send " "
+ -gl "--More--\[^\n\r]*" { send " "
exp_continue
- -re "\[\n\r]+" { exp_continue }
}
+ -re "\[^\r\n]*\[\n\r]+" { send_user -- "$expect_out(buffer)"
+ exp_continue
+ }
}
}
expect {
@@ -586,8 +592,12 @@
}
} elseif { $do_script } {
# Disable output paging.
+ send "config global\r"
+ expect -re $prompt {}
send "config system console\r"
+ expect -re $prompt {}
send "set output standard\r"
+ expect -re $prompt {}
send "end\r"
expect -re $prompt {}
source $sfile
Index: bin/hlogin.in
===================================================================
--- bin/hlogin.in (revision 2872)
+++ bin/hlogin.in (working copy)
@@ -565,6 +565,8 @@
}
exp_continue
}
+ -re "^More: \[^\n\r]* line:" { catch {send " "}
+ exp_continue }
-re "^<-+ More -+>\[^\n\r]*" { catch {send " "}
exp_continue }
-re "^-+ MORE -+\[^\n\r]*" { catch {send " "}
Index: bin/jlogin.in
===================================================================
--- bin/jlogin.in (revision 2872)
+++ bin/jlogin.in (working copy)
@@ -301,6 +301,7 @@
send_user "\nError: telnet failed: $reason\n"
return 1
}
+stty cols 132
} elseif ![string compare $prog "ssh"] {
# ssh to the router & try to login with or without an identfile.
# We use two calls to spawn since spawn does not seem to parse
@@ -318,6 +319,7 @@
send_user "\nError: $sshcmd failed: $reason\n"
return 1
}
+stty cols 132
} elseif ![string compare $prog "rsh"] {
send_error "\nError: unsupported method: rsh\n"
if { $progs == 0 } {
Index: bin/nxrancid.in
===================================================================
--- bin/nxrancid.in (revision 2872)
+++ bin/nxrancid.in (working copy)
@@ -313,7 +313,17 @@

s/ +$//; # Drop trailing ' '
next if (/Fan Zone Speed:/);
- next if (/INTAKE/);
+ if (/(control temperature|monitor temperature)/i) {
+ ProcessHistory("COMMENTS","","","!Env: $_");
+ while (<INPUT>) {
+ if (/(.*\s+\d+\s+\d+\s+)(\d+)(.*$)/) {
+ $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3);
+ }
+ ProcessHistory("COMMENTS","","","!Env: $_");
+ last if (/^\s*$/);
+ }
+ next;
+ }
ProcessHistory("COMMENTS","","","!Env: $_");
}
ProcessHistory("COMMENTS","","","!\n");
@@ -334,6 +344,7 @@
return(-1) if (/\% Permission denied/);
return(-1) if (/command authorization failed/i);

+ s/ +$//; # Drop trailing ' '
# Cut out CurTemp - drop the 2nd to last field.
#--------------------------------------------------------------------
#Module Sensor MajorThresh MinorThres CurTemp Status
@@ -340,10 +351,21 @@
# (Celsius) (Celsius) (Celsius)
#5 Outlet1 (s1) 125 125 33 Ok
#5 QEng1Sn1(s10) 115 105 39 Ok
- s/^(.+\s)(\S+\s+)(\S+\s*)$/$1$3/;
-
- s/ +$//; # Drop trailing ' '
- ProcessHistory("COMMENTS","","","!Env: $_");
+ if (/(control temperature|monitor temperature)/i) {
+ ProcessHistory("COMMENTS","","","!Env: $_");
+ while (<INPUT>) {
+ if (/(.*\s+\d+\s+\d+\s+)(\d+)(.*$)/) {
+ $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3);
+ }
+ ProcessHistory("COMMENTS","","","!Env: $_");
+ last if (/^\s*$/);
+ }
+ next;
+ } else {
+ s/^(.+\s)(\S+\s+)(\S+\s*)$/$1$3/;
+ s/ +$//; # Drop trailing ' '
+ ProcessHistory("COMMENTS","","","!Env: $_");
+ }
}
ProcessHistory("COMMENTS","","","!\n");
return(0);

Loading...