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

accept 1ms difference in filedates as equal on windows #3235

Merged
merged 1 commit into from
Apr 24, 2017

Conversation

sciolist
Copy link
Contributor

There's an issue in node (nodejs/node#12607) with submillisecond truncation of file mtimes on Windows, which makes yarns fileDatesEqual test fail on any file that's affected by the bug. This causes many identical files to appear changed causing unneeded re-copying on every yarn command.

You can run this to reproduce the issue:

var fs = require('fs');
var targetMTime = new Date('2017-04-08T17:59:38.008Z');

fs.writeFileSync("./file1", "");
fs.utimesSync("./file1", targetMTime, targetMTime);

var actualMTime = fs.statSync("./file1").mtime;

console.log(actualMTime); // 2017-04-08T17:59:38.007Z
console.log(actualMTime.getTime() === targetMTime.getTime()); // false

In my test projects this issue affects in the area of 10% of files, so in a project with 50000 files in node_modules you get roughly 5000 extra file copies per yarn command.

a nodejs issue causes certain dates to be off by 1ms after calling utimes

See: nodejs/node#12607
@Daniel15
Copy link
Member

Seems reasonable. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants