Package: rancid
Version: 2.3.2-1
Severity: normal
Tags: patch

On a Cisco IOS device it's possible to enable a timpestamp prompt
prepending all "show commands". For example:

line vty 0 4
 exec prompt timestamp

This timestamp garbles the output and makes every single run
look different to rancid/CVS/svn. 

My proposal is to disable this timestamp prompt *in this
particular terminal session* before doing any command output
parsing. A patch which accomplish that is attached.

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (990, 'stable'), (400, 'testing'), (300, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages rancid depends on:
ii  adduser                  3.110           add and remove users and groups
ii  cvs                      1:1.12.13-12    Concurrent Versions System
ii  debconf [debconf-2.0]    1.5.24          Debian configuration management sy
ii  expect                   5.43.0-17       A program that can automate intera
ii  iputils-ping [ping]      3:20071127-1    Tools to test the reachability of 
ii  libc6                    2.7-18          GNU C Library: Shared libraries
ii  openssh-client           1:5.1p1-5       secure shell client, an rlogin/rsh
ii  passwd                   1:4.1.1-6       change and administer password and
ii  perl                     5.10.0-19lenny2 Larry Wall's Practical Extraction 
ii  ssh                      1:5.1p1-5       secure shell client and server (me
ii  subversion               1.5.1dfsg1-4    Advanced version control system

rancid recommends no packages.

Versions of packages rancid suggests:
ii  diffstat                      1.45-2     produces graph of changes introduc

-- debconf information:
* rancid/warning:
* rancid/go_on: true
#! /bin/sh /usr/share/dpatch/dpatch-run
## PC_rancid_no_timestamps.dpatch by Per Carlson <per...@gmail.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Disable timestamp outout on Cisco IOS devices

@DPATCH@

--- rancid~/bin/rancid.in	2009-11-11 09:47:28.000000000 +0100
+++ rancid-2.3.2/bin/rancid.in	2009-11-11 09:52:22.000000000 +0100
@@ -1858,10 +1858,20 @@
 }
 
 # dummy function
-sub DoNothing {print STDOUT;}
+sub DoNothing {
+    print STDERR "    In DoNothing: $_" if ($debug);
+
+    while (<INPUT>) {
+	tr/\015//d;
+	last if (/^$prompt/);
+	next if (/^(\s*|\s*$cmd\s*)$/);
+    }
+    return 0;
+}
 
 # Main
 @commandtable = (
+	{'terminal no exec prompt timestamp' => 'DoNothing'},
 	{'admin show version'		=> 'ShowVersion'},
 	{'show version'			=> 'ShowVersion'},
 	{'show redundancy secondary'	=> 'ShowRedundancy'},

Reply via email to