When the history file has lines with mixed line-endings (some \r\n, some
\n, presumably resulting from the use of different versions of cvs), the
history command is unable to match O and F records reliably.  This
happens because the history file is opened in binary mode, and the
read_hrecs() function is testing explicitly for '\n' as the record
terminator.  This results in the software thinking that the '\r'
preceding the '\n' is part of the data for the last field in the record
(hr->mod).

A patch against cvs-1.11.1p1 is attached.  The patch doesn't address the
Macintosh convention for line endings, but I assume the problem doesn't
occur with any versions of cvs on the Mac, because if it did, cvs
wouldn't be able to find any of the end-of-record marks, given the
hard-coded search for '\n' in the contents of a file opened in binary
mode.

-- 
Bob Kline
mailto:[EMAIL PROTECTED]
http://www.rksystems.com
--- cvs-1.11.1p1/src/history.c  Thu Apr 19 14:45:32 2001
+++ cvs-1.11.1p1/fix/history.c  Tue Jan 29 12:57:05 2002
@@ -1055,7 +1055,7 @@
 read_hrecs (fname)
     char *fname;
 {
-    unsigned char *cpstart, *cpend, *cp, *nl;
+    unsigned char *cpstart, *cpend, *cp, *nl, *cr;
     char *hrline;
     int i;
     int fd;
@@ -1107,6 +1107,9 @@
            error (0, 0, "warning: no newline at end of history file");
        }
        *nl = '\0';
+       cr = nl;
+       while (cr-- > cp && *cr == '\r')
+           *cr = '\0';
 
        if (hrec_count == hrec_max)
        {

Reply via email to