Closed morrowc closed 2 years ago
hey, i'm just seeing this PR - not rx'g notification of them.
yes, ^J is LF. but your terminal ought to understand LF - so why is it appearing as ^J? Is that actually a single char in the diff or is it expanded to two?
also, have you overridden prompt in your .cloginrc? ulogin -m
first: I suck at github PR and markdown :( I did edit the first note in this to at least make the diff look proper.
you stated that: "your terminal ought to understand LF, why is it appearing as ^J?"
I think my terminal probably does the right thing, but these diffs I see via email...(admittedly in a terminal mail application)
then you asked: "have you overridden your .cloginrc?" I don't believe I changed the .cloginrc... related to terminal stuff:
$ more .cloginrc
add password * blahrgh
add user * rancid
add method * {ssh}
add sshcommand {"/usr/bin/ssh -4"}
add identity * {"/var/lib/rancid/.ssh/id_ec_rancid"}
add cyphertype gw.* aes128-cbc
add cyphertype srx-* aes128-cbc
add cyphertype fios.* aes128-cbc
add noenable gate.ops-netman.net 1
ulogin -m output for one of the devices:
$ bin/ulogin -m gate.ops-netman.net
gate.ops-netman.net
noenable:/var/lib/rancid/.cloginrc:9: gate.ops-netman.net 1
password:/var/lib/rancid/.cloginrc:1: * blahrgh
user:/var/lib/rancid/.cloginrc:2: * rancid
identity:/var/lib/rancid/.cloginrc:5: * {"/var/lib/rancid/.ssh/id_ec_rancid"}
method:/var/lib/rancid/.cloginrc:3: * ssh
The diff implies to me that the device re-printed the command after ulogin sent it. The script read the first one and filtered it, then read the re-print + the first line of the command's output. This usually occurs when the cli ties to be cute; usually it can be avoided with a 'dumb' terminal type. eg:
diff --git a/lib/edgerouter.pm.in b/lib/edgerouter.pm.in
index 6804d3b9..19b83304 100644
--- a/lib/edgerouter.pm.in
+++ b/lib/edgerouter.pm.in
@@ -21,6 +21,9 @@ use rancid @VERSION@;
# load-time initialization
sub import {
+ # force a terminal type to avoid cli mangling
+ $ENV{'TERM'} = "ansi";
+
0;
}
I only have access to a ugs, but i'll try to replicate this.
I've not been able to reproduce this with a USG over that past week. Have you been able to test the "TERM" theory?
Tried to reproduce this for multiple weeks w/o success. We assume it is something particular to morrowc's environment that has resolved itself through upgrades. Please open another PR if it recurs.
I monitor 2 ubiquiti devices (edgerouters), I see the same behavior for both of them, occasionally I see diffs like:
followed by a diff like:
I take this to mean that for the first diff 'Version' and 'show hardware' got stuck together on the same 'line', and on the subsequent run that stickiness did not happen. Ctrl-J is a linefeed (I think) character, perhaps: https://github.com/haussli/rancid/blob/0d25275f5c1ac14a43cecd5a139ef899f4e5a2f5/lib/edgerouter.pm.in#L41
adding a removal of \012 helps? :)