My finger memory wants to use diff -purw -- show C functions, unified 3 line, recursive, ignore whitespace -- but this now produces an error: $ diff -purw foo bar error: conflicting output format options.
(In reply to Ed Maste from comment #0) Hmm... this is unfortunate. -p sets the format to context, which is incompatible with -u. I note that the following is what GNU diff appears to do: kevans91:~/grep$ diff -p A B *** A 2020-10-03 15:02:53.072790765 -0500 --- B 2020-10-03 15:03:00.652785502 -0500 *************** *** 1,7 **** A B ! C ! D E F G --- 1,7 ---- A B ! X ! Y E F G kevans91:~/grep$ diff -pu A B --- A 2020-10-03 15:02:53.072790765 -0500 +++ B 2020-10-03 15:03:00.652785502 -0500 @@ -1,7 +1,7 @@ A B -C -D +X +Y E F G kevans91:~/grep$ diff -up A B --- A 2020-10-03 15:02:53.072790765 -0500 +++ B 2020-10-03 15:03:00.652785502 -0500 @@ -1,7 +1,7 @@ A B -C -D +X +Y E F G I suspect the answer here is that we should leave the diff_format as D_UNSET, then after all option processing default it to D_CONTEXT if it's still unset and D_PROTOTYPE is set. CC'ing bapt@ to get a second opinion. I also note that GNU diff doesn't appear to check the format at all for -p, so we should probably stop that as well: kevans91:~/grep$ diff -qp A B Files A and B differ kevans91:~/grep$ diff -pq A B Files A and B differ
Created attachment 218502 [details] git(1) diff against base diff
(In reply to Kyle Evans from comment #2) Patch LGTM
ping
A commit references this bug: Author: kevans Date: Tue Oct 27 12:27:26 UTC 2020 New revision: 367076 URL: https://svnweb.freebsd.org/changeset/base/367076 Log: diff: don't force the format to 'context' with -p immediately Instead, leave the fomat as unspecified (if it hasn't been) and use the -p flag as a hint to 'context' if no other formatting option is specified. This fixes `diff -purw`, used frequently by emaste, and matches the behavior of its GNU counterpart. PR: 250015 Reviewed by: emaste MFC after: 1 week Changes: head/usr.bin/diff/diff.c
Seems this is not the only regression on 12.2. The combination of the -n -u flags (-n -r -u) are also complaining with error: conflicting output format options. Using this combination in many scripts on many systems, My quick workaround was to build diff from the 12.1 sources.
Considering backing out the patch in question from stable/ and 12.2 S "too invasive"
The conflicting output error must have been introduced by the bug report below https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243975
A commit references this bug: Author: kevans Date: Sat Nov 14 00:59:55 UTC 2020 New revision: 367656 URL: https://svnweb.freebsd.org/changeset/base/367656 Log: MFC r367076: diff: don't force the format to 'context' with -p immediately Instead, leave the fomat as unspecified (if it hasn't been) and use the -p flag as a hint to 'context' if no other formatting option is specified. This fixes `diff -purw`, used frequently by emaste, and matches the behavior of its GNU counterpart. PR: 250015 Changes: _U stable/12/ stable/12/usr.bin/diff/diff.c
^Triage: committed back in 2020. The mfc-stable* flags' values are now OBE.