[Still seems like there is more to do in terms of taking a hard look and really figuring out just what is going on. -kingdon] Date: Mon, 07 Sep 1998 06:38:45 +1000 From: mbishop@acnielsen.com.au (Murray Bishop) To: bug-cvs@gnu.org Subject: log-11 fails on Windows-NT Content-Type: multipart/mixed; boundary="------------79F651AE3DF8" This is a multi-part message in MIME format. --------------79F651AE3DF8 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Using CVS-1.10.1 built on Windows-NT with MS Visual-C++ 4.2 the sanity.sh test log-11 fails. The problem is that trailing spaces aren't being removed from the first two lines of the multi line log message set in test log-3. Here's the unexpected log-11 output with quotes around each line to show the extra spaces. "revision 1.1" "date: 1998/09/06 03:44:14; author: mbishop; state: Exp;" "line 1 " " " "line 2" "----------------------------" Here's the file that's passed to CVS after -F in test log-3. C:\u\104029~1.1-V\ccvs\WinDebug>od -c comment.tmp 0000000 l i n e 1 \r \n 0000020 \r \n l i n e 2 \t \r \n \t \r \n 0000040 \t \r \n 0000047 Interestingly enough, whitespace following "line 2" and two lines of whitespace after that are removed. In src/commit.c(commit), the comment.tmp file is opened in binary mode. On windows and OS/2, that means that the \r\n sequences marking endlines are not translated to \n. It looks like the trailing whitespace trimming happens in src/subr.c(make_message_rcslegal). It's called from src/rcs.c(RCS_checkin). make_message_rcslegal has one loop removing ' ' and '\t' preceding '\n' (which regards \r as non-white), and another loop removing characters matching isspace() from the end of the string. (I guess to remove trailing newlines left by the first loop). MS Visual C++ treats 0x09-0x0d and 0x20 as space, so the \r are removed from end string. After either or both of the attached patches, log-11 passes. Could the patch to commit be checked in? --------------79F651AE3DF8 Content-Type: text/plain; charset=us-ascii; name="COMMIT.DIF" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="COMMIT.DIF" *** commit.c-10.1 Sun Sep 06 10:05:47 1998 --- commit.c Sun Sep 06 14:17:59 1998 *************** *** 422,429 **** if (saved_message) error (1, 0, "cannot specify both a message and a log file"); ! /* FIXME: Why is this binary? Needs more investigation. */ ! if ((logfd = CVS_OPEN (logfile, O_RDONLY | OPEN_BINARY)) < 0) error (1, errno, "cannot open log file %s", logfile); if (fstat(logfd, &statbuf) < 0) --- 422,432 ---- if (saved_message) error (1, 0, "cannot specify both a message and a log file"); ! /* What we have here is the name of file whose contents are ! * the log message. I guess it's better to open text mode for ! * those OS where it makes a difference. ! */ ! if ((logfd = CVS_OPEN (logfile, O_RDONLY)) < 0) error (1, errno, "cannot open log file %s", logfile); if (fstat(logfd, &statbuf) < 0) --------------79F651AE3DF8 Content-Type: text/plain; charset=us-ascii; name="SUBR.DIF" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="SUBR.DIF" *** subr.c-10.1 Fri May 29 10:22:04 1998 --- subr.c Mon Sep 07 06:21:40 1998 *************** *** 527,533 **** if (*mp == '\n') { /* At end-of-line; backtrack to last non-space. */ ! while (dp > dst && (dp[-1] == ' ' || dp[-1] == '\t')) --dp; } *dp++ = *mp; --- 527,533 ---- if (*mp == '\n') { /* At end-of-line; backtrack to last non-space. */ ! while (dp > dst && isspace (dp[-1]) && (dp[-1] != '\n')) --dp; } *dp++ = *mp; --------------79F651AE3DF8--