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

mtimeMs comparison is broken in node v14.17.0 #83

Closed
gavinaiken opened this issue Jun 9, 2021 · 4 comments
Closed

mtimeMs comparison is broken in node v14.17.0 #83

gavinaiken opened this issue Jun 9, 2021 · 4 comments

Comments

@gavinaiken
Copy link
Contributor

gavinaiken commented Jun 9, 2021

In node v14.17.0 on Mac OSX Catalina I am seeing an issue where gulp-changed always detects the source file as changed because the target is getting an mtimeMs slightly behind that of the source file when gulp creates it. This problem did not exist in v14.16.1.

The comparison happens here: https://github.com/sindresorhus/gulp-changed/blob/main/index.js#L28 and I am seeing mtimes for example like this:

sourceFile.stat.mtimeMs: 1621590505837.191
targetStat.mtimeMs:  1621590505836.999

Previously the target mtime would be eg 1621590505837 so the two floor comparisons would work fine.

A simple work-around for this is to use floor for the source and ceil for the target, which resolves the issue for me. I will provide a PR with this change.

@sindresorhus
Copy link
Owner

Thanks for reporting. Please open an issue on the Node.js issue tracker.

@gavinaiken
Copy link
Contributor Author

OK, will do. Have provided a very simple PR for consideration here too.

@gavinaiken
Copy link
Contributor Author

It's looking like this problem is due to a change in libuv, based on the discussion in the issue I opened on node. I think this is likely to be much easier to fix here (with the PR I have already put up) than it is going to be over in node / libuv. Thoughts?

@sindresorhus
Copy link
Owner

I'm happy to add a workaround here in the meantime, but it's always best to try to also fix it at the source.

sindresorhus added a commit that referenced this issue Jun 15, 2021
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
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

No branches or pull requests

2 participants