From MAILER-DAEMON Wed May 14 16:49:04 2014
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Wkg6q-0007EY-32
	for mharc-bug-diffutils@gnu.org; Wed, 14 May 2014 16:49:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55173)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WkbAD-0001a1-OX
	for bug-diffutils@gnu.org; Wed, 14 May 2014 11:32:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WkbA3-0003Vg-ON
	for bug-diffutils@gnu.org; Wed, 14 May 2014 11:32:13 -0400
Received: from debbugs.gnu.org ([140.186.70.43]:46205)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WkbA3-0003Vb-ME
	for bug-diffutils@gnu.org; Wed, 14 May 2014 11:32:03 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WkbA3-0003tE-8a
	for bug-diffutils@gnu.org; Wed, 14 May 2014 11:32:03 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Scott McPeak <smcpeak@coverity.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Wed, 14 May 2014 15:32:03 +0000
Resent-Message-ID: <handler.17492.B.140008151314918@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 17492
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: 17492@debbugs.gnu.org
X-Debbugs-Original-To: <bug-diffutils@gnu.org>
Received: via spool by submit@debbugs.gnu.org id=B.140008151314918
	(code B ref -1); Wed, 14 May 2014 15:32:03 +0000
Received: (at submit) by debbugs.gnu.org; 14 May 2014 15:31:53 +0000
Received: from localhost ([127.0.0.1]:35321 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Wkb9r-0003sX-JT
	for submit@debbugs.gnu.org; Wed, 14 May 2014 11:31:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58792)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <smcpeak@coverity.com>) id 1WkVfd-0001Ht-Gp
	for submit@debbugs.gnu.org; Wed, 14 May 2014 05:40:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <smcpeak@coverity.com>) id 1WkVfO-0004D7-C6
	for submit@debbugs.gnu.org; Wed, 14 May 2014 05:40:12 -0400
Received: from lists.gnu.org ([2001:4830:134:3::11]:43544)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <smcpeak@coverity.com>) id 1WkVfO-0004D3-9z
	for submit@debbugs.gnu.org; Wed, 14 May 2014 05:40:02 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60407)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <smcpeak@coverity.com>) id 1WkVfG-000551-PT
	for bug-diffutils@gnu.org; Wed, 14 May 2014 05:40:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <smcpeak@coverity.com>) id 1WkVf9-00045d-6j
	for bug-diffutils@gnu.org; Wed, 14 May 2014 05:39:54 -0400
Received: from mail-by2lp0244.outbound.protection.outlook.com
	([207.46.163.244]:57938
	helo=na01-by2-obe.outbound.protection.outlook.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <smcpeak@coverity.com>) id 1WkVf8-00045C-UT
	for bug-diffutils@gnu.org; Wed, 14 May 2014 05:39:47 -0400
Received: from BY2PRD0310HT004.namprd03.prod.outlook.com (157.56.236.5) by
	DM2PR0501MB809.namprd05.prod.outlook.com (10.242.115.139) with
	Microsoft SMTP
	Server (TLS) id 15.0.939.12; Wed, 14 May 2014 09:08:04 +0000
Message-ID: <53733272.4000904@coverity.com>
Date: Wed, 14 May 2014 02:08:02 -0700
From: Scott McPeak <smcpeak@coverity.com>
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
Content-Transfer-Encoding: 7bit
X-Originating-IP: [157.56.236.5]
X-ClientProxiedBy: BLUPR05CA003.namprd05.prod.outlook.com (10.255.219.161)
	To DM2PR0501MB809.namprd05.prod.outlook.com (10.242.115.139)
X-Forefront-PRVS: 0211965D06
X-Forefront-Antispam-Report: SFV:NSPM;
	SFS:(10009001)(6009001)(428001)(189002)(199002)(77982001)(46102001)(101416001)(76482001)(87976001)(87266999)(64706001)(54356999)(83506001)(42186004)(66066001)(21056001)(4396001)(59896001)(19580395003)(102836001)(83072002)(74502001)(85852003)(81342001)(99396002)(83322001)(50466002)(31966008)(79102001)(80022001)(23756003)(65956001)(65806001)(47776003)(74662001)(86362001)(50986999)(64126003)(92726001)(20776003)(36756003)(92566001)(65816999)(62816006);
	DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0501MB809;
	H:BY2PRD0310HT004.namprd03.prod.outlook.com; FPR:; MLV:sfv;
	PTR:InfoNoRecords; MX:1; A:1; LANG:en; 
Received-SPF: None (: coverity.com does not designate permitted sender hosts)
Authentication-Results: spf=none (sender IP is )
	smtp.mailfrom=smcpeak@coverity.com; 
X-OriginatorOrg: coverity.com
X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Mailman-Approved-At: Wed, 14 May 2014 11:31:50 -0400
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
X-Mailman-Approved-At: Wed, 14 May 2014 16:49:02 -0400
Subject: [bug-diffutils] bug#17492: diff handles moved text poorly;
	should not need --minimal
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 14 May 2014 15:32:23 -0000

GNU diff appears to handle moved text poorly using its default diff 
algorithm.  At the end, I show a script that will reproduce the problem. 
  The essence is you have a large file that contains many blank lines, 
then move a large-ish block of text (~10% of file) from near the top to 
near the bottom.  The default diff algorithm treats all the blank lines 
as unchanged, thereby treating virtually all of the non-blank lines in 
the file as changed.  This makes the diff useless for comprehending the 
change and basically destroys the history shown by a command like "git 
annotate".

Now, after spending considerable time investigating this flaw, I have 
discovered the --minimal flag, and see that it will get the right 
answer, and that git accepts this flag in many (all?) cases where it 
matters.  But it is burdensome to add this flag to every command that 
uses diff (as I would not know in advance that any particular change 
will be affected by this bug), and few people know about the flag, so 
even if I use it, I still can't realistically move text in my files and 
expect others to be able to understand the resulting diff.  Furthermore, 
the manual warns that --minimal can be very slow; "git annotate" is 
already quite slow (10s+) on realistically sized repos, so compounding 
that with --minimal on every invocation is not appealing.

I think diff should, by default, handle the common case of moved text 
better.

Naively, it does not seem like detecting moved text should be very 
difficult or expensive.  Since the presence of the blank lines is a 
required element, a simple hack of avoiding anchoring on blank lines 
might go a long way here.  Better would be to avoid anchoring on any 
line content that is common.

I tested with diff 2.8.1 and diff 3.3 (latest as of writing).

-Scott

#!/bin/sh
# diff-bug-repro.sh: demonstrate diff bug with moving text

# Print lines with contents [$1,$2], separated by blank lines.
#
# The blank lines are important to this bug, because they seem
# to be treated by diff as anchor points: lines that haven't
# changed and hence the diff should try to work around them.
# Without the blank lines, diff works correctly.
genlines() {
   n=$1;
   while [ $n -le $2 ]; do
     echo $n;
     echo;
     n=`expr $n + 1`;
   done
}

# Simulates some original file that happens to have a lot of blank
# lines, as one might expect in source code, prose, HTML, etc.
echo "creating orig.txt: file with [1,5000], separated by blank lines..."
genlines 1 5000 > orig.txt

# Simulates a modification of orig.txt where a large block of text,
# represented by [11,499], is moved from near the beginning of the
# file to near the end of the file.
echo "creating new.txt: file with [1,10][500,4990][11,499][4991,5000], 
separated by blank lines..."
genlines 1 10 > new.txt
genlines 500 4990 >> new.txt
genlines 11 499 >> new.txt
genlines 4991 5000 >> new.txt

# The diff output contains 14948 lines, which is the bug.  It should
# only need about 2000 lines: 1000 to describe deleting the block from
# the start and 1000 lines to describe adding it at the end.
echo "diff -u orig.txt new.txt | wc -l"
diff -u orig.txt new.txt | wc -l

