[Development] QInotifyFileSystemWatcherEngine might have incomplete data?
markg85 at gmail.com
Sun Nov 17 19:07:48 CET 2013
I'm trying to make my first little steps in making a Qt patch to implement a:
signal created(const QString& path)
because that would allow you to know which files get created in a
folder that is being watched. KDirWatch has that feature,
However, when trying to implement that feature i was faced with an
According to the inotify docs . Specifically:
-- QUOTE --
The name field is only present when an event is returned for a file
inside a watched directory; it identifies the file pathname relative
to the watched directory. This pathname is null-terminated, and may
include further null bytes to align subsequent reads to a suitable
-- END QUOTE --
I'm not quite sure of this is a bug, something intentional or
something i'm doing wrong. The steps to reproduce this are as follows:
1. Create a simple that watches a folder:
int main(int argc, char *argv)
QCoreApplication a(argc, argv);
QFileSystemWatcher* watcher = new QFileSystemWatcher(&a);
2. Set a breakpoint within the
QInotifyFileSystemWatcherEngine::readFromInotify() function after the
point where you have an "event" object.
3. Create a new file in the folder you're monitoring.
4. GDB (or whatever you used) should hit the bearkpoint. Now inspace
the "event" members (name specifically). It's empty while it shouldn't
Just to be sure that inotify works, i tested the same by typing the command:
inotifywait -m -e create /path/to/folder/
Creating a new file then gives me a new line like:
/path/to/folder/ CREATE newFileName
Which leads me to think that inotify itself is working just fine.
I hope someone could take a look at this and see if i'm wrong or if
this is a bug somewhere?
CCing the people that changed the readFromInotify function.
More information about the Development