bug-gnu-utils
[Top][All Lists]
Advanced

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

diffutils-2.7: io.c: missing_newline in file suffix not handled


From: paul
Subject: diffutils-2.7: io.c: missing_newline in file suffix not handled
Date: Wed, 27 Sep 2000 19:12:33 -0400

Greetings,

The problem is:
        echo -en '1\n2\n3\n4\n5' > 1
        echo -en '1\n2\n3\n0\n5' > 2
        diff -u 1 2 > d
        grep '^\\ No newline' < d || echo NOT GOOD
        mv 1 2
        patch -p0 < d || echo OUCH

In my own opinion this is a major bug (has bitten me in automated
use of diff/patch).

I suggest the diff below (*big-meta-grin*).  One could argue that
GNU patch should be fixed instead, but I think even context lines
deserve that funny '\ No newline' tag.

Regards,
Paul Stoeber <address@hidden>
Weisshuhn & Weisshuhn Kommunikationsmanagement GmbH | http://www.weisshuhn.de


--- io.c.orig   Thu Sep 22 16:47:00 1994
+++ io.c        Wed Sep 27 23:34:59 2000
@@ -362,7 +362,12 @@
       linbuf[line] = (char const *) p;
 
       if ((char const *) p == bufend)
-       break;
+       {
+         if (current->missing_newline
+             && ROBUST_OUTPUT_STYLE (output_style))
+           linbuf[line]--;
+         break;
+       }
 
       if (context <= i && no_diff_means_no_output)
        break;



reply via email to

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