# EOF




From MAILER-DAEMON Thu May 15 01:13:17 2014
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Wknyn-0002xV-2c
	for mharc-bug-diffutils@gnu.org; Thu, 15 May 2014 01:13:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41764)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wknyf-0002tv-DJ
	for bug-diffutils@gnu.org; Thu, 15 May 2014 01:13:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WknyZ-0008JT-IA
	for bug-diffutils@gnu.org; Thu, 15 May 2014 01:13:09 -0400
Received: from debbugs.gnu.org ([140.186.70.43]:42050)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WknyZ-0008JP-5z
	for bug-diffutils@gnu.org; Thu, 15 May 2014 01:13:03 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1WknyY-0004JU-6L
	for bug-diffutils@gnu.org; Thu, 15 May 2014 01:13:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Paul Eggert <eggert@cs.ucla.edu>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Thu, 15 May 2014 05:13:02 +0000
Resent-Message-ID: <handler.17492.B17492.140013075516536@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 17492
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: Scott McPeak <smcpeak@coverity.com>, 17492@debbugs.gnu.org
Received: via spool by 17492-submit@debbugs.gnu.org id=B17492.140013075516536
	(code B ref 17492); Thu, 15 May 2014 05:13:02 +0000
Received: (at 17492) by debbugs.gnu.org; 15 May 2014 05:12:35 +0000
Received: from localhost ([127.0.0.1]:35114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Wkny6-0004Ic-NY
	for submit@debbugs.gnu.org; Thu, 15 May 2014 01:12:35 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:49871)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eggert@cs.ucla.edu>) id 1Wkny4-0004IK-Am
	for 17492@debbugs.gnu.org; Thu, 15 May 2014 01:12:32 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 711B7A6004E;
	Wed, 14 May 2014 22:12:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id NY2U0RRN8+VT; Wed, 14 May 2014 22:12:21 -0700 (PDT)
Received: from [192.168.1.9] (pool-108-0-233-62.lsanca.fios.verizon.net
	[108.0.233.62])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id B5AD2A60049;
	Wed, 14 May 2014 22:12:21 -0700 (PDT)
Message-ID: <53744CB5.4030208@cs.ucla.edu>
Date: Wed, 14 May 2014 22:12:21 -0700
From: Paul Eggert <eggert@cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
References: <53733272.4000904@coverity.com>
In-Reply-To: <53733272.4000904@coverity.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#17492: bug#17492: diff handles moved text
	poorly; should not need --minimal
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 15 May 2014 05:13:15 -0000

Thanks.  This sounds like Bug#16848, which was fixed in February after 
the latest diffutils release.  Can you build a copy of diffutils from 
the git repository and try it out?  Or perhaps you can cherry-pick the 
patches:

http://bugs.gnu.org/16848




From MAILER-DAEMON Thu May 15 14:30:24 2014
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Wl0QB-0003RS-NO
	for mharc-bug-diffutils@gnu.org; Thu, 15 May 2014 14:30:23 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37419)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl0Q3-0003RK-A4
	for bug-diffutils@gnu.org; Thu, 15 May 2014 14:30:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl0Pr-00013J-KX
	for bug-diffutils@gnu.org; Thu, 15 May 2014 14:30:15 -0400
Received: from debbugs.gnu.org ([140.186.70.43]:43271)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl0Pr-00011b-Hd
	for bug-diffutils@gnu.org; Thu, 15 May 2014 14:30:03 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl0Pq-00046G-U9
	for bug-diffutils@gnu.org; Thu, 15 May 2014 14:30:03 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Scott McPeak <smcpeak@coverity.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Thu, 15 May 2014 18:30:02 +0000
Resent-Message-ID: <handler.17492.B17492.140017858415702@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 17492
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: Paul Eggert <eggert@cs.ucla.edu>, <17492@debbugs.gnu.org>
Received: via spool by 17492-submit@debbugs.gnu.org id=B17492.140017858415702
	(code B ref 17492); Thu, 15 May 2014 18:30:02 +0000
