https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242828

--- Comment #4 from fehmi noyan isi <[email protected]> ---
Created attachment 210686
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=210686&action=edit
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 
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 not
currently implemented (bug # 219933): atf-check failed; see the output of the
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 # 

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 
--- 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 == D_BRIEF) {
+                       status |= 1;
+                       rval = 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:56:46
UTC 2020    
[email protected]:/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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to