Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2020 10:25:35 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 242828] diff -rq still does full file comparison
Message-ID:  <bug-242828-227-w0fjN6sb6K@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-242828-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-242828-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242828

--- Comment #4 from fehmi noyan isi <fnoyanisi@yahoo.com> ---
Created attachment 210686
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D210686&action=
=3Dedit
patch for the diff(1) -q

In addition to the code I gave in my previous comment, the "status" variable
needs to be updated in order to set the proper exit status.

The attached patch seems to work and the patched diff(1) utility passes all=
 the
tests.

root@patch:/usr/src/usr.bin/diff # kyua test -k /usr/tests/Kyuafile
usr.bin/diff=20
usr.bin/diff/diff_test:Bflag  ->  passed  [0.071s]
usr.bin/diff/diff_test:b230049  ->  passed  [0.020s]
usr.bin/diff/diff_test:brief_format  ->  passed  [0.075s]
usr.bin/diff/diff_test:group_format  ->  passed  [0.020s]
usr.bin/diff/diff_test:header  ->  passed  [0.026s]
usr.bin/diff/diff_test:header_ns  ->  passed  [0.023s]
usr.bin/diff/diff_test:ifdef  ->  passed  [0.022s]
usr.bin/diff/diff_test:side_by_side  ->  expected_failure: --side-by-side n=
ot
currently implemented (bug # 219933): atf-check failed; see the output of t=
he
test for details  [0.033s]
usr.bin/diff/diff_test:simple  ->  passed  [0.086s]
usr.bin/diff/diff_test:unified  ->  passed  [0.038s]
usr.bin/diff/netbsd_diff_test:mallocv  ->  passed  [0.024s]
usr.bin/diff/netbsd_diff_test:nomallocv  ->  passed  [0.023s]
usr.bin/diff/netbsd_diff_test:same  ->  passed  [0.024s]

Results file id is usr_tests.20200113-172221-636074
Results saved to /root/.kyua/store/results.usr_tests.20200113-172221-636074=
.db

13/13 passed (0 failed)
root@patch:/usr/src/usr.bin/diff #=20

The patch file was generated with the command below

root@patch:~ # diff -u diffreg.c.orig diffreg.c > diffreg.c.patch
root@patch:~ # cat diffreg.c.patch=20
--- diffreg.c.orig      2020-01-14 03:16:23.048362000 +1300
+++ diffreg.c   2020-01-14 05:49:28.212503000 +1300
@@ -342,6 +342,12 @@
        case 0:
                goto closem;
        case 1:
+               /* if brief output is needed, just return to the caller */
+               if (diff_format =3D=3D D_BRIEF) {
+                       status |=3D 1;
+                       rval =3D D_DIFFER;
+                       goto closem;
+               }
                break;
        default:
                /* error */
root@patch:~ # uname -a
FreeBSD patch 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r356528: Thu Jan  9 04:5=
6:46
UTC 2020=20=20=20=20
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

It would be nice to do some performance benchmarks given unexpectedly long
running time was the driver for the bug report.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-242828-227-w0fjN6sb6K>