You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A bit of background: I recently developed https://github.com/gobblejs/gobble-hardlink , a plugin for the GobbleJS build tool. Hardlinking stuff in my workflow works fine in individual runs, but turns into an infinite loop when running the build tool in watch mode (see also gobblejs/gobble#129 ).
I managed to track down the cause to chokidar's behaviour when hardlinking a file: it is reported as a change in the file.
So if cp src dest doesn't change the file, and neither does ln -s src dest, then why ln src dest is reported as a change? My educated guess is that the hardlink count is increased in the filesystem, and this is reported as a change in the file entry, even though the file contents, the inodes, and the modification time of the file did not change.
I would very much like to tell apart changes to a file from hardlink creations. I don't know if chokidar caches the results from fs.stats - if it does, it would be possible to use mtime and/or nlink to tell apart hardlinkings. API-wise I'd love to have a new 'hardlink' event.
The text was updated successfully, but these errors were encountered:
Chokidar relies on other subsystems to report changes, and they may differ in behavior for your use case. You could try usePolling: true to use fs.watchFile under the hood and see if that impacts the behavior relating to hardlinks.
Regardless, it's out of scope for chokidar to try to characterize the nature of the reported change event in the way you're asking. It's something you're going to have to figure out how to cope with upstream. You can use the alwaysStat: true option if it helps.
A bit of background: I recently developed https://github.com/gobblejs/gobble-hardlink , a plugin for the GobbleJS build tool. Hardlinking stuff in my workflow works fine in individual runs, but turns into an infinite loop when running the build tool in watch mode (see also gobblejs/gobble#129 ).
I managed to track down the cause to chokidar's behaviour when hardlinking a file: it is reported as a change in the file.
So if
cp src dest
doesn't change the file, and neither doesln -s src dest
, then whyln src dest
is reported as a change? My educated guess is that the hardlink count is increased in the filesystem, and this is reported as a change in the file entry, even though the file contents, the inodes, and the modification time of the file did not change.I would very much like to tell apart changes to a file from hardlink creations. I don't know if chokidar caches the results from
fs.stats
- if it does, it would be possible to usemtime
and/ornlink
to tell apart hardlinkings. API-wise I'd love to have a new'hardlink'
event.The text was updated successfully, but these errors were encountered: