Skip to content

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