Project
vgrep
Description
The process_files() function in src/watcher.rs lines 301-313 has a time-of-check to time-of-use (TOCTOU) race condition. A file could be deleted between the path.exists() check and the subsequent read_to_string() call, causing silent failures where deleted files remain in the index.
Error Message
No error message - silent failure to remove deleted files from index.
Debug Logs
System Information
- Bounty Version: 0.1.0
- OS: Ubuntu 24.04 LTS
- Rust: 1.75+
Screenshots
No response
Steps to Reproduce
- Start file watcher:
vgrep watch
- Create a script that rapidly creates and deletes files:
while true; do
echo "test" > /tmp/project/temp_file.rs
rm /tmp/project/temp_file.rs
done
- Run the script while watcher is active
- Observe that some deleted files may remain in the index
Expected Behavior
When a file read fails due to deletion:
- Check if the file was deleted
- If deleted, remove from index
- Log the race condition for debugging
Actual Behavior
- File deletion between check and read is silently ignored
- Deleted file remains indexed
- Searches may return results pointing to non-existent files
Additional Context
No response
Project
vgrep
Description
The
process_files()function insrc/watcher.rslines 301-313 has a time-of-check to time-of-use (TOCTOU) race condition. A file could be deleted between thepath.exists()check and the subsequentread_to_string()call, causing silent failures where deleted files remain in the index.Error Message
Debug Logs
System Information
Screenshots
No response
Steps to Reproduce
vgrep watchExpected Behavior
When a file read fails due to deletion:
Actual Behavior
Additional Context
No response