Repository navigation
Conversation
--ignore-missing dropped every file whose open failed, not only the ones that were absent, so a file that exists but cannot be read was skipped without a word and the run exited 0. Classify the error in get_file_to_check: only NotFound stays on the missing path, anything else is printed, counted through failed_open and returned as CantOpenFile. Drop the matching !ignore_missing guard on the final failed_open_file check, which ignored missing files never reach.
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.
Closes #15767
md5sum -c --ignore-missingskipped a listed file that exists but cannot be opened, printed nothing about it, and exited 0. Only genuinely absent files should be ignored.The error arm of
get_file_to_checkturned everyFile::openfailure intoLineCheckError::FileNotFoundwithout looking at the error kind, soEACCESorENOTDIRwas treated likeENOENTand dropped by--ignore-missing. It now matches onerr.kind():NotFoundkeeps the old path, anything else is printed, counted throughfailed_open()and returned asCantOpenFile. That variant already existed and was already counted intofailed_open_file.process_checksum_filealso skipped the finalfailed_open_filecheck whenever--ignore-missingwas set. Ignored missing files never reach that counter, so the guard only exempted files that really could not be read, and I dropped it.Reproduced on macOS with a readable file and a mode-000 file, both listed in
CHECKSUMS:and after the change:
A file that is really missing is still ignored and still exits 0.
The code is shared, so
cksum,b2sumand thesha*sumtools are covered too. I addedtest_check_ignore_missing_unopenable_filenext totest_check_failed_to_readintests/by-util/test_cksum.rs; it uses anENOTDIRpath rather than mode 000 so that it also holds when the tests run as root, and the branch taken is the same either way. It fails on main, printing onlyf: OK.cargo fmt --checkandclippy -D warningsare clean. I have only tested this on macOS.