Issue #3608 has been updated by Tomasz Wegrzanowski.

File lazy_path_test.rb added

> A problem of the lazy behaviour that is it opens a file descriptor when
> the block is called.
> 
> If the lazy each_child is used for recursively, the limit of number of
> descriptors limits the recursive levels.
> 
> I'm not sure which problem is important.

This won't normally be a problem as directory
handler isn't opened on to_enum, only once
iteration actually begins.

Unless you put these enumerators on different fibres or
something like that, your maximum number of open
files will be limited by your file system depth
and also by stack depth, whichever is lower.

You'd need to have 100s of sub directories
nested in one another like 1/2/3/4/5/.../100,
and have all these nested on ruby stack.

Take a look at attached test code
(also at http://pastebin.org/439336 )

Even with ulimit -n as low as 16 and
a lot of directories it works perfectly
(tested on 00/a - 99/z and on ruby source tree).

Test 1 shows that calling map(&:each_child) won't open
directory handlers just yet.

Test 2 shows that each_child works all right with recursion.

Test 3 just verifies that ulimit -n is applied.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/3608

----------------------------------------
http://redmine.ruby-lang.org