ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject DirectoryScanner and Symlinks
Date Thu, 04 Sep 2008 12:32:27 GMT
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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message