bug-cvs
[Top][All Lists]
Advanced

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

Problem with cvs


From: Andy Cedilnik
Subject: Problem with cvs
Date: 25 Oct 2002 13:40:58 -0400

>Submitter-Id:   net
>Originator:     Andy Cedilnik
>Organization:
net
>Confidential:  yes
>Synopsis:      CVS problem when repository soft-link
>Severity:      non-critical
>Priority:      medium
>Category:      cvs
>Class:         sw-bug
>Release:       1.11.2
>Environment:
System: Linux xanth.kitwarein.com 2.4.18 #6 SMP Tue Jun 11 14:37:02 EDT
2002 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux
Architecture: i686

>Description:
When cvs repository is a softlink, cvs cannot create lock. The assertion
in lock.c line 177 fails. 
The problem is that it compares the link path as a root of real path.
This fails. It should convert 
link path to real path first. However this only happens sometimes, so
the check should be made first
wether real path is necessary.

>How-To-Repeat:
Setup cvs server. The root of all cvs repositories is /cvsroot.
Create a cvs repository in let say /tmp/foo.
Create softlink for /tmp/foo in /cvsroot.
Try to checkout /cvsroot/foo. This should work.
Commit file in /cvsroot/foo.
Branch file in /cvsroot/foo.
Tag branch in /cvsroot/foo.

Try to checkout tagged version of branch of /cvsroot/foo.


>Fix:
This is a patch:

--- ./lock.c    2001-09-26 14:54:09.000000000 -0400
+++ ../../../../cvs-1.11.2/src/lock.c   2002-10-25 13:28:54.000000000
-0400
@@ -169,16 +169,30 @@ lock_name (repository, name)
     {
        struct stat sb;
        mode_t new_mode = 0;
+        char buffer[PATH_MAX];
+        char *dir;
 
        /* The interesting part of the repository is the part relative
           to CVSROOT.  */
        assert (current_parsed_root != NULL);
        assert (current_parsed_root->directory != NULL);
-       assert (strncmp (repository, current_parsed_root->directory,
-                        strlen (current_parsed_root->directory)) == 0);
-       short_repos = repository + strlen
(current_parsed_root->directory) + 1;
+        dir = current_parsed_root->directory;
 
-       if (strcmp (repository, current_parsed_root->directory) == 0)
+        /* If the dir is not in a subdirectory of repository, maybe
+           the repository is a soft link.  Check for that case.  */
+       if ( !strncmp (repository, dir,
+                      strlen (dir)) == 0)
+          {
+          if ( realpath(current_parsed_root->directory, buffer) )
+            {
+            dir = buffer;
+            }
+          }
+        assert(strncmp (repository, dir,
+                        strlen (dir)) == 0);
+       short_repos = repository + strlen (dir) + 1;
+
+       if (strcmp (repository, dir) == 0)
            short_repos = ".";
        else
            assert (short_repos[-1] == '/');





reply via email to

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