Uh oh!
There was an error while loading. Please reload this page.
fs: consider NaN/Infinity in toUnixTimestamp - #2387
Conversation
mscdex
commented
Aug 15, 2015
Why not replace both checks with |
yorkie
commented
Aug 15, 2015
Oh, I absolutely this function, let me use and test it, thanks for the tip |
yorkie
commented
Aug 15, 2015
Fixed, thank you Brian |
mscdex
commented
Aug 15, 2015
I meant replace both conditions, like simply: if(!isFinite(time)){since |
yorkie
commented
Aug 15, 2015
Fixed, thank you |
There was a problem hiding this comment.
Sorry, it should be "done"
yorkie
commented
Aug 16, 2015
Corrected, thanks @thefourtheye |
There was a problem hiding this comment.
Should use Number.isFinite() instead of isFinite():
In comparison to the global isFinite() function, this method doesn't forcibly convert the parameter to a number. This means only values of the type number, that are also finite, return true.
Doesn't matter here, but good for consistency.
yorkie
commented
Aug 16, 2015
After reading some docs about the difference at MDN and ECMA spec, I changed it to use the |
yorkie
commented
Aug 19, 2015
Any feedback from core team? |
trevnorris
commented
Aug 21, 2015
LGTM |
thefourtheye
commented
Aug 22, 2015
Hmmm.
|
yorkie
commented
Aug 22, 2015
I have no idea about the negative, because the linux manual didn't mention this, so I have the following proposals:
I will document this either after getting the answer of the above from @thefourtheye or other Node.js team member. Thank you :) |
yorkie
commented
Aug 26, 2015
any words? @thefourtheye |
yorkie
commented
Aug 26, 2015
How is this pr going? @thefourtheye did ignore my questions and proposals again, I don't know what happened :( |
trevnorris
commented
Aug 26, 2015
@yorkie Might be outside the scope of this PR, but is there utility in accepting strings? The check would basically be: if(typeoftime==='string'&&+time==time){return+time;}I'm cool w/ the change if CI is happy. |
yorkie
commented
Aug 27, 2015
Hey @trevnorris I Added your suggestion at this PR, but I still care about strict mode and source code confusion in using the operator Mainly, the unit test is pass on my side :) |
yorkie
commented
Aug 27, 2015
Added few document as well, but I have not yet got any response about minus value, so I will just keep the current logic. |
thefourtheye
commented
Aug 27, 2015
@yorkie I am really sorry about the delay. I finally got some time to test this. The value of |
yorkie
commented
Aug 27, 2015
It's fine @thefourtheye
Do you have some document about this or someone from nodejs team tell me what should I do, or I think set to Unix Epoch is not still the best solution. |
trevnorris
commented
Aug 27, 2015
@yorkie Thanks. Only reason I suggest using |
thefourtheye
commented
Aug 27, 2015
@yorkie I searched for documentations but I couldn't find any. I found that by running constfs=require('fs');console.error(fs.statSync('Test.py'));fs.utimesSync('Test.py',-1,-1);console.error(fs.statSync('Test.py')); |
yorkie
commented
Aug 27, 2015
Thanks for your work @thefourtheye, I will follow your running result at first :) |
yorkie
commented
Aug 27, 2015
Updated, now the minus number and other |
thefourtheye
commented
Aug 27, 2015
@yorkie Ah, lets get some confirmation about the negative values. @bnoordhuis any idea? |
yorkie
commented
Aug 27, 2015
Of course, and I will document something after that :) |
yorkie
commented
Aug 28, 2015
Ping @bnoordhuis |
yorkie
commented
Sep 14, 2015
@orangemocha so the thing that I should or can do is reword the title and push again? |
There was a problem hiding this comment.
Linter would break at this line? @Fishrock123
orangemocha
commented
Sep 14, 2015
@yorke : yes! |
yorkie
commented
Sep 14, 2015
Yes, sir. I will fix the line 131 as well :) |
orangemocha
commented
Sep 14, 2015
@yorkie : or, if you added those tests in the first place, you could also do an interactive rebase and change your commits to simply not add them. |
yorkie
commented
Sep 14, 2015
Ok, I did squash all commits then could someone run the CI again, thanks for your helps :) |
orangemocha
commented
Sep 14, 2015
yorkie
commented
Sep 14, 2015
The test seems to be suspended by ARM at https://ci.nodejs.org/job/node-test-commit-arm/634/console, anything that I can help to fix? |
trevnorris
commented
Sep 14, 2015
@yorkie Just took a really long time to finish. Everything looks green now. |
PR-URL: #2387 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
trevnorris
commented
Sep 14, 2015
Landed on 1f842c2 with column change in doc. |
Fishrock123
commented
Sep 15, 2015
To clarify, this is indeed a breaking change? |
yorkie
commented
Sep 15, 2015
Thanks @trevnorris
Shouldn't, I guess few modules use |
trevnorris
commented
Sep 15, 2015
@Fishrock123 I'd say this is a bug-fix. This simply makes previously undefined behavior defined. |
PR-URL: #2387 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Notable changes: * buffer: - Buffers are now created in JavaScript, rather than C++. This increases the speed of buffer creation (Trevor Norris) nodejs#2866. - `Buffer#slice()` now uses `Uint8Array#subarray()` internally, increasing `slice()` performance (Karl Skomski) nodejs#2777. * fs: - `fs.utimes()` now properly converts numeric strings, `NaN`, and `Infinity` (Yazhong Liu) nodejs#2387. - `fs.WriteStream` now implements `_writev`, allowing for super-fast bulk writes (Ron Korving) nodejs#2167. * http: Fixed an issue with certain `write()` sizes causing errors when using `http.request()` (Fedor Indutny) nodejs#2824. * npm: Upgrade to version 2.14.3, see https://github.com/npm/npm/releases/tag/v2.14.3 for more details (Kat Marchán) nodejs#2822. * src: V8 cpu profiling no longer erroneously shows idle time (Oleksandr Chekhovskyi) nodejs#2324. * v8: Lateral upgrade to 4.5.103.33 from 4.5.103.30, contains minor fixes (Ali Ijaz Sheikh) nodejs#2870. - This fixes a previously known bug where some computed object shorthand properties did not work correctly (nodejs#2507). Refs: nodejs#2844 PR-URL: nodejs#2889
Notable changes: * buffer: - Buffers are now created in JavaScript, rather than C++. This increases the speed of buffer creation (Trevor Norris) #2866. - `Buffer#slice()` now uses `Uint8Array#subarray()` internally, increasing `slice()` performance (Karl Skomski) #2777. * fs: - `fs.utimes()` now properly converts numeric strings, `NaN`, and `Infinity` (Yazhong Liu) #2387. - `fs.WriteStream` now implements `_writev`, allowing for super-fast bulk writes (Ron Korving) #2167. * http: Fixed an issue with certain `write()` sizes causing errors when using `http.request()` (Fedor Indutny) #2824. * npm: Upgrade to version 2.14.3, see https://github.com/npm/npm/releases/tag/v2.14.3 for more details (Kat Marchán) #2822. * src: V8 cpu profiling no longer erroneously shows idle time (Oleksandr Chekhovskyi) #2324. * v8: Lateral upgrade to 4.5.103.33 from 4.5.103.30, contains minor fixes (Ali Ijaz Sheikh) #2870. - This fixes a previously known bug where some computed object shorthand properties did not work correctly (#2507). Refs: #2844 PR-URL: #2889
We might should follow the rule of linux:
ref: http://linux.die.net/man/2/utime