svn commit: r356695 - head/usr.bin/diff

Kyle Evans self at kyle-evans.net
Tue Jan 14 14:05:35 UTC 2020


On Tue, Jan 14, 2020 at 6:12 AM Li-Wen Hsu <lwhsu at freebsd.org> wrote:
>
> On Tue, Jan 14, 2020 at 2:29 AM Mark Johnston <markj at freebsd.org> wrote:
> >
> > Author: markj
> > Date: Mon Jan 13 18:29:47 2020
> > New Revision: 356695
> > URL: https://svnweb.freebsd.org/changeset/base/356695
> >
> > Log:
> >   Optimize diff -q.
> >
> >   Once we know whether the files differ, we don't need to do any further
> >   work.
> >
> >   PR:           242828
> >   Submitted by: fehmi noyan isi <fnoyanisi at yahoo.com> (original version)
> >   Reviewed by:  bapt, kevans
> >   MFC after:    1 week
> >   Differential Revision:        https://reviews.freebsd.org/D23152
> >
> > Modified:
> >   head/usr.bin/diff/diffreg.c
> >
> > Modified: head/usr.bin/diff/diffreg.c
> > ==============================================================================
> > --- head/usr.bin/diff/diffreg.c Mon Jan 13 18:26:27 2020        (r356694)
> > +++ head/usr.bin/diff/diffreg.c Mon Jan 13 18:29:47 2020        (r356695)
> > @@ -349,6 +349,11 @@ diffreg(char *file1, char *file2, int flags, int capsi
> >                 goto closem;
> >         }
> >
> > +       if (diff_format == D_BRIEF) {
> > +               rval = D_DIFFER;
> > +               status |= 1;
> > +               goto closem;
> > +       }
> >         if ((flags & D_FORCEASCII) == 0 &&
> >             (!asciifile(f1) || !asciifile(f2))) {
> >                 rval = D_BINARY;
>
> Hi Mark,
>
> This one seems breaks test case usr.sbin.etcupdate.fbsdid_test.main:
>
> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/13920/testReport/junit/usr.sbin.etcupdate/fbsdid_test/main/
>
> Revert this can get the case pass. Can you check if the code or the
> test needs to be fixed?
>

Whoops... that was a bit of an oversight. We can only short-circuit if
ignore_pats == NULL, otherwise we need to regress back to doing
line-by-line comparison. That should still see a benefit for the
majority of cases, though, I would think.


More information about the svn-src-all mailing list