Closed voltrevo closed 9 years ago
Issue that introduced the iterative solution: https://github.com/raszi/node-tmp/issues/17
@voltrevo Nice find! The other day i was also stumbling across the line where it added the dir and the file to the stack, not realizing that the dir should be pushed once only for the remainder of subdirectories, yet it had a certain smell to it :grin:. And yes, I am the culprit who devised this bugger.
@silkentrance Cheers man. Just saw this now and had a look at the existing tests to see how it would fit in. I don't have time to add it now but hopefully I can write something up later today (I'm in Australia/UTC+10).
Also made a PR here
Sorry for the duplicate PR, I just need this can be fixed.
If you like, I can write a test for this, need a couple of days.
Fixed with #63
The iterative solution to
_rmdirRecursiveSync
introduced a bug:You can see this happen with the following structure:
To see this happen with minimal effort, I placed
_rmdirRecursiveSync
in a standalone script:Which for me (OSX Yosemite, node 0.12.2) results in this error:
This can be avoided with a check that makes sure that the directory is re-added only once. Here is an equivalent script:
I don't really understand how the original recursive solution was blowing the stack. Shouldn't the recursion have only been as deep as the directory structure? To blow the stack you'd need a crazy deep directory structure and that's probably the real issue.
In any case, I'll submit a PR to make this iterative fix.