Currently if you have a "mount cycle" (2 drives that mount each other) the readdir() call with {recursive: true} will enter an endless loop.
Even without a cycle, mount-graphs have the potential to become so large that recursion is not feasible. (E.g. Beaker's use of mounts for the social graph could cause a recursive readdir to iterate the "strong set.")
Ways we can solve this:
Add a depth parameter to limit the number of recursions into subfolders
Add a mountDepth parameter to limit the number of recursions into mounts
Don't recurse into mounts at all (aka mountDepth is always 0)
Ways we can't solve this:
Track mounts and break cycles. This would solve the cycle problem but large mount-graphs would still be an issue.
I personally prefer either the mountDepth option or not recursing into mounts.
Currently if you have a "mount cycle" (2 drives that mount each other) the
readdir()
call with{recursive: true}
will enter an endless loop.Even without a cycle, mount-graphs have the potential to become so large that recursion is not feasible. (E.g. Beaker's use of mounts for the social graph could cause a recursive readdir to iterate the "strong set.")
Ways we can solve this:
depth
parameter to limit the number of recursions into subfoldersmountDepth
parameter to limit the number of recursions into mountsmountDepth
is always0
)Ways we can't solve this:
I personally prefer either the
mountDepth
option or not recursing into mounts.