[gedit-list] Issue with gedit and inotify



Hello list,

I'm currently working on an application that use inotify [1] to poll a
file for change. During my test, i used gedit to edit this file, and
check if the modification was detected or not. It didn't really worked
as i expected :

On a file in my home, i got those events after a first modification :

Monitoring : '/home/flo/test' (number = 1)
Monitored file n°1      Event : IN_OPEN(file)    * Opening file
Monitored file n°1      Event : IN_CLOSE(file)
Monitored file n°1      Event : IN_OPEN(file)    * 1st modification
Monitored file n°1      Event : IN_CLOSE(file)

And then nothing. Editing again the file with gedit, vi, nano, and even
touch don't generate events.

On a file in /etc, i got those events :

Monitoring : '/etc/fstab' (number = 1)
Monitored file n°1      Event : IN_OPEN(file)        * Opening file
Monitored file n°1      Event : IN_CLOSE(file)
Monitored file n°1      Event : IN_OPEN(file)        * 1st modification
Monitored file n°1      Event : IN_MOVE_SELF(file)
Monitored file n°1      Event : IN_CLOSE(file)       * 2nd modification
Monitored file n°1      Event : IN_DELETE_SELF(file)
Monitored file n°1      Event : IN_IGNORED(file)

And then again it stop working.

For the second case i workaround the problem by repolling the file if i
get an IN_DELETE_SELF event and the file still exists, but for the first
case, i don't know what to do.

I also tried nano, kate, mousepad, and they all worked well with
inotify, the only other exception is vim that act like gedit in the
second case.

I don't know if the problem is known, and if there is something to do
against it. I wanted something reliable to check a file for
modification, but if it fail with one of the most used editor, and i
don't really know if it is really useful.
If there is nothing to do, is there any good workaround ?

I attach the little app i used to test inotify if someone want to
reproduce the bug (if it is one).

1 : http://ibm5.ma.utexas.edu/cgi-bin/man-cgi?inotify+7

Best Regards,

Mertens Florent

	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]