bug: linux: sysfs: changes to /sys/ are silently ignored even with polling mode
numsim1415 opened this issue · comments
usage:
check for traffic or errors.
how to reproduce
watchmedo log --trace -v --pattern="rx_bytes" /sys/class/net/lo/statistics/
ping localhost # in another shell, this will modify the rx_bytes file
same with polling
watchmedo log --debug-force-polling --interval 0.1 --trace -v --pattern="rx_bytes" /sys/class/net/lo/statistics/
ping localhost
result
no callback, no log
expected result
log a callback for on_modified()
background
Linux has the inotify to watch changes to files. Yet, for virtual sysfs files like /sys/ it is not fully supported, see https://unix.stackexchange.com/questions/398204/inotifywait-not-alterting-when-device-created
Thus, watchdog should check if inotify can work for the requested directory. If it doesnt, it should fallback to polling.
Yet, even with polling, no changes are detected so there is something wrong.
version
watchmedo --version # 2.2.1
uname -r # 5.15
I suggest we label this issue as a bug, at least with --debug-force-polling
.