GNU bug report logs - #19825
unified output format, number of consecutive unaffected lines, and POSIX

Previous Next

Package: diffutils;

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

Date: Tue, 10 Feb 2015 02:25:01 UTC

Severity: normal

Tags: notabug

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-diffutils <at> gnu.org
Subject: unified output format, number of consecutive unaffected lines, and
 POSIX
Date: Tue, 10 Feb 2015 03:23:48 +0100
Concerning the unified output format, POSIX says in

  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html

  "If -U n is specified, the output shall contain no more than
  n consecutive unaffected lines; and if the output contains an
  affected line and this line is adjacent to up to n consecutive
  unaffected lines in the corresponding file, the output shall
  contain these unaffected lines. -u shall act like -U3."

but with GNU diff and n = 3, one can get up to 6 consecutive
unaffected lines:

@@ -1,14 +1,14 @@
 1
 2
 3
-4
+4b
 5
 6
 7
 8
 9
 10
-11
+11b
 12
 13
 14

I actually think that the GNU diff behavior is better than POSIX.
And it is quite strange that POSIX specifies something different
because this format comes from GNU diff!

I think that the GNU diff manual should say something about this
difference. Or could this be regarded as a defect in POSIX?

Note: I noticed this after seeing that Subversion's internal diff
behaves again differently, with a behavior between GNU diff and
POSIX: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777479#17

-- 
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 / AriC project (LIP, ENS-Lyon)




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

Previous Next


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