Added recurs. mkdir dirname() failure check.#468
Added recurs. mkdir dirname() failure check.#468dsoprea wants to merge 2 commits intoshelljs:masterfrom dsoprea:master
Conversation
Prevents an infinite loop with malformed UNCs and/or permission problems.
|
@dsoprea Thanks for the PR! Could you add a new unit test where ShellJS currently would fail? Also, what is the behavior of unix |
|
It's a difficult case to test for, for the following reasons:
|
|
@dsoprea Just tried this out, and I agree it's kind of a weird scenario. Thanks for pointing me to
|
|
A UNC has the format: "<hostname>". That's what I was referring to by "host" and "share". I'm a Unix guy, too.. I had to be reminded as well. The minimal path passed into an mkdir() call will be at least three parts: "\hostname\sharename\directory_that_does_not_exist". I can't explain why the issue occurs inconsistently. We're just using WINS resolution (not DNS) and I can't recall whether it was a bad hostname or incorrect credentials. It also occurred in an environment that I have limited access to. I suspect that "\good_hostname\bad_sharename\folder1\folder2" would do it (either with bad_sharename being bad or incorrectly permissioned). I think the logic is simple, succinct, and intuitive, but, as this results from a cascade-effect that only occurs when an elaborate set of conditions are met (one of which might always require a costly time delay), we're not going to be able to effectively add a test-case for this. If you want to merge it, I'm sure we'll save someone some time. If not, then let's close it and move on. |
|
In most of ShellJS, we don't signal errors with exceptions but by using |
|
Done. |
|
LGTM |
|
Closing this in favor of #477, which includes stylistic fixes. |
Prevents an infinite loop with malformed UNCs and/or permission problems.
See nodejs/node#7461 for the context in which I needed this fix. Let me know your thoughts. I thought it might be better to install this at a lower level the Node.js community thought it'd be disruptive.
Thanks.