bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Line endings in admin files, sandbox shared between UNIX and NT


From: greg
Subject: Line endings in admin files, sandbox shared between UNIX and NT
Date: Mon, 24 Dec 2001 08:49:31 -0500

>Submitter-Id:   net
>Originator:     Greg Wolodkin
>Organization:   MathWorks, Inc.
net
>Confidential:  no
>Synopsis:      Line endings in admin files, sandbox shared between UNIX and NT
>Severity:      serious
>Priority:      medium
>Category:      cvs
>Class:         sw-bug
>Release:       1.11.1p1
>Environment:   
System: Linux fess 2.4.16 #1 SMP Wed Dec 5 08:17:54 EST 2001 i686 unknown
Architecture: i686

>Description:
This bug exists on all platforms, but only exhibits itself when two 
platforms with different line endings are sharing the same working copy
of the source.  In that situation (say Linux and NT), the NT will leave
^M characters in CVS/Repository, CVS/Entries, CVS/Root.. possibly other
places.  The UNIX machine will then choke on those ^M's, or be unable
to find the repository or version based on those line endings.

>How-To-Repeat:
Set up a scenario where UNIX and NT can mount the same disk.  We use
NetApp toasters which speak NFS and CIFS, but I'm fairly sure that Samba
would reproduce the problem as well.  From the NT, use "cvs checkout" on
some sources using a direct connection i.e. without a server, for example

  cvs -d //src/CVS/repo co stuff

where //src/CVS/repo is a UNC path to the repository.  (Note that this
already is a big hack .. I've set up the network drive and the NFS mount
so that they both are visible as //src/CVS/repo..)

Now all your CVS admin files in the working copy of stuff will have NT
line endings, and the UNIX machine won't be able to do much useful with
this copy of the source.

>Fix:
Best solution is to burn all copies of NT and upgrade the hardware to Linux.
Another work-around is to force the NT to go through another hop:

  cvs -d unixbox:/src/CVS/repo co stuff

instead.  Alternately, I've made a few small changes that seem to help,
and thought I'd share them in case anyone things the changes are worthy
or could be generalized to fix all possibly issues like this easily.

diff -rub /home/greg/src/orig/cvs-1.11.1p1/src/entries.c ./entries.c
--- /home/greg/src/orig/cvs-1.11.1p1/src/entries.c      Tue Apr 24 14:14:53 2001
+++ ./entries.c Thu Nov 15 12:49:34 2001
@@ -355,6 +355,7 @@
        tag_or_date = cp;
        if ((cp = strchr (tag_or_date, '\n')) == NULL)
            continue;
+       if (*(cp-1) == '\r') cp--;      /* Strip carriage return */
        *cp = '\0';
        tag = (char *) NULL;
        date = (char *) NULL;
diff -rub /home/greg/src/orig/cvs-1.11.1p1/src/repos.c ./repos.c
--- /home/greg/src/orig/cvs-1.11.1p1/src/repos.c        Thu Apr 19 15:45:33 2001
+++ ./repos.c   Thu Nov 15 12:49:19 2001
@@ -100,6 +100,8 @@

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

     /*
      * If this is a relative repository pathname, turn it into an absolute
diff -rub /home/greg/src/orig/cvs-1.11.1p1/src/root.c ./root.c
--- /home/greg/src/orig/cvs-1.11.1p1/src/root.c Thu Apr 19 15:45:33 2001
+++ ./root.c    Thu Nov 15 12:49:16 2001
@@ -85,6 +85,8 @@
     (void) fclose (fpin);
     if ((cp = strrchr (root, '\n')) != NULL)
        *cp = '\0';                     /* strip the newline */
+    if ((cp = strrchr (root, '\r')) != NULL)
+       *cp = '\0';                     /* strip the carriage return */

     /*
      * root now contains a candidate for CVSroot. It must be an


Cheers-
Greg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]