If you specify fanotify::init::Flags::REPORT_NAME, the read results (can?) have a second header that contains the path segment that changed. This triggers a TooShort error (with a misleading message, since there's extra data), due to a if found != expected test.
|
if found != expected { |
|
return Err(TooShort { |
|
what: FidEvent, |
|
found, |
|
expected, |
|
}); |
|
} |
If I change that to if found < expected, the code works again, but ignores the extra data. Printing it out reveals the first byte is 2, hence fanotify_event_info_fid.hdr.info_type == 2, FAN_EVENT_INFO_TYPE_DFID_NAME. And it seems this library can request names, but cannot parse them.
It seems EventIterator was written to assume there's only one fanotify_event_info_fid, but as far as I understand that's not guaranteed. I would suggest the code be changed to treat it as a sequence, and silently ignore unrecognized info_type values. That change didn't up being quite trivial enough for me to program it quickly..
If you specify
fanotify::init::Flags::REPORT_NAME, the read results (can?) have a second header that contains the path segment that changed. This triggers aTooShorterror (with a misleading message, since there's extra data), due to aif found != expectedtest.fanotify/src/event/iterator.rs
Lines 156 to 162 in 07703f3
If I change that to
if found < expected, the code works again, but ignores the extra data. Printing it out reveals the first byte is 2, hencefanotify_event_info_fid.hdr.info_type == 2,FAN_EVENT_INFO_TYPE_DFID_NAME. And it seems this library can request names, but cannot parse them.It seems
EventIteratorwas written to assume there's only onefanotify_event_info_fid, but as far as I understand that's not guaranteed. I would suggest the code be changed to treat it as a sequence, and silently ignore unrecognizedinfo_typevalues. That change didn't up being quite trivial enough for me to program it quickly..