GNU bug report logs - #78213
should produce a diff with similar lines grouped together if possible

Previous Next

Package: diffutils;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Fri, 2 May 2025 14:19:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Robert Webb <ro.webbdg <at> gmail.com>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 78213 <at> debbugs.gnu.org
Subject: bug#78213: [bug-diffutils] bug#78213: should produce a diff with similar lines grouped together if possible
Date: Sat, 3 May 2025 01:12:44 -0700
The diff to create file-bad.diff was with the '-u' option.
I used diff v3.6 with identical results.

The only lines that match between the file1 and file2 are empty ones.
This bash command shows only an empty line in common:
  comm -12 -- <(sort -u file1) <(sort -u file2)

Note: The line terminator on the provided files is CRLF.
      Long lines - Use 'less -S'  :-)


On Fri, May 2, 2025 at 7:19 AM Vincent Lefevre <vincent <at> vinc17.net> wrote:
>
> "diff" should produce a diff with similar lines grouped together if
> possible, so that it can be more easily readable and be word-diff
> friendly.
>
> Issues can occur on text files with paragraphs separated by a blank
> line (like in wiki source files and LaTeX files), where a modification
> consists in
>   * some paragraph being split, and
>   * some of the following paragraphs being slightly modified.
>
> In such a case, a shift of the slightly modified lines can occur,
> which makes the diff hardly readable and breaks word-diff (e.g.
> when one opens the diff file with GNU Emacs).
>
> I've attached an example:
>   * file1 and file2: the files to be diff'ed (file2 is similar to
>     file1, with the first paragraph split).
>   * file-bad.diff: the diff produced by diff 3.10.
>   * file-ok.diff: the diff I would expect.
>
> --
> Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)




This bug report was last modified 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.