[rancid] Several suggestions about rancid-3.2.p7

Tetsuo Handa penguin-kernel at I-love.SAKURA.ne.jp
Wed Jun 3 13:16:09 UTC 2015


Hello.

I've just installed rancid-3.2p7 on CentOS 6.6.

(1) I noticed that while the configure script checks for Socket.pm >= 2.006 ,
    it works for me with below patch. If below patch is correct (I'm not perl
    user), we don't need to force users to upgrade package to a version which
    is not included in RHEL 6 / CentOS 6 distribution.

----------------------------------------
patch -p0 << "EOF"
--- configure
+++ configure
@@ -5316,15 +5316,6 @@
 PERLV=`basename $PERLV_PATH`
 
 
-# check Socket.pm version
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Socket.pm version" >&5
-$as_echo_n "checking Socket.pm version... " >&6; }
-$PERLV_PATH -e 'use 2.006 Socket qw(inet_pton);' 2>&1 >/dev/null
-if test $? -ne 0 ; then
-   as_fn_error $? "Socket.pm is older than 2.006; upgrade from http://metacpan.org/pod/Socket" "$LINENO" 5
-   exit 1
-fi
-
 # Extract the first word of "expect", so it can be a program name with args.
 set dummy expect; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--- lib/rancid.pm.in
+++ lib/rancid.pm.in
@@ -48,7 +48,7 @@
 use 5.010;
 use strict 'vars';
 use warnings;
-use 2.006 Socket qw(AF_INET AF_INET6 inet_pton);
+use Socket qw(AF_INET AF_INET6);
 require(Exporter);
 our @ISA = qw(Exporter);
 
@@ -351,6 +351,11 @@
     @sorted_lines;
 }
 
+sub inet_pton {
+    my($family, $addr) = @_;
+    return inet_pton($family, $addr);
+}
+
 # ipaddrval(IPaddr) converts and IPv4/v6 address to a string for comparison.
 # Some may ask why not use Net::IP; performance.  We tried and it was horribly
 # slow.
EOF
----------------------------------------

(2) I noticed that the shell variable SENDMAIL is defined in
    bin/control_rancid.in like below

      # SENDMAIL location
      SENDMAIL=${SENDMAIL:=sendmail};

    but this variable is never used because /usr/sbin/sendmail is
    hard-coded like below

      /usr/sbin/sendmail -t $MAILOPTS

    I think you need to either remove this variable definition or
    replace like below with variable definition updated.

      -| /usr/sbin/sendmail -t $MAILOPTS
      +| $SENDMAIL -t $MAILOPTS

(3) I noticed that bin/control_rancid.in forgot to exclude .cvsignore
    file in the

      # delete configs from RCS for routers not listed in routers.up.

    block. As a result, "svn commit" fails and "Deleted .cvsignore" line
    is printed (very confusing!) when I executed bin/rancid-run , possibly
    the same problem reported at
    http://www.shrubbery.net/pipermail/rancid-discuss/2015-May/008414.html .

    I think you need to replace like below.

      -for router in `find . \( -name \*.new -prune -o -name CVS -prune -o -name .svn -prune -o -name .gitignore -prune \) -o -type f -print | sed -e 's/^.\///'`
      +for router in `find . \( -name \*.new -prune -o -name CVS -prune -o -name .svn -prune -o -name .gitignore -prune -o -name .cvsignore -prune \) -o -type f -print | sed -e 's/^.\///'`

(4) Usually, PATH environment variable should not contain "."
    (current directory).

Regards.


More information about the Rancid-discuss mailing list