Skip to content
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

fs.utimes Infinity support is misdocumented or regressed #15453

Closed
chris-morgan opened this issue Sep 18, 2017 · 1 comment
Closed

fs.utimes Infinity support is misdocumented or regressed #15453

chris-morgan opened this issue Sep 18, 2017 · 1 comment
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system.

Comments

@chris-morgan
Copy link

  • Version: 8.5.0
  • Platform: Windows
  • Subsystem: fs

Potentially related to #14017.

Take this code:

fs.utimes(path, Infinity, 0)

(I needed to set the mtime to some point in the past for make’s sake so it wouldn’t consider a broken file to be up to date and would try again. Not sure quite why I wrote Infinity for the atime rather than Date.now() / 1000, though I believe they were equivalent.)

The fs.utimes documentation is inconsistent on how infinities should be handled:

In its history, it says that in v4.1.0, “Numeric strings, NaN and Infinity are now allowed time specifiers.” There is no note saying that NaN and Infinity are no longer permitted from such-and-such a version, yet the function documentation says “If the value is NaN, Infinity or -Infinity, an Error will be thrown.”

Either the history should be updated to indicate when infinties became illegal again, or this is a regression.

This worked on some Node 4 version, but it’s not working on 8.5.0 (I just upgraded).

@cjihrig
Copy link
Contributor

cjihrig commented Sep 18, 2017

The note in the documentation was added in eed87b1. Would you care to send a documentation PR to update the utimes changelog?

@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. doc Issues and PRs related to the documentations. labels Sep 18, 2017
lpinca added a commit to lpinca/node that referenced this issue Sep 29, 2017
Specify that `NaN`, `Infinity`, and `-Infinity` are no longer valid
values for the `atime` and `mtime` arguments.

Fixes: nodejs#15453
MylesBorins pushed a commit that referenced this issue Oct 3, 2017
Specify that `NaN`, `Infinity`, and `-Infinity` are no longer valid
values for the `atime` and `mtime` arguments.

PR-URL: #15680
Fixes: #15453
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this issue Oct 3, 2017
Specify that `NaN`, `Infinity`, and `-Infinity` are no longer valid
values for the `atime` and `mtime` arguments.

PR-URL: #15680
Fixes: #15453
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
addaleax pushed a commit to addaleax/ayo that referenced this issue Oct 4, 2017
Specify that `NaN`, `Infinity`, and `-Infinity` are no longer valid
values for the `atime` and `mtime` arguments.

PR-URL: nodejs/node#15680
Fixes: nodejs/node#15453
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this issue Oct 11, 2017
Specify that `NaN`, `Infinity`, and `-Infinity` are no longer valid
values for the `atime` and `mtime` arguments.

PR-URL: #15680
Fixes: #15453
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants