[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in offsets printed by cmp -l
From: |
Dale Farnsworth |
Subject: |
bug in offsets printed by cmp -l |
Date: |
Thu, 8 Feb 2001 16:58:48 -0700 |
User-agent: |
Mutt/1.3.12i |
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.
-Dale
address@hidden
MontaVista Software, Inc.
+1-480-517-5093
Here is the diff:
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++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug in offsets printed by cmp -l,
Dale Farnsworth <=