[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-diffutils] [BUG] Incorrect diff output (diff -d is correct)
From: |
Jean Delvare |
Subject: |
[bug-diffutils] [BUG] Incorrect diff output (diff -d is correct) |
Date: |
Wed, 29 Sep 2010 18:45:29 +0200 |
Hi there,
I have attached two versions of a C source GNU diff has a hard time
diff'ing. The only difference between the two files is that several
functions have been moved around to avoid forward declarations. But the
output of "diff -u" is more complex than it should be. While I can
understand that the algorithm is not perfect and can lead to results
different from what a human would have done, the following excerpt:
- if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
- return -ENODEV;
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+ return -ENODEV;
is obviously wrong, no matter how you look at it.
"diff -ud" gets the correct output. Apparently git does as well (I
originally received the difference between the two files as a git
patch.)
I have reproduced this bug on 4 different versions of GNU diff: 2.8.1
(slackware 12.0 binary), 2.8.7 (as shipped with openSUSE 11.3 x86_64),
2.9 and 3.0 (both self-built from sources.)
I'm sorry that the attached files are relatively large, but when I
tried to shorten them, the bug disappeared, so I had to leave them
verbatim. This confirms my impression that this is a real bug and not a
limitation of the diff'ing algorithm.
--
Jean Delvare
lm90.c
Description: Text Data
lm90.c.orig
Description: Text Data
- [bug-diffutils] [BUG] Incorrect diff output (diff -d is correct),
Jean Delvare <=