Repository navigation
Conversation
Since #5107, the files selected by -r are checked when compress, decompress, test and list open them, but only on POSIX: Windows stat_t carries no file identity, so the Windows expansion recorded none. On Windows, the identity is the volume serial number and file index, as already compared by UTIL_isSameFileWin32(). - the Windows expansion reads it for each selected file, by opening it for attributes only; - FIO_openSrcFile() reads it from the handle of the opened file, and compares it with the recorded one, with UTIL_isSameOpenedFileIdentity(). UTIL_isSameFileWin32() now uses the same helpers.
This branch has not been deployed
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.
Follow-up to #5107, as suggested in its review.
Problem
Since #5107, the files selected by
-rare checked when compression, decompression, test and list open them: a file replaced since the expansion is refused (changed while opening -- ignored).This only works on POSIX: Windows
stat_tcarries no file identity, so the Windows expansion records none, and nothing is checked.Fix
On Windows, a file's identity is its volume serial number and file index, as already compared by
UTIL_isSameFileWin32().FIO_openSrcFile()reads it from the handle of the opened file, and compares it with the recorded one, through the newUTIL_isSameOpenedFileIdentity(). On POSIX, this is the existingfstat()check.UTIL_isSameFileWin32()now uses the same helpers.Out of scope, for a later PR: on Windows, the
stat()/fopen()check ofFIO_openSrcFile()and the--rmcheck ofFIO_removeFile()still compare a path with itself, and so always pass.Test
-Werroron Linux (gcc) and withx86_64-w64-mingw32-gcc; C90 syntax check ofutil.candfileio.cwith both.*-parent-race.shtests, which check that replaced inputs are refused.playTests.shruns several-rcases (with--rm,-d,--output-dir-flat), so CI checks that unchanged files are still accepted. The race itself is not tested on Windows: the race tests use anLD_PRELOADinterposer, Linux only.