Package: rancid-core
Version: 2.3.2~a9-1~icz40+2
Severity: important
File: /usr/lib/rancid/bin/nrancid

Hi,
I found a bug in nrancid causing the loose one line per a page from the
device configuration. Google found an existing bugreport for Ubuntu
already
https://bugs.launchpad.net/ubuntu/+source/rancid/+bug/325603

I have configured Juniper firewall SSG-520 & SSG5-Serial in Rancid and I
am just starting to play with Rancid. Both devices suffers from this
bug.  My first tries was with 2.3.2~a8 Rancid version and lately I did
package 2.3.2~a9 by myself to see if the bug is not fixed in latest
upstream Rancid version.

There is sample from debugging nrancid:
"--- more --- \cH \cH\cH \cH\cH \cH\cH \cH\cH \cH\cH \cH\cH \cH\cH
\cH\cH \cH\cH \cH\cH \cH\cH \cH\cH \cHset zone \"Untrust\" screen
syn-ack-ack-proxy\cM\cJ"
The line "set zone ..." is lost by original nrancid code.

The fix is very simple and I decide not to use a patch from above
bugreport but write a different, that solves backspace ("\cH") anywhere
by removing previous non-control character. I left a string
"--- more ---" removals but with end-of-string pattern for documenting
and for sure (if some other device solves paging differently).

Best Regards
-- 
Vaclav Ovsik



-- System Information:
Debian Release: lenny/sid
  APT prefers oldstable
  APT policy: (500, 'oldstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-686
Locale: LANG=en_US, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)

Versions of packages rancid-core depends on:
ii  adduser             3.102                Add and remove users and groups
ii  cvs                 1:1.12.13-8          Concurrent Versions System
ii  debconf [debconf-2. 1.5.13               Debian configuration management sy
ii  expect              5.43.0-8             A program that can automate intera
ii  iputils-ping [ping] 3:20020927-6         Tools to test the reachability of 
ii  libc6               2.3.6.ds1-13etch9+b1 GNU C Library: Shared libraries
ii  openssh-client      1:4.3p2-9etch3       Secure shell client, an rlogin/rsh
ii  passwd              1:4.0.18.1-7+etch1   change and administer password and
ii  perl                5.8.8-7etch6         Larry Wall's Practical Extraction 
ii  ssh                 1:4.3p2-9etch3       Secure shell client and server (tr
ii  subversion          1.5.1dfsg1-1~bpo40+1 Advanced version control system

rancid-core recommends no packages.

-- debconf information excluded
>From 35f9626f03786ac71d6b1d2aa94d3472e1dfa7db Mon Sep 17 00:00:00 2001
From: Vaclav Ovsik <[email protected]>
Date: Thu, 19 Mar 2009 16:13:39 +0100
Subject: [PATCH 1/2] patches updated

---
 debian/patches/05_man_fixup.dpatch    |   55 ++++++++++++++++++---------------
 1 files changed, 30 insertions(+), 25 deletions(-)
 mode change 100644 => 100755 debian/patches/01_rancid_par.dpatch
 mode change 100644 => 100755 debian/patches/02_man_hyphen.dpatch
 mode change 100644 => 100755 debian/patches/03_diffstat.dpatch
 mode change 100644 => 100755 debian/patches/04_pixlogin.dpatch
 mode change 100644 => 100755 debian/patches/05_man_fixup.dpatch
 mode change 100644 => 100755 debian/patches/06_tmp_security.dpatch

diff --git a/debian/patches/01_rancid_par.dpatch b/debian/patches/01_rancid_par.dpatch
old mode 100644
new mode 100755
diff --git a/debian/patches/02_man_hyphen.dpatch b/debian/patches/02_man_hyphen.dpatch
old mode 100644
new mode 100755
diff --git a/debian/patches/03_diffstat.dpatch b/debian/patches/03_diffstat.dpatch
old mode 100644
new mode 100755
diff --git a/debian/patches/04_pixlogin.dpatch b/debian/patches/04_pixlogin.dpatch
old mode 100644
new mode 100755
diff --git a/debian/patches/05_man_fixup.dpatch b/debian/patches/05_man_fixup.dpatch
old mode 100644
new mode 100755
index 8d2a04e..8bc9e8e
--- a/debian/patches/05_man_fixup.dpatch
+++ b/debian/patches/05_man_fixup.dpatch
@@ -6,9 +6,9 @@
 
 @DPATCH@
 diff -urNad rancid~/man/clogin.1 rancid/man/clogin.1
---- rancid~/man/clogin.1
-+++ rancid/man/clogin.1
-@@ -201,7 +201,7 @@
+--- rancid~/man/clogin.1	2009-03-19 16:02:18.000000000 +0100
++++ rancid/man/clogin.1	2009-03-19 16:10:55.000000000 +0100
+@@ -203,7 +203,7 @@
  \-c option.  The default encryption type is often not supported.  See the
  .BR ssh (1)
  man page for details.  The default is 3des.
@@ -17,7 +17,7 @@ diff -urNad rancid~/man/clogin.1 rancid/man/clogin.1
  .\"
  .SH RETURNS
  If the login script fails for any of the devices on the command-line, the
-@@ -242,7 +242,7 @@
+@@ -244,7 +244,7 @@
  to locate the
  .IR .cloginrc
  configuration file.
@@ -27,8 +27,8 @@ diff -urNad rancid~/man/clogin.1 rancid/man/clogin.1
  .ta \w'xHOME/xcloginrc  'u 
  \fI$HOME/.cloginrc\fR   Configuration file.
 diff -urNad rancid~/man/cloginrc.5 rancid/man/cloginrc.5
---- rancid~/man/cloginrc.5
-+++ rancid/man/cloginrc.5
+--- rancid~/man/cloginrc.5	2009-03-19 16:10:55.000000000 +0100
++++ rancid/man/cloginrc.5	2009-03-19 16:10:55.000000000 +0100
 @@ -280,7 +280,7 @@
  If <file> is not a full pathname, $HOME/ will be prepended.
  .sp
@@ -39,8 +39,8 @@ diff -urNad rancid~/man/cloginrc.5 rancid/man/cloginrc.5
  .br
  .nf
 diff -urNad rancid~/man/lg.conf.5.in rancid/man/lg.conf.5.in
---- rancid~/man/lg.conf.5.in
-+++ rancid/man/lg.conf.5.in
+--- rancid~/man/lg.conf.5.in	2009-03-19 16:02:18.000000000 +0100
++++ rancid/man/lg.conf.5.in	2009-03-19 16:10:55.000000000 +0100
 @@ -14,7 +14,7 @@
  .\"
  .SH VARIABLES
@@ -91,8 +91,8 @@ diff -urNad rancid~/man/lg.conf.5.in rancid/man/lg.conf.5.in
  .BR cloginrc (5),
  .BR lg_intro (1),
 diff -urNad rancid~/man/par.1 rancid/man/par.1
---- rancid~/man/par.1
-+++ rancid/man/par.1
+--- rancid~/man/par.1	2009-03-19 16:10:55.000000000 +0100
++++ rancid/man/par.1	2009-03-19 16:10:55.000000000 +0100
 @@ -106,7 +106,7 @@
  .B \-x
  View rancid_par logs in real-time via an 
@@ -103,8 +103,8 @@ diff -urNad rancid~/man/par.1 rancid/man/par.1
  .br
  .nf
 diff -urNad rancid~/man/rancid-run.1 rancid/man/rancid-run.1
---- rancid~/man/rancid-run.1
-+++ rancid/man/rancid-run.1
+--- rancid~/man/rancid-run.1	2009-03-19 16:02:18.000000000 +0100
++++ rancid/man/rancid-run.1	2009-03-19 16:10:55.000000000 +0100
 @@ -131,7 +131,7 @@
  .B $BASEDIR/etc/rancid.conf
  .B rancid-run
@@ -115,8 +115,8 @@ diff -urNad rancid~/man/rancid-run.1 rancid/man/rancid-run.1
  .BR control_rancid (1),
  .BR rancid.conf (5),
 diff -urNad rancid~/man/rancid.conf.5.in rancid/man/rancid.conf.5.in
---- rancid~/man/rancid.conf.5.in
-+++ rancid/man/rancid.conf.5.in
+--- rancid~/man/rancid.conf.5.in	2009-03-19 16:10:55.000000000 +0100
++++ rancid/man/rancid.conf.5.in	2009-03-19 16:10:55.000000000 +0100
 @@ -26,7 +26,7 @@
  .SH VARIABLES
  The following variables are used (listed alphabetically):
@@ -141,14 +141,21 @@ diff -urNad rancid~/man/rancid.conf.5.in rancid/man/rancid.conf.5.in
  .SH "SEE ALSO"
  .BR control_rancid (1),
 diff -urNad rancid~/man/router.db.5 rancid/man/router.db.5
---- rancid~/man/router.db.5
-+++ rancid/man/router.db.5
-@@ -48,120 +48,120 @@
+--- rancid~/man/router.db.5	2009-03-19 16:10:26.000000000 +0100
++++ rancid/man/router.db.5	2009-03-19 16:12:10.000000000 +0100
+@@ -48,124 +48,124 @@
  The type of device from the set:
  .RS 8n
  .TP
 -.ID 15n
 +.\".ID 15n
+ .B agm
+ A Cisco Anomoly Guard Module (aka Riverhead).
+ Suspect that at some point the UI will become more cisco-like and it
+ can be merged with the IOS rancid module.
+ .TP
+-.ID 15n
++.\".ID 15n
  .B alteon
  An Alteon WebOS switches.
  .TP
@@ -181,6 +188,11 @@ diff -urNad rancid~/man/router.db.5 rancid/man/router.db.5
  .TP
 -.ID 15n
 +.\".ID 15n
+ .B cisco-nx
+ A Cisco Nexus switch/router.
+ .TP
+-.ID 15n
++.\".ID 15n
  .B css
  A Cisco content services switch.
  .TP
@@ -265,13 +277,6 @@ diff -urNad rancid~/man/router.db.5 rancid/man/router.db.5
  .TP
 -.ID 15n
 +.\".ID 15n
- .B riverhead
- A Cisco Anomoly Guard Module (aka Riverhead).
- We suspect that at some point the UI will become more cisco-like and it
- can be merged with the IOS rancid module.
- .TP
--.ID 15n
-+.\".ID 15n
  .B riverstone
  A Riverstone NAS or Cabletron (starting with version ~9.0.3) router.
  .TP
@@ -290,7 +295,7 @@ diff -urNad rancid~/man/router.db.5 rancid/man/router.db.5
  .B zebra
  Zebra routing software.
  .RE
-@@ -211,7 +211,7 @@
+@@ -215,7 +215,7 @@
  defined in the variable
  .I LIST_OF_GROUPS
  within \fI$BASEDIR/etc/rancid.conf\fR.
diff --git a/debian/patches/06_tmp_security.dpatch b/debian/patches/06_tmp_security.dpatch
old mode 100644
new mode 100755
-- 
1.6.2.1

>From a41834107c0003f4f9e6eb90795b095eaba11dca Mon Sep 17 00:00:00 2001
From: Vaclav Ovsik <[email protected]>
Date: Mon, 23 Mar 2009 12:05:41 +0100
Subject: [PATCH 2/2] Fixed "--- more ---" & backspace style paging

---
 debian/changelog                           |    6 ++++
 debian/patches/00list                      |    1 +
 debian/patches/07_nrancid_bs_paging.dpatch |   37 ++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100755 debian/patches/07_nrancid_bs_paging.dpatch

diff --git a/debian/changelog b/debian/changelog
index 245f6dd..3a3cb1c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+rancid (2.3.2~a9-1~icz40+2) unstable; urgency=low
+
+  * Fixed "--- more ---" & backspace style paging on netscreen devices.
+
+ -- Vaclav Ovsik <[email protected]>  Mon, 23 Mar 2009 12:04:25 +0100
+
 rancid (2.3.2~a9-1~icz40+1) unstable; urgency=low
 
   * New Upstream Version
diff --git a/debian/patches/00list b/debian/patches/00list
index 722ac98..624ffbc 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -4,3 +4,4 @@
 04_pixlogin.dpatch
 05_man_fixup.dpatch
 06_tmp_security.dpatch
+07_nrancid_bs_paging.dpatch
diff --git a/debian/patches/07_nrancid_bs_paging.dpatch b/debian/patches/07_nrancid_bs_paging.dpatch
new file mode 100755
index 0000000..cba9986
--- /dev/null
+++ b/debian/patches/07_nrancid_bs_paging.dpatch
@@ -0,0 +1,37 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 07_nrancid_bs_paging.dpatch by Vaclav Ovsik <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+...@dpatch@
+diff -urNad rancid~/bin/nrancid.in rancid/bin/nrancid.in
+--- rancid~/bin/nrancid.in	2009-03-23 11:55:26.000000000 +0100
++++ rancid/bin/nrancid.in	2009-03-23 12:02:48.000000000 +0100
+@@ -173,10 +173,11 @@
+ 
+     while (<INPUT>) {
+ 	tr/\015//d;
++	1 while s/[^[:cntrl:]]\cH//g;
+ 	next if /^\s*$/;
+ 	last if(/$prompt/);
+ 	# throw away the pager lines
+-	next if /^--- more ---/;
++	next if /^--- more ---\s*$/;
+ 
+ 	/^Serial Number: (\d+), Control Number: \d+$/ &&
+ 		ProcessHistory("SYSTEM","","", "#SN: $1\n") && next;
+@@ -211,11 +212,12 @@
+     print STDERR "    In GetConf: $_" if ($debug);
+     while (<INPUT>) {
+ 	tr/\015//d;
++	1 while s/[^[:cntrl:]]\cH//g;
+ 	next if /^\s*$/;
+ 	next if /^Total Config.+$/i;
+ 	last if(/$prompt/);
+ 	# throw away the pager lines
+-	next if /^--- more ---/;
++	next if /^--- more ---\s*$/;
+ 
+  	if (/^set admin name "(\S+)"$/ && $filter_pwds >= 1) {
+ 	    ProcessHistory("ADMIN","","","#set admin name <removed>\n");
-- 
1.6.2.1

Reply via email to