Don't compare stat.dev when streaming zip entries#285
Merged
Conversation
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, packaging could fail with "Cannot read file ... due to: file changed between metadata collection and stream open" even when the file had not changed. The streaming zip writer collects each file's metadata with a path-based
fs.stat()and then re-checks it against a handle-basedfileHandle.stat()immediately before streaming the entry, and on Windows these two stat sources report a different device id (dev) for the very same unchanged file because libuv's path fast-path does not read the volume serial number while the handle path does. The safety check interpreted that mismatch as a changed file and aborted the whole package.This drops
devfrom the comparison, because it is unreliable across the two stat methods and contributes nothing useful here, while keeping the inode, size and modification-time checks that actually detect a file changing underneath us. Both stats are now collected with thebigintoption so that the inode and modification time are compared as exact integers rather than a precision-losing Number and a floating-point millisecond value. The same code path is used for layer packaging, so that is covered as well.Resolves #280.