[rancid] modifying diff conditions

Wayne Eisenberg Wayne.Eisenberg at CarolinasIT.com
Tue Nov 19 21:07:38 UTC 2013


I've already tried '(term1|term2|term3)', no joy.

I haven't altered the cvs diff line itself other than adding in --ignore-matching-lines. I modified bin/control_rancid from:

if [ $RCSSYS = "cvs" ] ; then
    cvs -f diff -U 4 -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \
        -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

to:

if [ $RCSSYS = "cvs" ] ; then
    cvs -f diff -U 4 -ko --ignore-matching-lines='(.*av-.*|.*wildfire-.*|.*threat-.*|.*url-filtering-.*|.*app-.*|.*call-forwarding.*)'  | sed -e '/^RCS file: /d'   -e '/^--- /d' \   -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

when I run it interactively on the command line, I go to the /usr/local/rancid/var/<group>/configs/ directory and run 

cvs -f diff -r 1.150 -r 1.151 -U 4 -ko --ignore-matching-lines='(term1|term2|term3)'

so that it will do the comparison. It works then, but not within the script itself.

Should I try double quotes instead of single quotes? I don't have a lot of ideas at this point.

There's only one copy of diff on the system in /usr/bin.

-----Original Message-----

Fri, Nov 15, 2013 at 07:17:04AM -0500, Wayne Eisenberg:
> Maybe, maybe not. I've tried your format, too, and it isn't working.

| or \| without the grouping operator is a |; so I believe that I am correct.

> '(term1|term2|term3)'
> '(.*term1.*|.*term2.*|.*term.*)'   - (might be overkill, but thought I would try it).
> 
> Funny thing, if I run the 'cvs -f diff' command at the command prompt, then it ignores the appropriate lines.
> 
> cvs -f diff -r 1.150 -r 1.151 -U 4 -ko 
> --ignore-matching-lines=___________

try it with '(term1|term2|term3)'

> but within the script it doesn't behave the same. What's different (besides that I have to specify which revisions to diff)?

possibly the quoting.  have you altered the cvs diff line itself, or use a variable on that line?  for example, .* being glob expanded.  or possibly the version of diff that you are getting as a result of differences in PATH?

> 
> -----Original Message-----
> From: heasley [mailto:heas at shrubbery.net]
> Sent: Friday, November 08, 2013 12:21 PM
> To: Wayne Eisenberg
> Cc: 'rancid-discuss at shrubbery.net'
> Subject: Re: [rancid] modifying diff conditions
> 
> Fri, Nov 08, 2013 at 12:08:37PM -0500, Wayne Eisenberg:
> > Well, I've done some experimenting and I think I've seen that the 
> > regex expression doesn't always work. I found that --ignore-matching-lines='av\|wildfire\|threat'
> > *can* work, but if I don't include all of the things to ignore, it 
> > won't ignore any of them. For example, with the text below, 'av\|wildfire\|url-filtering\|app\|threat' will successfully ignore all of those lines. But if I omit one of the elements (say 'threat'), it won't ignore any of the lines even though I would expect it to only return the 'threat' lines as different. Does anyone have any ideas or explanation of this behavior?
> 
> bad RE format, i suspect.  '(term1|term2|term3)'
> 
> i do not know if any of those chars needs to be escaped, since its in single quotes.  but, depends on how cvs execs diff.
> 
> The information in this Internet e-mail (and any attachments) is confidential, may be legally privileged and is intended solely for the Addressee(s) named above. If you are not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, then any dissemination or copying of this e-mail (and any attachments) is prohibited and may be unlawful. If you received this e-mail in error, please immediately notify us by e-mail or telephone, then delete the message. Thank you.


More information about the Rancid-discuss mailing list