Subject: bug#16864: overlapping chunks with the -I option

From: Vincent Lefevre <[email-masked]>
Date: Mon, 24 Feb 2014 15:31:37 +0100

Consider two files:

file1:
1a
2
3a
4
5
6

file2:
1b
2
3b
4
5
6
7

With diff (GNU diffutils) 3.3 under Debian/unstable, I get:

$ diff -u -I3 file1 file2
--- file1       2014-02-24 12:58:12.485367096 +0100
+++ file2       2014-02-24 12:58:08.879933593 +0100
@@ -1,6 +1,6 @@
-1a
+1b
 2
-3a
+3b
 4
 5
 6
@@ -4,3 +4,4 @@
 4
 5
 6
+7

i.e. with overlapping chunks. Ditto with the latest patches.
Here I would expect:

--- file1       2014-02-24 12:58:12.485367096 +0100
+++ file2       2014-02-24 12:58:08.879933593 +0100
@@ -1,6 +1,7 @@
-1a
+1b
 2
-3a
+3b
 4
 5
 6
+7

Note that if the 3rd line is the same in both files, one gets
only one chunk:

@@ -1,6 +1,7 @@
-1a
+1b
 2
 3
 4
 5
 6
+7

so that getting 2 chunks with -I is definitely unexpected.

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)