ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: DirectoryScanner and Symlinks
Date Mon, 08 Sep 2008 10:01:42 GMT
OK, combining suggestions by Gilles and Dominique here is what we
could do:

* add a new sttribute for maxSymlinkRecursionDepth (better name
  appreciated) and make it default to 5 (up for discussion as well).
  This limits how many times the same symlink can be followed.

* Keep a stack of simple directory names (only the file name portion,
  no leading directory and certainly not the canonical path) that
  holds the names of all directories traversed so far while doing the
  traversal.

* If the same simple name appears for the MAXth time, check whether
  that directory is a symlink.  If it is, check its canonical name and
  the canonical names of all other occurances of directories with the
  same name.  If they all point to the same location, ignore the
  directory.  If they point to different locations recurse but revisit
  things if the same name is encountered for the (MAX + 1)th time and
  so on.

This should address infinite loops and it should avoid
getCanonicalPath as much as possible.

I first thought it would be enough to check whether the link pointed
to a parent directory but it is possible to create inifinte loops with
two "cooperating" symlinks where neither link would point to a parent
of its own.

Does that sound OK?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message