GNU bug report logs - #24210
diff3 in diffutils 3.4 is broken

Previous Next

Package: diffutils;

Reported by: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>

Date: Fri, 12 Aug 2016 14:23:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24210 in the body.
You can then email your comments to 24210 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#24210; Package diffutils. (Fri, 12 Aug 2016 14:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bastian Beischer <bastian.beischer <at> rwth-aachen.de>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Fri, 12 Aug 2016 14:23:02 GMT) Full text and rfc822 format available.

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

From: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
To: bug-diffutils <at> gnu.org
Subject: diff3 in diffutils 3.4 is broken
Date: Fri, 12 Aug 2016 16:22:00 +0200
Hello,

Please try to run diff3 from diffutils 3.4 as follows:

echo a > a.txt
echo b > b.txt
echo c > c.txt
diff3 a.txt b.txt c.txt

Expected output (with diff3 from diffutils 3.3):

====
1:1c
 a
2:1c
 b
3:1c
 c

Actual output (with diff3 from diffutils 3.4):

====3
1:1c
2:1c
 a
3:1c
 c

There was only one commit in src/diff3.c between 3.3 and 3.4:

http://git.savannah.gnu.org/cgit/diffutils.git/commit/src?id=3b74a905c5460e7979c53273ac90345860d001a7

Reverting this commit fixes the issue.

Best
Bastian

-- 
Bastian Beischer
RWTH Aachen University of Technology

@RWTH Aachen
Office: 28 C 203
Phone: +49-241-80-27205
E-mail: beischer <at> physik.rwth-aachen.de
Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen

@CERN
Office: Bdg 32-4-B12
Phone: +41-22-76-75750
E-mail: bastian.beischer <at> cern.ch
Address: CERN, CH-1211 Geneve 23




Information forwarded to bug-diffutils <at> gnu.org:
bug#24210; Package diffutils. (Fri, 12 Aug 2016 16:36:01 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
Cc: 24210 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24210: diff3 in diffutils 3.4 is broken
Date: Fri, 12 Aug 2016 09:35:27 -0700
On Fri, Aug 12, 2016 at 7:22 AM, Bastian Beischer
<bastian.beischer <at> rwth-aachen.de> wrote:
> Hello,
>
> Please try to run diff3 from diffutils 3.4 as follows:
>
> echo a > a.txt
> echo b > b.txt
> echo c > c.txt
> diff3 a.txt b.txt c.txt
>
> Expected output (with diff3 from diffutils 3.3):
>
> ====
> 1:1c
>  a
> 2:1c
>  b
> 3:1c
>  c
>
> Actual output (with diff3 from diffutils 3.4):
>
> ====3
> 1:1c
> 2:1c
>  a
> 3:1c
>  c
>
> There was only one commit in src/diff3.c between 3.3 and 3.4:
>
> http://git.savannah.gnu.org/cgit/diffutils.git/commit/src?id=3b74a905c5460e7979c53273ac90345860d001a7
>
> Reverting this commit fixes the issue.

Yikes.
Thank you for the report.
I confirm that that patch is erroneous, and will prepare a complete
fix (adding your test and a NEWS entry) shortly.
Looks like diffutils-3.5 will have to be released pretty soon.




Information forwarded to bug-diffutils <at> gnu.org:
bug#24210; Package diffutils. (Sun, 14 Aug 2016 05:16:02 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
Cc: 24210 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24210: bug#24210: diff3 in diffutils 3.4 is
 broken
Date: Sat, 13 Aug 2016 22:14:46 -0700
[Message part 1 (text/plain, inline)]
On Fri, Aug 12, 2016 at 9:35 AM, Jim Meyering <jim <at> meyering.net> wrote:
> On Fri, Aug 12, 2016 at 7:22 AM, Bastian Beischer
> <bastian.beischer <at> rwth-aachen.de> wrote:
>> Hello,
>>
>> Please try to run diff3 from diffutils 3.4 as follows:
>>
>> echo a > a.txt
>> echo b > b.txt
>> echo c > c.txt
>> diff3 a.txt b.txt c.txt
...
>> There was only one commit in src/diff3.c between 3.3 and 3.4:
>>
>> http://git.savannah.gnu.org/cgit/diffutils.git/commit/src?id=3b74a905c5460e7979c53273ac90345860d001a7
>>
>> Reverting this commit fixes the issue.
>
> Yikes.
> Thank you for the report.
> I confirm that that patch is erroneous, and will prepare a complete
> fix (adding your test and a NEWS entry) shortly.
> Looks like diffutils-3.5 will have to be released pretty soon.

I've reverted that, added your test case and updated NEWS with a
commit in your name. Please review that first commit, in the attached.

    diff3: fix heap use-after-free; add minimal diff3 test coverage

I have also made two other changes:

      maint: require that commit messages be of a certain form
      diff3: fix leaks, for real

The first of those enforces some modicum of sanity on commit log
messages, and might have prevented the offending commit. This is
largely copied from what I did for coreutils.

The final change actually does plug diff3's leaks. The minimal test
cases did not exercise the code to handle multiple diff blocks, so I
added one that does. One can argue that explicitly freeing some of
those buffers is not required, so I have made it so that nearly all of
the code added by this fix can be compiled out.
[diff3-leak-fix.diff (text/plain, attachment)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#24210; Package diffutils. (Mon, 15 Aug 2016 00:15:02 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
Cc: 24210 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24210: bug#24210: bug#24210: diff3 in
 diffutils 3.4 is broken
Date: Sun, 14 Aug 2016 17:13:35 -0700
On Sat, Aug 13, 2016 at 10:14 PM, Jim Meyering <jim <at> meyering.net> wrote:
> On Fri, Aug 12, 2016 at 9:35 AM, Jim Meyering <jim <at> meyering.net> wrote:
>> On Fri, Aug 12, 2016 at 7:22 AM, Bastian Beischer
>> <bastian.beischer <at> rwth-aachen.de> wrote:
>>> Hello,
>>>
>>> Please try to run diff3 from diffutils 3.4 as follows:
>>>
>>> echo a > a.txt
>>> echo b > b.txt
>>> echo c > c.txt
>>> diff3 a.txt b.txt c.txt
> ...
>>> There was only one commit in src/diff3.c between 3.3 and 3.4:
>>>
>>> http://git.savannah.gnu.org/cgit/diffutils.git/commit/src?id=3b74a905c5460e7979c53273ac90345860d001a7
>>>
>>> Reverting this commit fixes the issue.
>>
>> Yikes.
>> Thank you for the report.
>> I confirm that that patch is erroneous, and will prepare a complete
>> fix (adding your test and a NEWS entry) shortly.
>> Looks like diffutils-3.5 will have to be released pretty soon.
>
> I've reverted that, added your test case and updated NEWS with a
> commit in your name. Please review that first commit, in the attached.
...
Normally I would be more patient in waiting for your review, but I'm
in a hurry to make diffutils-3.5, so have just pushed those, and am
now preparing a pre-release snapshot.




Information forwarded to bug-diffutils <at> gnu.org:
bug#24210; Package diffutils. (Mon, 15 Aug 2016 05:55:02 GMT) Full text and rfc822 format available.

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

From: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
To: Jim Meyering <jim <at> meyering.net>
Cc: 24210 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24210: bug#24210: bug#24210: diff3 in
 diffutils 3.4 is broken
Date: Mon, 15 Aug 2016 07:54:16 +0200
[Message part 1 (text/plain, inline)]
Hey Jim,

The patches look fine to me, although I don't know the source of diff3 well
enough to be a good reviewer. I've tested the patches a bit and everything
seems to be OK. Thanks for fixing this issue.

Cheers
Bastian

Am 15.08.2016 02:14 schrieb "Jim Meyering" <jim <at> meyering.net>:

> On Sat, Aug 13, 2016 at 10:14 PM, Jim Meyering <jim <at> meyering.net> wrote:
> > On Fri, Aug 12, 2016 at 9:35 AM, Jim Meyering <jim <at> meyering.net> wrote:
> >> On Fri, Aug 12, 2016 at 7:22 AM, Bastian Beischer
> >> <bastian.beischer <at> rwth-aachen.de> wrote:
> >>> Hello,
> >>>
> >>> Please try to run diff3 from diffutils 3.4 as follows:
> >>>
> >>> echo a > a.txt
> >>> echo b > b.txt
> >>> echo c > c.txt
> >>> diff3 a.txt b.txt c.txt
> > ...
> >>> There was only one commit in src/diff3.c between 3.3 and 3.4:
> >>>
> >>> http://git.savannah.gnu.org/cgit/diffutils.git/commit/src?id=
> 3b74a905c5460e7979c53273ac90345860d001a7
> >>>
> >>> Reverting this commit fixes the issue.
> >>
> >> Yikes.
> >> Thank you for the report.
> >> I confirm that that patch is erroneous, and will prepare a complete
> >> fix (adding your test and a NEWS entry) shortly.
> >> Looks like diffutils-3.5 will have to be released pretty soon.
> >
> > I've reverted that, added your test case and updated NEWS with a
> > commit in your name. Please review that first commit, in the attached.
> ...
> Normally I would be more patient in waiting for your review, but I'm
> in a hurry to make diffutils-3.5, so have just pushed those, and am
> now preparing a pre-release snapshot.
>
[Message part 2 (text/html, inline)]

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Mon, 15 Aug 2016 13:57:02 GMT) Full text and rfc822 format available.

Notification sent to Bastian Beischer <bastian.beischer <at> rwth-aachen.de>:
bug acknowledged by developer. (Mon, 15 Aug 2016 13:57:02 GMT) Full text and rfc822 format available.

Message #22 received at 24210-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Bastian Beischer <bastian.beischer <at> rwth-aachen.de>
Cc: 24210-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24210: bug#24210: bug#24210: diff3 in
 diffutils 3.4 is broken
Date: Mon, 15 Aug 2016 06:56:02 -0700
On Sun, Aug 14, 2016 at 10:54 PM, Bastian Beischer
<bastian.beischer <at> rwth-aachen.de> wrote:
> The patches look fine to me, although I don't know the source of diff3 well
> enough to be a good reviewer. I've tested the patches a bit and everything
> seems to be OK. Thanks for fixing this issue.

Thanks for testing.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Sep 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 238 days ago.

Previous Next


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