In a nutshell, it seems we should keep track of the
canonical paths scanned and refuse to recurse them for
a path of infinite depth (i.e. one containing "**"). 
It could be possible to match a path containing a
recursive symlink by > 1 path of different lengths. 
So the infinite depth case is the one that could cause
infinite recursion and is thus the one that should be
guarded... this shouldn't break anything that was
already working, and would be limited enough to
preserve anything that was depending on symlink
recursion.  Are there flaws in my logic?

-Matt

--- Stefan Bodewig <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> as Issue 45499 shows DirectoryScanner can run into
> infinite loops by
> symbolic links that point to parent directories of
> the scanned
> directory.
> 
> I've committed an AntUnit test file that shows some
> interactions of
> DirectoryScanner and symlink to
>
<http://svn.apache.org/repos/asf/ant/core/trunk/src/tests/antunit/core/dirscanner-symlinks-test.xml>.
> 
> There are two tests where Ant may run into infinite
> loops, the targets
> with names that start with INFINITE and those should
> be fixed to
> somehow deal with the situation more gracefully.
> 
> The original reporter suggested a patch that would
> simply skip any
> symbolic link that was pointing to a parent of
> itself.  This would
> break the currently passing
> "testLinkToParentFollowWithInclude" where
> Ant doen't rescan ${base} because it doesn't satify
> the include
> pattern and it stays in "fast mode" (only looking
> for matches).
> 
> My idea was to just make sure that Ant doesn't
> follow the same link
> more than once (or doesn't scan the same directory
> more than once) but
> either would break the currently passing
> "testLinkToParentFollowWithIncludeMultiFollow".
> 
> The question is whether
> "testLinkToParentFollowWithIncludeMultiFollow"
> and "testLinkToParentFollowWithInclude" are even
> supposed to pass or
> whether we are willing to break BWC here (I lean
> towards breaking
> testLinkToParentFollowWithIncludeMultiFollow but
> keeping
> testLinkToParentFollowWithInclude).
> 
> As a side note: I detected a couple of other
> problems while putting
> together the tests and will open new bugzilla
> issues.  Namely:
> 
> * <fileset followsymlink="false"/> follows the link
> if the basedir
>   itself is a symbolic link (target
>   FAILStestBasedirIsSymlinkNoFollow).
> 
> * <delete> fails to delete directories with symlink
> loops inside
>   (that's why the targets delete the symlinks before
> tearDown).
> 
> * <symlink action="delete"> doesn't work if the link
> points to a
>   parent directory.
> 
> Stefan
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



      

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to