Re: [Development] QInotifyFileSystemWatcherEngine might have incomplete data?

2013-11-18 Thread Mark Gaiser
On Sun, Nov 17, 2013 at 9:23 PM, Mark Gaiser mark...@gmail.com wrote:
 On Sun, Nov 17, 2013 at 9:20 PM, Mark Gaiser mark...@gmail.com wrote:
 On Sun, Nov 17, 2013 at 8:03 PM, Olivier Goffart oliv...@woboq.com wrote:
 On Sunday 17 November 2013 19:07:48 Mark Gaiser wrote:

 4. GDB (or whatever you used) should hit the bearkpoint. Now inspace
 the event members (name specifically). It's empty while it shouldn't
 be.

 Hi,
 I'd add a qDebug()  to be sure.
 Maybe it's just GDB giving wronf information.  Perhaps the data as been
 optimized.  Perhaps gdb think the name has lengh 0 because it is declared 
 as a
 char[].

 Hi Oliver,

 I tried your suggestion and that indeed works though not as i would expect 
 it.
 Yes, it does get printed on screen when i put event.name in a qDebug line.

 However, none of the emit signals in that function (readFromInotify)
 work anymore when i use event.name there. Anywhere! I just tried
 that out since you've had send the reply.
 You can find the diff of the stuff that's i've done thus far. Just
 adding this to your code breaks all the emits and i have no clue as to
 why that happens or how it's even possible.

 If you have any clue.. please do tell.

 Sorry, forgot the diff: http://pastebin.kde.org/pzqb2jph6
 Lifetime of 30 days.

Nevermind thiis issue. It works just fine now.
I had - shamefully - copied the part the checks if the emitted folder
is in face being watched. Then i had changed it's value without
changing the check so i ended up in this case that didn't made sense
at the time. Now it does :)
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] QInotifyFileSystemWatcherEngine might have incomplete data?

2013-11-17 Thread Mark Gaiser
Hi,

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,
QFileSystemWatcher doesn't.

However, when trying to implement that feature i was faced with an
empty inotify_event,name.

According to the inotify docs [1]. 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
address boundary.
-- 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:
#include QCoreApplication
#include QFileSystemWatcher

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

QFileSystemWatcher* watcher = new QFileSystemWatcher(a);
watcher-addPath(/path/to/folder/);

return a.exec();
}

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
be.

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.

Cheers,
Mark

[1] http://linux.die.net/man/7/inotify
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] QInotifyFileSystemWatcherEngine might have incomplete data?

2013-11-17 Thread Olivier Goffart
On Sunday 17 November 2013 19:07:48 Mark Gaiser wrote:

 4. GDB (or whatever you used) should hit the bearkpoint. Now inspace
 the event members (name specifically). It's empty while it shouldn't
 be.

Hi,
I'd add a qDebug()  to be sure.
Maybe it's just GDB giving wronf information.  Perhaps the data as been 
optimized.  Perhaps gdb think the name has lengh 0 because it is declared as a 
char[].  

--
Olivier

Woboq - Qt services and support - http://woboq.com


___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] QInotifyFileSystemWatcherEngine might have incomplete data?

2013-11-17 Thread Mark Gaiser
On Sun, Nov 17, 2013 at 8:03 PM, Olivier Goffart oliv...@woboq.com wrote:
 On Sunday 17 November 2013 19:07:48 Mark Gaiser wrote:

 4. GDB (or whatever you used) should hit the bearkpoint. Now inspace
 the event members (name specifically). It's empty while it shouldn't
 be.

 Hi,
 I'd add a qDebug()  to be sure.
 Maybe it's just GDB giving wronf information.  Perhaps the data as been
 optimized.  Perhaps gdb think the name has lengh 0 because it is declared as a
 char[].

Hi Oliver,

I tried your suggestion and that indeed works though not as i would expect it.
Yes, it does get printed on screen when i put event.name in a qDebug line.

However, none of the emit signals in that function (readFromInotify)
work anymore when i use event.name there. Anywhere! I just tried
that out since you've had send the reply.
You can find the diff of the stuff that's i've done thus far. Just
adding this to your code breaks all the emits and i have no clue as to
why that happens or how it's even possible.

If you have any clue.. please do tell.
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] QInotifyFileSystemWatcherEngine might have incomplete data?

2013-11-17 Thread Mark Gaiser
On Sun, Nov 17, 2013 at 9:20 PM, Mark Gaiser mark...@gmail.com wrote:
 On Sun, Nov 17, 2013 at 8:03 PM, Olivier Goffart oliv...@woboq.com wrote:
 On Sunday 17 November 2013 19:07:48 Mark Gaiser wrote:

 4. GDB (or whatever you used) should hit the bearkpoint. Now inspace
 the event members (name specifically). It's empty while it shouldn't
 be.

 Hi,
 I'd add a qDebug()  to be sure.
 Maybe it's just GDB giving wronf information.  Perhaps the data as been
 optimized.  Perhaps gdb think the name has lengh 0 because it is declared as 
 a
 char[].

 Hi Oliver,

 I tried your suggestion and that indeed works though not as i would expect it.
 Yes, it does get printed on screen when i put event.name in a qDebug line.

 However, none of the emit signals in that function (readFromInotify)
 work anymore when i use event.name there. Anywhere! I just tried
 that out since you've had send the reply.
 You can find the diff of the stuff that's i've done thus far. Just
 adding this to your code breaks all the emits and i have no clue as to
 why that happens or how it's even possible.

 If you have any clue.. please do tell.

Sorry, forgot the diff: http://pastebin.kde.org/pzqb2jph6
Lifetime of 30 days.
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development