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

* Re: cvs changes to support CR/LF in Root & Repository files
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Repin @ 2013-03-24  1:35 UTC (permalink / raw)
  To: Bill Priest, cygwin

Greetings, Bill Priest!

> 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).

"Normally", you either use Cygwin CVS, or windows CVS tools (such as
TortoiseCVS, or March-Hare CVS toolkit...).
Also, comparison with Subversion in this regard is just comparing apples and
oranges. Subversion was built from the ground with this issue in mind, and it
is explicitly using LF line endings in technical area under all operating
systems.
Speaking of which, can someone PLEASE take a look at GIT setup.hint and REMOVE
cvsps requirement. It is not used in daily git operations, and should not be
there.

> 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 */

>      /*


--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 24.03.2013, <05:19>

Sorry for my terrible english...


--
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

* Re: cvs changes to support CR/LF in Root & Repository files
  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-24  6:27 ` Csaba Raduly
  2013-03-24 15:31   ` Earnie Boyd
  1 sibling, 1 reply; 5+ messages in thread
From: Csaba Raduly @ 2013-03-24  6:27 UTC (permalink / raw)
  To: cygwin

Hi Bill,

On Sat, Mar 23, 2013 at 6:56 PM, Bill Priest wrote:
> 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 was able to access a sandbox (first checked out with Cygwin CVS)
with WinVCS and (windows)Eclipse's own CVS client. Maybe it'll work
for Tortoise also.

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
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

* Re: cvs changes to support CR/LF in Root & Repository files
  2013-03-24  6:27 ` cvs changes to support CR/LF in Root & Repository files Csaba Raduly
@ 2013-03-24 15:31   ` Earnie Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Earnie Boyd @ 2013-03-24 15:31 UTC (permalink / raw)
  To: cygwin

On Sun, Mar 24, 2013 at 2:27 AM, Csaba Raduly wrote:
>
> I was able to access a sandbox (first checked out with Cygwin CVS)
> with WinVCS and (windows)Eclipse's own CVS client. Maybe it'll work
> for Tortoise also.

Yes, but the reverse isn't always true.  Windows OS will read LF only
files just fine but CRLF on POSIX platforms causes issue.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
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

* git requirements [was: cvs changes to support CR/LF in Root & Repository files]
  2013-03-24  1:35 ` Andrey Repin
@ 2013-03-25 12:07   ` Eric Blake
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2013-03-25 12:07 UTC (permalink / raw)
  To: cygwin

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

On 03/23/2013 07:26 PM, Andrey Repin wrote:
> Speaking of which, can someone PLEASE take a look at GIT setup.hint and REMOVE
> cvsps requirement. It is not used in daily git operations, and should not be
> there.

Yes, I can do that the next time I rebuild git for cygwin.  You're lucky
I read this thread, though, since by the subject I wouldn't have guessed
it had anything to do with git.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

^ 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).