On Thu, 4 Sep 2008, Matt Benson <[EMAIL PROTECTED]> wrote:

> 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 "**"). 

The situation of the testcase is (you'll need a monospaced font 8-)

       ,------>I
       |      / \
       |     /   \
       |   base   B
       |    /      \
       |   /        \
       `--A       file.txt
 
the fileset's basedir is "base".

> 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...

You mean an explicit A/base/A/B/file.txt would match but the same file
wouldn't be included if I used A/base/A/B/** or A/base/A/** ?

I could live with that, but it may seem confusing.  Not that I'd
expect anybody to use these kinds of patterns.

Would **/file.txt match A/B/file.txt at all?

> this shouldn't break anything that was already working,

True.  Most ** cases would run into infinite loops or fail with an
exception caused by the OS (Linux seems to limit the recursion depths
in a similar way Dominique suggests).

In my example above A/base/A/B/** wouldn't cause an infinite loop, so
the logic of not following a symlink must only be triggered if the
symlink itself would be part of the ** part.

In the end Dominique's idea may be simpler since we'd have to think
through cases of multiple patterns where one mathes exactly and the
other one is inside the ** part.

Stefan

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

Reply via email to