Received: (at 17492) by debbugs.gnu.org; 15 May 2014 18:29:44 +0000
Received: from localhost ([127.0.0.1]:36335 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Wl0PX-00045B-ID
	for submit@debbugs.gnu.org; Thu, 15 May 2014 14:29:43 -0400
Received: from mail-bn1blp0185.outbound.protection.outlook.com
	([207.46.163.185]:3988
	helo=na01-bn1-obe.outbound.protection.outlook.com)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <smcpeak@coverity.com>) id 1Wl0PV-00044u-9N
	for 17492@debbugs.gnu.org; Thu, 15 May 2014 14:29:42 -0400
Received: from CH1PRD0310HT005.namprd03.prod.outlook.com (157.56.244.37) by
	DM2PR0501MB810.namprd05.prod.outlook.com (10.242.115.140) with
	Microsoft SMTP
	Server (TLS) id 15.0.944.11; Thu, 15 May 2014 18:29:33 +0000
Message-ID: <53750789.2090300@coverity.com>
Date: Thu, 15 May 2014 11:29:29 -0700
From: Scott McPeak <smcpeak@coverity.com>
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
References: <53733272.4000904@coverity.com> <53744CB5.4030208@cs.ucla.edu>
In-Reply-To: <53744CB5.4030208@cs.ucla.edu>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 7bit
X-Originating-IP: [157.56.244.37]
X-ClientProxiedBy: CO2PR05CA010.namprd05.prod.outlook.com (10.141.194.158)
	To DM2PR0501MB810.namprd05.prod.outlook.com (10.242.115.140)
X-Forefront-PRVS: 0212BDE3BE
X-Forefront-Antispam-Report: SFV:NSPM;
	SFS:(6009001)(428001)(189002)(199002)(377454003)(479174003)(24454002)(42186004)(74662001)(31966008)(74502001)(46102001)(21056001)(83322001)(64126003)(50466002)(79102001)(66066001)(81542001)(81342001)(4396001)(36756003)(65956001)(64706001)(80022001)(47776003)(65806001)(20776003)(65816999)(87976001)(2171001)(92566001)(83072002)(85852003)(92726001)(86362001)(59896001)(77982001)(76482001)(102836001)(99396002)(99136001)(83506001)(101416001)(76176999)(87266999)(23676002)(50986999)(54356999)(62816006);
	DIR:OUT; SFP:; SCL:1; SRVR:DM2PR0501MB810;
	H:CH1PRD0310HT005.namprd03.prod.outlook.com; FPR:; MLV:sfv;
	PTR:InfoNoRecords; MX:1; A:1; LANG:en; 
Received-SPF: None (: coverity.com does not designate permitted sender hosts)
Authentication-Results: spf=none (sender IP is )
	smtp.mailfrom=smcpeak@coverity.com; 
X-OriginatorOrg: coverity.com
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#17492: bug#17492: diff handles moved text
	poorly; should not need --minimal
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 15 May 2014 18:30:22 -0000

On 05/14/2014 10:12 PM, Paul Eggert wrote:
> Thanks.  This sounds like Bug#16848, which was fixed in February after
> the latest diffutils release.

It looks different to me.  In the case I reported, diff never shows 
inserting and removing the same line next to itself.

> Can you build a copy of diffutils from
> the git repository and try it out?

After about 20 minutes of chasing build dependencies, I timed out with a 
compile error about set_binary_mode.  To reproduce what I reported, one 
only has to run the short shell script I included, so perhaps someone 
with a working dev build could try that?

-Scott




From MAILER-DAEMON Thu May 15 22:24:20 2014
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Wl7oq-000520-0Z
	for mharc-bug-diffutils@gnu.org; Thu, 15 May 2014 22:24:20 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50460)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl7oh-0004wL-Qi
	for bug-diffutils@gnu.org; Thu, 15 May 2014 22:24:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl7oZ-0003YW-4d
	for bug-diffutils@gnu.org; Thu, 15 May 2014 22:24:11 -0400
Received: from debbugs.gnu.org ([140.186.70.43]:43476)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl7oZ-0003YS-0x
	for bug-diffutils@gnu.org; Thu, 15 May 2014 22:24:03 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wl7oY-0002ly-Q3
	for bug-diffutils@gnu.org; Thu, 15 May 2014 22:24:02 -0400
Resent-From: Paul Eggert <eggert@cs.ucla.edu>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-To: bug-diffutils@gnu.org
Resent-Date: Fri, 16 May 2014 02:24:02 +0000
Resent-Message-ID: <handler.17492.D17492.140020702310619.done@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: cc-closed 17492
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: Scott McPeak <smcpeak@coverity.com>, 17492-done@debbugs.gnu.org
Mail-Followup-To: 17492@debbugs.gnu.org, eggert@cs.ucla.edu,
	smcpeak@coverity.com
Received: via spool by 17492-done@debbugs.gnu.org id=D17492.140020702310619
	(code D ref 17492); Fri, 16 May 2014 02:24:02 +0000
Received: (at 17492-done) by debbugs.gnu.org; 16 May 2014 02:23:43 +0000
Received: from localhost ([127.0.0.1]:36538 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Wl7oE-0002lC-Ra
	for submit@debbugs.gnu.org; Thu, 15 May 2014 22:23:43 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:52003)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eggert@cs.ucla.edu>) id 1Wl7oC-0002ks-Nb
	for 17492-done@debbugs.gnu.org; Thu, 15 May 2014 22:23:41 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 5562EA6007F;
	Thu, 15 May 2014 19:23:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id CfKRMt0AIIeB; Thu, 15 May 2014 19:23:26 -0700 (PDT)
Received: from [192.168.1.9] (pool-108-0-233-62.lsanca.fios.verizon.net
	[108.0.233.62])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id BF414A60073;
	Thu, 15 May 2014 19:23:26 -0700 (PDT)
Message-ID: <5375769E.6080108@cs.ucla.edu>
Date: Thu, 15 May 2014 19:23:26 -0700
From: Paul Eggert <eggert@cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
References: <53733272.4000904@coverity.com> <53744CB5.4030208@cs.ucla.edu>
	<53750789.2090300@coverity.com>
In-Reply-To: <53750789.2090300@coverity.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#17492: bug#17492: diff handles moved text
	poorly; should not need --minimal
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 16 May 2014 02:24:19 -0000

Scott McPeak wrote:
> To reproduce what I reported, one only has to run the short shell script
> I included, so perhaps someone with a working dev build could try that?

I tried it and 'diff' worked for me:

$ diff -u orig.txt new.txt | wc -l
1972

So I'll mark the bug as fixed.




From MAILER-DAEMON Sat May 17 15:26:07 2014
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1WlkFC-0007Wl-Vq
	for mharc-bug-diffutils@gnu.org; Sat, 17 May 2014 15:26:06 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58947)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wliyu-0002Yc-CG
	for bug-diffutils@gnu.org; Sat, 17 May 2014 14:05:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wliyn-0006wP-NX
	for bug-diffutils@gnu.org; Sat, 17 May 2014 14:05:12 -0400
Received: from debbugs.gnu.org ([140.186.70.43]:52831)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wliyn-0006vs-LG
	for bug-diffutils@gnu.org; Sat, 17 May 2014 14:05:05 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wliyn-0000D3-5s
	for bug-diffutils@gnu.org; Sat, 17 May 2014 14:05:05 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?=E8=B0=AD=E6=96=8C?= <tanbin722@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Sat, 17 May 2014 18:05:04 +0000
Resent-Message-ID: <handler.17520.B.1400349870734@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 17520
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: 17520@debbugs.gnu.org
X-Debbugs-Original-To: bug-diffutils@gnu.org
Received: via spool by submit@debbugs.gnu.org id=B.1400349870734
	(code B ref -1); Sat, 17 May 2014 18:05:04 +0000
