[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-diffutils] [BUG] Incorrect diff output (diff -d is correct)

From: Andreas Gruenbacher
Subject: Re: [bug-diffutils] [BUG] Incorrect diff output (diff -d is correct)
Date: Thu, 30 Sep 2010 01:46:48 +0200
User-agent: KMail/1.13.5 (Linux/2.6.34-12-desktop; KDE/4.4.4; x86_64; ; )

On Wednesday 29 September 2010 18:45:29 Jean Delvare wrote:
> 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.

But doesn't this already answer your question?  Diff doesn't find the minimal 
diff when using the fast algorithm which doesn't guarantee optimal results.

> Apparently git does as well (I originally received the difference between
> the two files as a git patch.)

Git 1.7.3.rc2 produces the same, non-minimal result as GNU diff 2.8.7-cvs 
without the -d option for me.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]