You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Dan Christian <dc...@google.com> on 2007/04/20 19:41:26 UTC

[PATCH] svn_io_remove_dir mishandles links

svn_io_remove_dir fails to remove directory trees containing symbolic links.

There seem to be two problems:  first anything other than dirs and
regular files were ignored (there was already a comment to this
effect).  Second, it never checked for symbolic links.  A symbolic
link to a directory would be walked like a regular directory entry
(possibly causing things outside the tree to be deleted).

There is no test case, because I can't find anything already testing
svn_io_remove_dir.

Oh, svn_walk_dir has similar problems (that was my first attempt at
working around the problems in svn_io_remove_dir).  It should be
getting link info and handling them.  I haven't worked on a patch for
this yet.

-Dan Christian

Re: [PATCH] svn_io_remove_dir mishandles links

Posted by Eric Gillespie <ep...@pretzelnet.org>.
"Dan Christian" <dc...@google.com> writes:

> Here is an updated patch.
> 
> It turns out that readdir is telling us about links, so the extra stat
> isn't needed (at least on Linux).  The code was just overly
> restrictive and ignoring everything that wasn't a regular file.
> 
> I've tested this in my code and "make check" is passing (as of 28 of 50).

Committed revision 24765.  In the future, please provide a log
message, but for this simple case, i wrote one.

Thanks.

-- 
Eric Gillespie <*> epg@pretzelnet.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svn_io_remove_dir mishandles links

Posted by Dan Christian <dc...@google.com>.
Here is an updated patch.

It turns out that readdir is telling us about links, so the extra stat
isn't needed (at least on Linux).  The code was just overly
restrictive and ignoring everything that wasn't a regular file.

I've tested this in my code and "make check" is passing (as of 28 of 50).

-Dan Christian


On 4/20/07, Dan Christian <dc...@google.com> wrote:
> svn_io_remove_dir fails to remove directory trees containing symbolic links.
>
> There seem to be two problems:  first anything other than dirs and
> regular files were ignored (there was already a comment to this
> effect).  Second, it never checked for symbolic links.  A symbolic
> link to a directory would be walked like a regular directory entry
> (possibly causing things outside the tree to be deleted).
>
> There is no test case, because I can't find anything already testing
> svn_io_remove_dir.
>
> Oh, svn_walk_dir has similar problems (that was my first attempt at
> working around the problems in svn_io_remove_dir).  It should be
> getting link info and handling them.  I haven't worked on a patch for
> this yet.
>
> -Dan Christian
>
>