Received: (at submit) by debbugs.gnu.org; 17 May 2014 18:04:30 +0000
Received: from localhost ([127.0.0.1]:51706 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Wliy9-0000Be-Ht
	for submit@debbugs.gnu.org; Sat, 17 May 2014 14:04:29 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47746)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <tanbin722@gmail.com>) id 1WlfbV-0001JB-1o
	for submit@debbugs.gnu.org; Sat, 17 May 2014 10:28:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <tanbin722@gmail.com>) id 1WlfbJ-0007tR-8x
	for submit@debbugs.gnu.org; Sat, 17 May 2014 10:28:43 -0400
Received: from lists.gnu.org ([208.118.235.17]:32906)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <tanbin722@gmail.com>) id 1WlfbJ-0007tN-5N
	for submit@debbugs.gnu.org; Sat, 17 May 2014 10:28:37 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49442)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <tanbin722@gmail.com>) id 1WlfbC-00005i-Pg
	for bug-diffutils@gnu.org; Sat, 17 May 2014 10:28:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <tanbin722@gmail.com>) id 1Wlfb6-0007rq-Fg
	for bug-diffutils@gnu.org; Sat, 17 May 2014 10:28:30 -0400
Received: from mail-ie0-x244.google.com ([2607:f8b0:4001:c03::244]:33804)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <tanbin722@gmail.com>) id 1Wlfb6-0007rc-BP
	for bug-diffutils@gnu.org; Sat, 17 May 2014 10:28:24 -0400
Received: by mail-ie0-f196.google.com with SMTP id rd18so210288iec.7
	for <bug-diffutils@gnu.org>; Sat, 17 May 2014 07:28:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; 
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=nhWSw4rM4VNJ/g+1Ecgi/NpNlCLJ+DEDK8NbdAhh2aA=;
	b=R4rVCPnmkJzCU2AVW9dj5tn2VfobLztlDZxb/fBZ9o0cBMGvDZRlLnnk9/vapMA9xW
	rW8kL2lfz5F07ljD7U1TZTwHB02L0Zqu44014zlZPOPA9fNCRXECYROruc7ptSsjs+U0
	nS7+GEkDQqTjUIeDnIbXvCLnpCQHc2JvynkKmME6mJgroE5tES++8TFhVwIBfqXP81z1
	cQSfgqGA+sRNKbp40HE4bNMr66+PzZAZE82J5nWOJyxTkdlQdYk6nZ7iir8B3oORU1jc
	NOl8ktz2DHXxK++6QX149inKPzmGsaAQBDWEujFgDU0F2YbZO7T8woTFfMcYwAGklnMP
	7lBw==
MIME-Version: 1.0
X-Received: by 10.43.57.203 with SMTP id wh11mr2212200icb.68.1400336903366;
	Sat, 17 May 2014 07:28:23 -0700 (PDT)
Received: by 10.43.119.193 with HTTP; Sat, 17 May 2014 07:28:23 -0700 (PDT)
Date: Sat, 17 May 2014 22:28:23 +0800
Message-ID: <CAL7LUZJ5vtuWszta=-V21Z8syJbA74SjXmg4+6MFqBV6vk2w2w@mail.gmail.com>
From: =?UTF-8?Q?=E8=B0=AD=E6=96=8C?= <tanbin722@gmail.com>
Content-Type: multipart/alternative; boundary=bcaec51a8afab0eca604f99957c9
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Mailman-Approved-At: Sat, 17 May 2014 14:04:16 -0400
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
X-Mailman-Approved-At: Sat, 17 May 2014 15:26:05 -0400
Subject: [bug-diffutils] bug#17520: help about diff source code
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 17 May 2014 18:05:19 -0000

--bcaec51a8afab0eca604f99957c9
Content-Type: text/plain; charset=UTF-8

