You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks. I actually received "?" from watchman for a vim swap file (not a "whiteout"). I'm not sure why the file isn't reported as a regular file, maybe it's some other bug.
Ok! "?" is really the "I have no idea what type this is" symbol that is used for the "impossible" case in that code (we'll fix up the docs to reflect that).
You can expect to see that when exists == false because there is no current information about the file type when it doesn't exist.
Maybe in this case watchman should not report anything at all about "file1"? As far as the app is concerned, "file1" never existed, and it never received a "create" event for it, so why should it receive a "delete" event? I can't imagine a scenario where an app would have anything useful to do with this information.
watchman doesn't deliver delete events because that is not a guaranteed concept; the OS may not deliver a change event for a variety of OS dependent reasons and those events are highly prone to TOCTOU in any case.
Instead of change events, Watchman delivers state updates based on the observed state in a given clock tick.
It is reporting that file1 matches your query criteria for things that changed since an earlier clock value, and that its current state at that time is that it doesn't exist.
Activity
genevievehelsel commentedon Feb 16, 2021
Thanks for pointing this out! I've just added documentation for this case, it should be pushed soon :)
add documentation for "?" file types
bitc commentedon Feb 17, 2021
Thanks. I actually received "?" from watchman for a vim swap file (not a "whiteout"). I'm not sure why the file isn't reported as a regular file, maybe it's some other bug.
wez commentedon Feb 17, 2021
Could you share the output from
stat /path/to/that/fileso that we can see exactly what its st_mode bits look like?bitc commentedon Feb 17, 2021
I think I figured out the bug. vim creates a file and then immediately renames it. watchman seems to have trouble with this.
I tried to reproduce with a shell script (
touch file1; mv file1 file2), but I think it is too slow (watchman correctly reports the operations)But this C script is able to cause watchman to fail:
rename_test.c
If I tell watchman to "subscribe" on the target directory, and then run
rename_testinside it, I get this subscription event:[ { "name": "file2", "exists": true, "type": "f", "size": 0 }, { "name": "file1", "exists": false, "type": "?", "size": 0 } ]This is on Linux 4.15.0
wez commentedon Feb 17, 2021
Ok!
"?"is really the "I have no idea what type this is" symbol that is used for the "impossible" case in that code (we'll fix up the docs to reflect that).You can expect to see that when
exists == falsebecause there is no current information about the file type when it doesn't exist.bitc commentedon Feb 17, 2021
Maybe in this case watchman should not report anything at all about "file1"? As far as the app is concerned, "file1" never existed, and it never received a "create" event for it, so why should it receive a "delete" event? I can't imagine a scenario where an app would have anything useful to do with this information.
wez commentedon Feb 17, 2021
watchman doesn't deliver delete events because that is not a guaranteed concept; the OS may not deliver a change event for a variety of OS dependent reasons and those events are highly prone to TOCTOU in any case.
Instead of change events, Watchman delivers state updates based on the observed state in a given clock tick.
It is reporting that
file1matches your query criteria for things that changed since an earlier clock value, and that its current state at that time is that it doesn't exist.