GNU bug report logs - #23644
bug with context greater than 0

Previous Next

Package: diffutils;

Reported by: Claude <lamy.claude <at> gmail.com>

Date: Sun, 29 May 2016 05:48:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Claude <lamy.claude <at> gmail.com>
To: 23644 <at> debbugs.gnu.org
Subject: bug#23644: bug with context greater than 0
Date: Sat, 28 May 2016 23:51:07 -0400
[Message part 1 (text/plain, inline)]
Hi

I think I have found a bug with diff when context is greater then zero.
I have included the two files and the diff file produced.

This diff file has been generated with version 2.7 running on Windows 7.
The same behavior have been noticed with version 3.3 running on linux.

My command was  diff -C 2 original.txt modified.txt

Now looking on the produced diff file, I had two additions.  At the 
beggining and at the end of my modified file.

*** Original.txt    Sat May 28 09:07:08 2016
--- Modified.txt    Sat May 28 09:07:18 2016
***************
*** 1,2 ****
--- 1,8 ----
+ This is an important
+ notice! It should
+ therefore be located at
+ the beginning of this
+ document!
+
  This part of the
  document has stayed the
***************
*** 6,20 ****
  change.  Otherwise, that
  would not be helping to
! compress the size of the
! changes.
!
! This paragraph contains
! text that is outdated.
! It will be deleted in the
! near future.

  allo
  It is important to spell
! check this dokument. On
  the other hand, a
  misspelled word isn't
--- 12,20 ----
  change.  Otherwise, that
  would not be helping to
! compress anything.

  allo
  It is important to spell
! check this document. On
  the other hand, a
  misspelled word isn't
***************
*** 24,25 ****
--- 24,29 ----
  be changed. Things can
  be added after it.
+
+ This paragraph contains
+ important new additions
+ to this document.

Notice that  on the original file diff specifies that it will list 
context lines content 1,2 for the
beginning and 24,25 for the end, but the lines are not displayed in the 
diff block description.
The two context lines appear for the modified files for the same 
differences though.
Also, the two context lines are displayed, at top, and at bottom when 
differences occure in the middle of the file.

I have no corrections for this bug.  I haven't looked at the code.

Thanks


[Original.txt (text/plain, attachment)]
[differences-context-2.txt (text/plain, attachment)]
[Modified.txt (text/plain, attachment)]

This bug report was last modified 9 years and 19 days ago.

Previous Next


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