I'm reading about diffutils-2.7 source code recently,and I'm stuck in
analyze.c which is about Myers' diff algorithm.After reading Myers'
paper An O(ND) Difference Algorithm and its Variations,I still can't
understand diage function compareseq function discard_confusing_lines
function completely.Is there any help or suggestions?Thanks in advance

--bcaec51a8afab0eca604f99957c9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;m reading about diffutils-2.7 source code recently,a=
nd I&#39;m stuck in analyze.c which is about Myers&#39; diff algorithm.Afte=
r reading=C2=A0Myers&#39; paper=C2=A0An O(ND) Difference Algorithm and its =
Variations,I still can&#39;t understand diage function compareseq function =
discard_confusing_lines function completely.Is there any help or suggestion=
s?Thanks in advance</div>

--bcaec51a8afab0eca604f99957c9--




From MAILER-DAEMON Sat May 17 20:13:19 2014
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Wloj9-0003pn-NG
	for mharc-bug-diffutils@gnu.org; Sat, 17 May 2014 20:13:19 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43638)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wloj0-0003mK-Rn
	for bug-diffutils@gnu.org; Sat, 17 May 2014 20:13:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wloit-0006x9-DJ
	for bug-diffutils@gnu.org; Sat, 17 May 2014 20:13:10 -0400
Received: from debbugs.gnu.org ([140.186.70.43]:52932)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wloit-0006x1-A7
	for bug-diffutils@gnu.org; Sat, 17 May 2014 20:13:03 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1Wlois-0001Ax-TV
	for bug-diffutils@gnu.org; Sat, 17 May 2014 20:13:02 -0400
Resent-From: Paul Eggert <eggert@cs.ucla.edu>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-To: bug-diffutils@gnu.org
Resent-Date: Sun, 18 May 2014 00:13:02 +0000
Resent-Message-ID: <handler.17520.D17520.14003719224413.done@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: cc-closed 17520
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: =?UTF-8?Q?=E8=B0=AD=E6=96=8C?= <tanbin722@gmail.com>,
	17520-done@debbugs.gnu.org
Mail-Followup-To: 17520@debbugs.gnu.org, eggert@cs.ucla.edu,
	tanbin722@gmail.com
Received: via spool by 17520-done@debbugs.gnu.org id=D17520.14003719224413
	(code D ref 17520); Sun, 18 May 2014 00:13:02 +0000
Received: (at 17520-done) by debbugs.gnu.org; 18 May 2014 00:12:02 +0000
Received: from localhost ([127.0.0.1]:51809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1Wlohs-00018z-Ui
	for submit@debbugs.gnu.org; Sat, 17 May 2014 20:12:01 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:37820)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eggert@cs.ucla.edu>) id 1Wlohq-00018k-E5
	for 17520-done@debbugs.gnu.org; Sat, 17 May 2014 20:11:59 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 7802BA60008;
	Sat, 17 May 2014 17:11:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id WLLbQ1-WV3l7; Sat, 17 May 2014 17:11:43 -0700 (PDT)
Received: from [192.168.1.9] (pool-108-0-233-62.lsanca.fios.verizon.net
	[108.0.233.62])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id E739DA60021;
	Sat, 17 May 2014 17:11:42 -0700 (PDT)
Message-ID: <5377FABE.8030009@cs.ucla.edu>
Date: Sat, 17 May 2014 17:11:42 -0700
From: Paul Eggert <eggert@cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
References: <CAL7LUZJ5vtuWszta=-V21Z8syJbA74SjXmg4+6MFqBV6vk2w2w@mail.gmail.com>
In-Reply-To: <CAL7LUZJ5vtuWszta=-V21Z8syJbA74SjXmg4+6MFqBV6vk2w2w@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#17520: bug#17520: help about diff source code
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 18 May 2014 00:13:18 -0000

谭斌 wrote:
> Is there any help or suggestions?

I'm afraid not: all we have is what you see before you, and there is no 
secret documentation or master help key.




