If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce
Bug Summary:
Assuming file watchers have failed/closed, the fallback logic CppProperties.checkCompileCommands can fail to detect changes in a compile_commands.json from a different configuration index (even when later switching to that configuration index)
Steps to reproduce:
Assume the following c_cpp_properties.json (only relevant parts shown)
Assume file watchers failed/closed on any of the example reasons:
We can force the file watchers to be closed by reproducing the steps described in #12946.
fs.watch loses track of the file on Linux if file is deleted/doesn't exist. (on Linux, fs.watch tracks by inode)
Failed to create a file watcher by crossing the inotify limit on Linux.
Update compile_commands_2.json (by touching or actually compiling some CMake project)
Assuming file watchers are closed/failed, no event is triggered on this change.
checkCompileCommands() only checks the file used by the current configuration, no event is triggered on this change.
Update compile_commands_1.json
Now, compile_commands_1.json is newer than compile_commands_2.json.
CppProperties.compileCommandsFileWatcherFallbackTime is assigned compile_commands_1.json's timestamp.
Switch to compdb2
File watchers are re-created, but no event is triggered as compile_commands_2.json has changed before re-initializing the file watchers.
CppProperties.compileCommandsFileWatcherFallbackTime is a newer timestamp than compile_commands_2.json's timestamp, so checkCompileCommands() does not trigger an event.
Environment
Bug Summary and Steps to Reproduce
Bug Summary: Assuming file watchers have failed/closed, the fallback logic
CppProperties.checkCompileCommands
can fail to detect changes in acompile_commands.json
from a different configuration index (even when later switching to that configuration index)Steps to reproduce: Assume the following
c_cpp_properties.json
(only relevant parts shown)compdb1
fs.watch
loses track of the file onLinux
if file is deleted/doesn't exist. (onLinux
,fs.watch
tracks byinode
)inotify
limit onLinux
.compile_commands_2.json
(bytouch
ing or actually compiling someCMake
project)checkCompileCommands()
only checks the file used by the current configuration, no event is triggered on this change.compile_commands_1.json
compile_commands_1.json
is newer thancompile_commands_2.json
.CppProperties.compileCommandsFileWatcherFallbackTime
is assignedcompile_commands_1.json
's timestamp.compdb2
compile_commands_2.json
has changed before re-initializing the file watchers.CppProperties.compileCommandsFileWatcherFallbackTime
is a newer timestamp thancompile_commands_2.json
's timestamp, socheckCompileCommands()
does not trigger an event.Configuration and Logs
Other Extensions
No response
Additional context
No response