|
|
Choosing A Webhost: |
(no subject): msg#00141version-control.cvs.bugs
>Submitter-Id: net >Originator: Christos Zoulas >Organization: None, but trying. >Confidential: no >Synopsis: cvs gets confused about with symlinked root directory when >cvslock dir is present >Severity: serious >Priority: medium >Category: 1.11.2 >Class: sw-bug >Release: cvs-1.11.2 >Environment: System: NetBSD beowulf.gw.com 1.5ZC NetBSD 1.5ZC (GW-GENERIC) #46: Tue Apr 9 13:45:13 EDT 2002 kim@xxxxxxxxxx:/net/beowulf/src-1/NetBSD/cvsroot/src/sys/arch/i386/compile/GW-GENERIC i386 >Description: cvs gets confused with symlinks and cvs root directories that are accessed via symlinks, when we specify a cvs lock directory. >How-To-Repeat: 1. set cvs to use a separate locks tree, eg. /tmp/cvslock 2. setup your cvs repository via amd or just /foo/bar/baz 3. ln -s /foo/bar/baz /cvsroot 4. try cvs -d mymachine:/cvsroot checkout -jfoo:yestarday -jfoo modblah Notice the assertion failing on lock.c because the repository is /foo/bar/baz/mymodule... and parsed_root is /cvsroot >Fix: Index: lock.c =================================================================== RCS file: /src/twosigma/cvsroot/pub/devel/cvs/src/lock.c,v retrieving revision 1.3 diff -u -u -r1.3 lock.c --- lock.c 22 Apr 2002 14:20:57 -0000 1.3 +++ lock.c 22 Apr 2002 14:56:52 -0000 @@ -97,6 +97,7 @@ static void set_lockers_name PROTO((struct stat *statp)); static int set_writelock_proc PROTO((Node * p, void *closure)); static int unlock_proc PROTO((Node * p, void *closure)); +static int find_root PROTO((char *repository, char *rootdir)); static int write_lock PROTO ((struct lock *lock)); static void lock_simple_remove PROTO ((struct lock *lock)); static void lock_wait PROTO((char *repository)); @@ -169,14 +170,19 @@ { struct stat sb; mode_t new_mode = 0; + int len; /* 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; + /* + * Unfortunately, string comparisons are not enough because we + * might have symlinks present + */ + len = find_root(repository, current_parsed_root->directory); + assert(len != -1); + short_repos = repository + len + 1; if (strcmp (repository, current_parsed_root->directory) == 0) short_repos = "."; @@ -277,6 +283,45 @@ } } return retval; +} + +/* + * Find the root directory in the repository director + */ +static int +find_root(repository, rootdir) + char *repository; + char *rootdir; +{ + struct stat strep, stroot; + char *p = NULL, *q = NULL; + size_t len; + + if (stat(rootdir, &stroot) == -1) + return -1; + len = strlen(repository); + do { + if (p != NULL) { + len = p - repository; + *p = '\0'; + } + if (q != NULL) + *q = '/'; + if (stat(repository, &strep) == -1) { + if (p != NULL) + *p = '/'; + return -1; + } + if (strep.st_dev == stroot.st_dev && strep.st_ino == stroot.st_ino) { + if (p != NULL) + *p = '/'; + if (q != NULL) + *q = '/'; + return len; + } + q = p; + } while ((p = strrchr(repository, '/')) != NULL); + return -1; } /*
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | =?GB2312?Q?=BF=AA=CD=D8=CA=D0=B3=A1=C4=FA=CA=C7=D1=A1=D4=F1=CA=D8=D6=EA=B4=FD=CD=C3=BB=B9=CA=C7=D2=BB=C2=ED=B5=B1=CF=C8??=, ÎÂÖÝÊÐÕý¶«ÎÄ»¯´«²¥ÓÐÏÞ¹«Ë¾ |
|---|---|
| Next by Date: | =?GB2312?Q?=BF=AA=CD=D8=CA=D0=B3=A1=C4=FA=CA=C7=D1=A1=D4=F1=CA=D8=D6=EA=B4=FD=CD=C3=BB=B9=CA=C7=D2=BB=C2=ED=B5=B1=CF=C8??=, ÎÂÖÝÊÐÕý¶«ÎÄ»¯´«²¥ÓÐÏÞ¹«Ë¾ |
| Previous by Thread: | Re: (no subject), Larry Jones |
| Next by Thread: | Re: (no subject), Larry Jones |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |