public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cvs changes to support CR/LF in Root & Repository files
@ 2013-03-23 17:56 Bill Priest
  2013-03-24  1:35 ` Andrey Repin
  2013-03-24  6:27 ` cvs changes to support CR/LF in Root & Repository files Csaba Raduly
  0 siblings, 2 replies; 5+ messages in thread
From: Bill Priest @ 2013-03-23 17:56 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 3412 bytes --]

All,
  I used tortoisecvs (as a plugin for windows eclipse) to check out
some repositories to a "windows 7" directory (e.g. not a cygwin
directory).  I tried to use the cygwin cvs client to diff files and
check status but it complained ": no such repository" for "cvs log
<filename>".  A simple dos2unix on the CVS/Root file changed the error
to "cvs log: nothing known about <filename>"; a dos2unix on
CVS/Repository allowed the "cvs log" command to work correctly.
  I'm used to being able to copy/move svn sandboxes between linux and
windows w/o any issues so I checked into the cvs source to see what it
would take to support LF as well as CR/LF.  This issue isn't limited
to the cygwin cvs as the same "sandbox" copied to linux has the same
problem.
  I hacked the root.c and repos.c to work around the problem (as of
yet I haven't seen any impact to commands wrt Entries and template
don't seem to be affected.
  I've attached patch.txt with the changes.  This can be tested by
running dos2unix CVS/Root CVS/Repository; cvs log configure (the
current version of cvs will not work while the patched version will
work normally).

Bill

Index: ChangeLog
===================================================================
RCS file: /sources/cvs/ccvs/ChangeLog,v
retrieving revision 1.1379
diff -u -r1.1379 ChangeLog
--- ChangeLog   12 Nov 2009 02:29:17 -0000      1.1379
+++ ChangeLog   23 Mar 2013 17:48:31 -0000
@@ -1,3 +1,8 @@
+2013-03-23  Bill Pries <priestwilliaml@gmail.com>
+
+       * root.c: Support CR/LF as well as LF
+       * repos.c: Support CR/LF as well as LF
+
 2009-11-11  Derek R. Price  <derek@ximbiot.com>

        * NEWS: Note default taginfo format string fix.
Index: src/repos.c
===================================================================
RCS file: /sources/cvs/ccvs/src/repos.c,v
retrieving revision 1.49
diff -u -r1.49 repos.c
--- src/repos.c 18 Nov 2008 22:56:55 -0000      1.49
+++ src/repos.c 23 Mar 2013 17:48:31 -0000
@@ -101,6 +101,9 @@
        error (0, errno, "cannot close %s", quote (tmp));
     free (tmp);

+    if ((cp = strrchr (repos, '\r')) != NULL)
+       *cp = '\0';                     /* strip the carriage return */
+
     if ((cp = strrchr (repos, '\n')) != NULL)
        *cp = '\0';                     /* strip the newline */

Index: src/root.c
===================================================================
RCS file: /sources/cvs/ccvs/src/root.c,v
retrieving revision 1.137
diff -u -r1.137 root.c
--- src/root.c  12 Sep 2008 19:55:29 -0000      1.137
+++ src/root.c  23 Mar 2013 17:48:31 -0000
@@ -60,7 +60,6 @@
     char *tmp;
     char *cvsadm;
     char *cp;
-    int len;

     TRACE (TRACE_FLOW, "Name_Root (%s, %s)",
           TRACE_NULL (dir), TRACE_NULL (update_dir));
@@ -88,7 +87,7 @@
      */
     fpin = xfopen (tmp, "r");

-    if ((len = getline (&root, &root_allocated, fpin)) < 0)
+    if (getline (&root, &root_allocated, fpin) < 0)
     {
        char *admfile = dir_append (update_dir, CVSADM_ROOT);
        /* FIXME: should be checking for end of file separately; errno
@@ -99,8 +98,11 @@
        goto out;
     }
     fclose (fpin);
-    cp = root + len - 1;
-    if (*cp == '\n')
+
+    if ((cp = strrchr (root, '\r')) != NULL)
+       *cp = '\0';                     /* strip the carriage return */
+
+    if ((cp = strrchr (root, '\n')) != NULL)
        *cp = '\0';                     /* strip the newline */

     /*

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2113 bytes --]

Index: ChangeLog
===================================================================
RCS file: /sources/cvs/ccvs/ChangeLog,v
retrieving revision 1.1379
diff -u -r1.1379 ChangeLog
--- ChangeLog	12 Nov 2009 02:29:17 -0000	1.1379
+++ ChangeLog	23 Mar 2013 17:50:07 -0000
@@ -1,3 +1,8 @@
+2013-03-23  Bill Pries <priestwilliaml@gmail.com>
+
+	* root.c: Support CR/LF as well as LF
+	* repos.c: Support CR/LF as well as LF
+
 2009-11-11  Derek R. Price  <derek@ximbiot.com>
 
 	* NEWS: Note default taginfo format string fix.
Index: src/repos.c
===================================================================
RCS file: /sources/cvs/ccvs/src/repos.c,v
retrieving revision 1.49
diff -u -r1.49 repos.c
--- src/repos.c	18 Nov 2008 22:56:55 -0000	1.49
+++ src/repos.c	23 Mar 2013 17:50:08 -0000
@@ -101,6 +101,9 @@
 	error (0, errno, "cannot close %s", quote (tmp));
     free (tmp);
 
+    if ((cp = strrchr (repos, '\r')) != NULL)
+	*cp = '\0';			/* strip the carriage return */
+
     if ((cp = strrchr (repos, '\n')) != NULL)
 	*cp = '\0';			/* strip the newline */
 
Index: src/root.c
===================================================================
RCS file: /sources/cvs/ccvs/src/root.c,v
retrieving revision 1.137
diff -u -r1.137 root.c
--- src/root.c	12 Sep 2008 19:55:29 -0000	1.137
+++ src/root.c	23 Mar 2013 17:50:08 -0000
@@ -60,7 +60,6 @@
     char *tmp;
     char *cvsadm;
     char *cp;
-    int len;
 
     TRACE (TRACE_FLOW, "Name_Root (%s, %s)",
 	   TRACE_NULL (dir), TRACE_NULL (update_dir));
@@ -88,7 +87,7 @@
      */
     fpin = xfopen (tmp, "r");
 
-    if ((len = getline (&root, &root_allocated, fpin)) < 0)
+    if (getline (&root, &root_allocated, fpin) < 0)
     {
 	char *admfile = dir_append (update_dir, CVSADM_ROOT);
 	/* FIXME: should be checking for end of file separately; errno
@@ -99,8 +98,11 @@
 	goto out;
     }
     fclose (fpin);
-    cp = root + len - 1;
-    if (*cp == '\n')
+
+    if ((cp = strrchr (root, '\r')) != NULL)
+	*cp = '\0';			/* strip the carriage return */
+
+    if ((cp = strrchr (root, '\n')) != NULL)
 	*cp = '\0';			/* strip the newline */
 
     /*

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-25 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-23 17:56 cvs changes to support CR/LF in Root & Repository files Bill Priest
2013-03-24  1:35 ` Andrey Repin
2013-03-25 12:07   ` git requirements [was: cvs changes to support CR/LF in Root & Repository files] Eric Blake
2013-03-24  6:27 ` cvs changes to support CR/LF in Root & Repository files Csaba Raduly
2013-03-24 15:31   ` Earnie Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).