Bug 219277

Summary: [patch] misc/mc: use textproc/diffutils at FreeBSD-12 after switch to bsddiff
Product: Ports & Packages Reporter: Boris Samorodov <bsam>
Component: Individual Port(s)Assignee: Ben Woods <woodsb02>
Status: Closed FIXED    
Severity: Affects Only Me CC: cem, johans, pi, woodsb02, yury
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Use textproc/diffutils at FreeBSD-12 after switch to bsddiff none

Description Boris Samorodov freebsd_committer freebsd_triage 2017-05-14 14:38:40 UTC
Created attachment 182593 [details]
Use textproc/diffutils at FreeBSD-12 after switch to bsddiff

misc/mc has an awesome feature to compare two files and highlight the differences. However the gnu specific diff options are hardcoded at sources, ex. src/diffviewer/ydiff.c:
---
    800 static int
    801 dff_execute (const char *args, const char *extra, const char *file1, const char *file2,
    802              GArray * ops)
    803 {
    804     static const char *opt =
    805         " --old-group-format='%df%(f=l?:,%dl)d%dE\n'"
    806         " --new-group-format='%dea%dF%(F=L?:,%dL)\n'"
    807         " --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)\n'"
    808         " --unchanged-group-format=''";
---

FreeBSD has switched to bsddiff recently, from /usr/src/UPDATING:
---
20170420:
        GNU diff has been replaced by a BSD licensed diff. Some features of GNU
        diff has not been implemented, if those are needed a newer version of
        GNU diff is available via the diffutils package under the gdiff name.
---

So, to keep the aforementioned functionality we should use gnu diff util.

To reproduce the issue, use a fresh FreeBSD-current, install misc/mc and try to compare two files (F9->command->compare files) and get the error:
---
diff: unrecognized option `--old-group-format=%df%(f=l?:,%dl)d%dE`
[...]
---

I propose a patch (mind the new file at ${FILESDIR}).
Comment 1 Ben Woods freebsd_committer freebsd_triage 2017-05-29 13:47:22 UTC
Committed. Thanks for the patch!
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-05-29 13:50:44 UTC
A commit references this bug:

Author: woodsb02
Date: Mon May 29 13:50:20 UTC 2017
New revision: 441985
URL: https://svnweb.freebsd.org/changeset/ports/441985

Log:
  misc/mc: Use textproc/diffutils on FreeBSD 12

  - The new bsddiff in FreeBSD 12 does not yet support --old-group-format
  - Fix python shebangfix to require python2

  PR:		219277
  Submitted by:	bsam

Changes:
  head/misc/mc/Makefile
  head/misc/mc/files/extra-patch-src_diffviewer_ydiff.c
Comment 3 Yury V. Zaytsev 2024-07-28 11:00:41 UTC
Hi Ben, hi Boris,

Which project the BSD diff is developed under? Ist it FreeBSD? Any chance you could add the missing group format keys? Unfortunately, this is still a problem for us on macOS.

All the best,
Yury