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

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

Re: bug in offsets printed by cmp -l


From: Paul Eggert
Subject: Re: bug in offsets printed by cmp -l
Date: Sat, 15 Jun 2002 23:53:27 -0700 (PDT)

> From: "Dale Farnsworth" <address@hidden>
> Date: Thu, 8 Feb 2001 16:58:48 -0700
> 
> cmp improperly bumps its offset, char_number, in each read buffer
> with differences.  The error accumulates so that for large files
> with many differences, the offset can be significantly erroneous.

Sorry about the late reply; I misfiled your message.

> Here is the diff:

Your patch (enclosed below) doesn't seem to apply to GNU diff.
It looks like you are patching an old version of Debian diff.
Most likely you ran afoul of Debian Bug 89755
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=89755>.
That bug never existed in GNU diff; it occurred only in Debian
diff_2.7-19 through diff_2.7-23.


> 
> diff -u diff-2.7/cmp.c diff-2.7-new/cmp.c
> --- diff-2.7/cmp.c    Thu Feb  8 16:52:07 2001
> +++ diff-2.7-new/cmp.c        Thu Feb  8 16:44:53 2001
> @@ -369,7 +369,7 @@
>             return 1;
>  
>           case type_all_diffs:
> -           char_number += range[0][0]+1;
> +           char_number += range[0][0];
>             do
>               {
>                 unsigned char c0 = buf0[first_diff];
> @@ -378,7 +378,7 @@
>                   {
>                     if (opt_print_chars)
>                       {
> -                       printf ("%6lu %3o ", char_number, c0);
> +                       printf ("%6lu %3o ", char_number+1, c0);
>                         printc (4, c0);
>                         printf (" %3o ", c1);
>                         printc (0, c1);
> @@ -386,7 +386,7 @@
>                       }
>                     else
>                       /* See Posix.2 section 4.10.6.1 for this format.  */
> -                     printf ("%6lu %3o %3o\n", char_number, c0, c1);
> +                     printf ("%6lu %3o %3o\n", char_number+1, c0, c1);
>                   }
>                 char_number++;
>                 first_diff++;



reply via email to

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