-
Notifications
You must be signed in to change notification settings - Fork 30.5k
[node] mkdir with recursive: true can have undefined result #50721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[node] mkdir with recursive: true can have undefined result #50721
Conversation
|
@xandris Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through. This is a live comment which I will keep updated. 1 package in this PRCode ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 50721,
"author": "xandris",
"headCommitOid": "71fee5b780d9749d62252e60408f439f7bcef3af",
"lastPushDate": "2021-02-03T05:52:14.000Z",
"lastActivityDate": "2021-02-03T22:38:15.000Z",
"maintainerBlessed": false,
"mergeOfferDate": "2021-02-03T22:27:31.000Z",
"mergeRequestDate": "2021-02-03T22:38:15.000Z",
"mergeRequestUser": "xandris",
"hasMergeConflict": false,
"isFirstContribution": true,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "node",
"kind": "edit",
"files": [
{
"path": "types/node/fs.d.ts",
"kind": "definition"
},
{
"path": "types/node/fs/promises.d.ts",
"kind": "definition"
},
{
"path": "types/node/test/fs.ts",
"kind": "test"
},
{
"path": "types/node/v13/fs.d.ts",
"kind": "definition"
},
{
"path": "types/node/v13/test/fs.ts",
"kind": "test"
}
],
"owners": [
"Microsoft",
"DefinitelyTyped",
"jkomyno",
"a-tarasyuk",
"alvis",
"r3nya",
"btoueg",
"brunoscheufler",
"smac89",
"touffy",
"DeividasBakanas",
"eyqs",
"Flarna",
"Hannes-Magnusson-CK",
"KSXGitHub",
"hoo29",
"kjin",
"ajafff",
"islishude",
"mwiktorczyk",
"mohsen1",
"n-e",
"galkin",
"parambirs",
"eps1lon",
"SimonSchick",
"ThomasdenH",
"WilcoBakker",
"wwwy3y3",
"samuela",
"kuehlein",
"j-oliveras",
"bhongy",
"chyzwar",
"trivikr",
"nguymin4",
"yoursunny",
"qwelias",
"ExE-Boss",
"Ryan-Willpower",
"peterblazejewicz",
"addaleax",
"JasonHK",
"victorperin",
"ZYSzys"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "amcasey",
"date": "2021-02-03T22:26:27.000Z",
"isMaintainer": true
},
{
"type": "approved",
"reviewer": "eps1lon",
"date": "2021-02-03T08:38:46.000Z",
"isMaintainer": false
},
{
"type": "approved",
"reviewer": "Flarna",
"date": "2021-02-03T07:46:59.000Z",
"isMaintainer": false
},
{
"type": "stale",
"reviewer": "a-tarasyuk",
"date": "2021-01-20T18:13:21.000Z",
"abbrOid": "62ba73d"
}
],
"ciResult": "pass"
} |
|
🔔 @microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @BrunoScheufler @smac89 @Touffy @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @mohsen1 @n-e @galkin @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @samuela @kuehlein @j-oliveras @bhongy @chyzwar @trivikr @nguymin4 @yoursunny @qwelias @ExE-Boss @Ryan-Willpower @peterblazejewicz @addaleax @JasonHK @victorperin @ZYSzys — please review this PR in the next few days. Be sure to explicitly select |
|
@xandris The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
|
👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings. Let’s review the numbers, shall we? node/v14.14Comparison details for node/14.14 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. node/v14.14Comparison details for node/14.14 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
|
Is this the same as #50121? |
Yes but that one got closed for inactivity before it got merged. I think it didn't get merged because there were unrelated CI failures. It looks like the latest 4.2 is causing problems on a few packages. I'll take a look at CI failures again and try to itemize their causes |
I think it's somewhat implied by
-- https://nodejs.org/api/fs.html#fs_fs_mkdir_path_options_callback If no directory is created then no path can be given. Though ideally, API documentation is as explicit as possible so I opened nodejs/node#37010. |
|
Once microsoft/TypeScript#42447 gets merged, I think the CI error will finally go away. |
|
@xandris The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
If all subpaths of the given path already exist, the result is not EEXIST like the non-recursive case, but undefined. The callback receives only one argument (the Error, null).
|
@a-tarasyuk, @Flarna Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
@a-tarasyuk Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
@xandris Thanks for the thoughtful explanation! Sorry it didn't go through the first time. |
|
Ready to merge |
|
It has been a journey! |
|
I just published |
|
I just published |
…n have undefined result by @xandris If all subpaths of the given path already exist, the result is not EEXIST like the non-recursive case, but undefined. The callback receives only one argument (the Error, null).
…n have undefined result by @xandris If all subpaths of the given path already exist, the result is not EEXIST like the non-recursive case, but undefined. The callback receives only one argument (the Error, null).
The CI is blocked by microsoft/TypeScript#42337
If all subpaths of the given path already exist, the result is not EEXIST like the non-recursive case, but undefined. The callback is called like
cb(null), notcb(null, undefined).I'm a little concerned this is undefined behavior because the API documentation doesn't say what's supposed to happen if all path components already exist, other than that it isn't considered an error like the non-recursive case. But it would stand to reason that if it's not an error, and no directory was created, then the "first directory created" is literally undefined.
But even though the official API docs don't mention it, you can't in practice rely on the return value to be defined. I believe type definitions shouldn't incorporate implementation bugs, but I also don't believe this is an implementation bug, just a documentation oversight.
This seems like the only reasonable definition given the circumstances; that is, if the Node developers eventually address this edge case, I struggle to see what the alternative would be.
Please fill in this template.
npm test <package to test>.Select one of these and delete the others:
If changing an existing definition: