bug-cvs
[Top][All Lists]
Advanced

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

Re: cvs co -d <repository> prevention


From: Donald Sharp
Subject: Re: cvs co -d <repository> prevention
Date: Fri, 25 May 2001 12:39:09 -0400
User-agent: Mutt/1.2.4i

On Fri, May 25, 2001 at 12:20:19PM -0400, Donald Sharp wrote:
> On Fri, May 25, 2001 at 11:21:36AM -0400, Derek R. Price wrote:
> > Donald Sharp wrote:
> > 
> > Any particular reason you wrote this to fall back on CWD if it can't check
> > the argument to '-d'?  It strikes me that checking CWD in this case is still
> > as pointless as it used ot be...
> 
> Well...
> 
> your right.
> 
> How about this:
> 
>     if( where != NULL )
>     {
>         char *temp;
>         if( chdir( where ) != -1 )
>         {
>           where_location = xgetwd();
>           if( where_location == NULL )
>               error( 1, errno, "could not get working directory" );
> 
>           if( chdir( current ) == -1 )
>               error( 1, errno, "Could not change directory" );
> 
>           free( current );
>           current = where_location;
>         }
>         else
>             error( 1, errno, "Could not change directory into requested 
> checkout
>  directory" );
>     }
> 


This doesn't work either because the co -d <directory> 
allows the user to specify a directory that hasn't been 
created( as long as it is the last piece of the path ):

donsharp-u5:54> cvs -q co -d first-dir1 first-dir
U first-dir1/Emptydir/sfile1
U first-dir1/sdir2/sfile2
donsharp-u5:55> cvs -q co -d first-dir2/test first-dir
cvs checkout: cannot chdir to first-dir2: No such file or directory
cvs checkout: ignoring module first-dir
donsharp-u5:56> 
donsharp-u5:58> mkdir first-dir2
donsharp-u5:59> cvs -q co -d first-dir2/test/a first-dir
cvs checkout: cannot chdir to test: No such file or directory
cvs checkout: ignoring module first-dir

So I think that the correct time to check for safe_location is
after the directory tree has been built and chdir'ed into.

I'll go look at the code some more..

donald



reply via email to

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