FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: improve fs.utimes by refack · Pull Request #14154 · nodejs/node · GitHub

/ node Public

doc: improve fs.utimes - #14154

Closed
refack wants to merge 1 commit into
nodejs:masterfrom
refack:doc-improve-fs-utimes
Closed

doc: improve fs.utimes#14154
refack wants to merge 1 commit into
nodejs:masterfrom
refack:doc-improve-fs-utimes

Conversation

refack commented Jul 10, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

AFAICT the internal conversion helper toUnixTimestamp has always been able to convert Dates - https://github.com/nodejs/node/commit/1d5ff15
Currently precision is platform dependant, but that could be fixed.

@nodejs/platform-aix - Should the AIX >= 7.1 note be added to utimes as well? #14154 (comment)

/cc @bnoordhuis @nodejs/fs

Checklist
  • mdlint passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc,fs

refack added aix Issues and PRs related to the AIX platform. doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Jul 10, 2017
refack requested a review from bnoordhuis July 10, 2017 15:05
nodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Jul 10, 2017

refack commented Jul 10, 2017

Copy link
Copy Markdown
Contributor Author

/cc @nodejs/documentation

refack force-pushed the doc-improve-fs-utimes branch from 9fdfe32 to 555d21b Compare July 10, 2017 15:08
refack mentioned this pull request Jul 10, 2017
Comment thread doc/api/fs.md
- Values can be either numbers representing Unix epoch time, `Date`s, or a
numeric string like `'123456789.0'`.
- If the value can not be converted to a number, or is `NaN`, `Infinity` or
`-Infinity`, a `Error` will be thrown.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Still "an Error"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What happens if Invalid Date is passed?

Also, if we can pass a string that gets coerced to numbers, then I'm not sure we should put string in the docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
  1. Still an Error in master - https://github.com/nodejs/node/blob/master/lib/fs.js#L1196
  2. Even a Date is converted (or coerced) to number so the sentence still stands true (Number(new Date("foo")) === NaN), just missing an explicit mention.

vsemozhetbyt Jul 10, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@refack Sorry, I meant a nit, still "an", not "a")

refack Jul 10, 2017
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@benjamingr the string note was alway there. As for the arg type I think it's better to explicitly state string but this is JS1.0 semantics so we need to ask ourselves WWDCD?
What Would Douglas Crockford Do

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@refack Sorry, I meant a nit, still "an", not "a")

Ack. But I'm not pushing a fix yet, so the string conversation will stay open.

Copy link
Copy Markdown
Member

Should the AIX >= 7.1 note be added to utimes as well?

No:

bash-4.3$ uname -a
AIX 1 6 00F460A94C00
bash-4.3$ touch g.txt
bash-4.3$ cat utimes.js 
var fs = require('fs')
fs.utimes(process.argv[2], 1, 2, () => {
  const stat = fs.statSync(process.argv[2])
  console.log(`file modified at ${stat.mtime} and accessed at ${stat.atime}`)
})
bash-4.3$ ./node utimes.js g.txt
file modified at Thu Jan 01 1970 00:00:02 GMT+0000 (EST) and accessed at Thu Jan 01 1970 00:00:01 GMT+0000 (EST)

refack commented Jul 10, 2017

Copy link
Copy Markdown
Contributor Author

Should the AIX >= 7.1 note be added to utimes as well?

No:

That's surprising since intuitively I'd assume utimes(path) := futimes(open(path)), but if no one complains 🤷‍♂️

Copy link
Copy Markdown
Member

basically fs.utimes is implemented by uv__fs_utimes and fs.futimes by uv__fs_futime and underneath mapping to system calls of the same name in most of the unixens, but platform specificity applies. AIX cases are here and here.

Copy link
Copy Markdown
Member

Where do we stand here?

Copy link
Copy Markdown
Member

@refack as far as I see it there is little to do to get this ready to land, right?

I would otherwise close the PR sometime soon.

refack self-assigned this Sep 23, 2017

Copy link
Copy Markdown
Member

Landed in 64e97b2

BridgeAR closed this Sep 28, 2017
BridgeAR pushed a commit that referenced this pull request Sep 28, 2017
PR-URL: #14154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Sep 28, 2017
PR-URL: nodejs#14154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Sep 29, 2017
PR-URL: #14154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack deleted the doc-improve-fs-utimes branch September 29, 2017 22:13
addaleax pushed a commit to addaleax/ayo that referenced this pull request Sep 30, 2017
PR-URL: nodejs/node#14154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Oct 3, 2017
PR-URL: #14154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins mentioned this pull request Oct 3, 2017
MylesBorins pushed a commit that referenced this pull request Oct 3, 2017
PR-URL: #14154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack removed their assignment Oct 12, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aix Issues and PRs related to the AIX platform. 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 this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL