After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 314854 - gnome-menus should have inotify support
gnome-menus should have inotify support
Status: RESOLVED FIXED
Product: gnome-menus
Classification: Core
Component: libgnome-menu
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-menus dummy account
gnome-menus dummy account
Depends on:
Blocks:
 
 
Reported: 2005-08-30 17:05 UTC by John McCutchan
Modified: 2006-11-02 04:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-menu-gnome-vfs.patch (12.03 KB, patch)
2005-08-30 17:05 UTC, John McCutchan
rejected Details | Review
gnome-menu-gnome-vfs-take-2.patch (14.35 KB, patch)
2005-08-30 18:35 UTC, John McCutchan
none Details | Review
gnome-menu-gnome-vfs-take-3.patch (14.45 KB, patch)
2005-08-30 19:19 UTC, John McCutchan
none Details | Review
gnome-menu-gnome-vfs-take-4.patch (15.61 KB, patch)
2005-08-30 20:12 UTC, John McCutchan
none Details | Review
gnome-menu-gnome-vfs-take-5.patch (17.01 KB, patch)
2005-08-30 21:25 UTC, John McCutchan
none Details | Review
gnome-menus-gnome-vfs-take-6.patch (18.33 KB, patch)
2005-08-31 16:41 UTC, John McCutchan
rejected Details | Review
gnome-menus-configure-gnomevfs.patch (1.73 KB, patch)
2006-01-30 21:40 UTC, John McCutchan
rejected Details | Review
menu-monitor-gnomevfs.c (2.90 KB, text/x-csrc)
2006-01-30 21:41 UTC, John McCutchan
  Details

Description John McCutchan 2005-08-30 17:05:31 UTC
The attached patch implements this. I haven't actually run it yet, it's just a
direct port. Their are two things left open: should the callbacks be using
monitor_uri or info_uri? and gnome-vfs-monitor doesn't have a non existant file
watch type.
Comment 1 John McCutchan 2005-08-30 17:05:59 UTC
Created attachment 51565 [details] [review]
gnome-menu-gnome-vfs.patch
Comment 2 John McCutchan 2005-08-30 17:07:00 UTC
I don't think the lack of a non existant file watch type is going to matter at
all. The only thing left to clear up is the uri usage.
Comment 3 Mark McLoughlin 2005-08-30 17:18:31 UTC
I only changed gnome-menus to use FAM directly a few months ago:

2005-04-22  Mark McLoughlin  <mark@skynet.ie>

        Use FAM directly instead of gnome-vfs and ensure that
        we only ever add a single FAM monitor any given path.
        Should fix bug #160194.

        Oh, also use the FAMNoExists() extension from gamin
        if available - should cut down on a whole heap of
        FAM traffic.

I don't think its sane to pull in gnome-vfs only for file monitoring

Happy to accept a patch to make it use inotify, though
Comment 4 Mark McLoughlin 2005-08-30 17:23:08 UTC
In fact, having file monitoring support in glib might not be insane
Comment 5 Mark McLoughlin 2005-08-30 17:24:17 UTC
(Well, apart from the fact that making it portable wouldn't be sane)
Comment 6 John McCutchan 2005-08-30 18:35:01 UTC
Created attachment 51569 [details] [review]
gnome-menu-gnome-vfs-take-2.patch
Comment 7 John McCutchan 2005-08-30 18:35:48 UTC
New patch uses info_uri, and translates between uri and paths where appropriate. 
Comment 8 John McCutchan 2005-08-30 18:39:20 UTC
Nautilus and the panel both use gnome-vfs, so you wouldn't be pulling anything
into memory that isn't already there.

As for porting gnome-menus to inotify, I have already ported gnome-vfs to use
inotify instead of fam #314281. Porting specific applications is a wasteful path
to go down.
Comment 9 John McCutchan 2005-08-30 19:19:44 UTC
Created attachment 51578 [details] [review]
gnome-menu-gnome-vfs-take-3.patch

call gnome_vfs_init
Comment 10 John McCutchan 2005-08-30 20:12:57 UTC
Created attachment 51580 [details] [review]
gnome-menu-gnome-vfs-take-4.patch

Don't call gnome_vfs_init ().
Don't add a monitor to the list if gnome_vfs_monitor_add fails.
Comment 11 John McCutchan 2005-08-30 21:25:02 UTC
Created attachment 51587 [details] [review]
gnome-menu-gnome-vfs-take-5.patch

Fixed a couple bugs. Both gmenu-simple-editor, and gnome-menu-spec-test work
with this patch.
Comment 12 John McCutchan 2005-08-31 16:41:32 UTC
Created attachment 51618 [details] [review]
gnome-menus-gnome-vfs-take-6.patch

Based on reversed diffs from gnome-vfs to FAM.
Comment 13 John McCutchan 2005-12-20 03:58:06 UTC
Mark, in gnome 2.14 gnome-vfs is going to use inotify instead of FAM. This is going to be the only left over requiring FAM on Linux. Could you reconsider your position?
Comment 14 Ilya Konstantinov 2006-01-04 21:24:51 UTC
John, you don't seem to be using pkgconfig to determine the cflags required for gnome-vfs. This makes compilation fail on my system.
Comment 15 Ilya Konstantinov 2006-01-04 21:43:17 UTC
Disregard this note. My rpm script didn't run autoconf, of course.
Comment 16 Mark McLoughlin 2006-01-15 19:37:22 UTC
I don't think it's sane for an application to have to link to gnome-vfs purely for file monitoring.

Moving gnome-menus from monitoring using gnome-vfs to FAM was a pretty trivial task. I would expect it to be even more trivial to add inotify support alongside the FAM support.
Comment 17 John McCutchan 2006-01-23 01:45:18 UTC
Mark, 

Adding proper inotify support to gnome-menus is not trivial and more importantly a duplication of effort and code in gnome-vfs. 

Anyways, you keep insisting on not wanting to bring in a dependency to gnome-vfs but you have failed to give any reasons other than your opinion. I can only assume you feel like this would bloat gnome-menus somehow. But I don't think that is a valid concern.

It's a safe conclusion that gnome-menus is only being used in a gnome environment. As proof I ran a reverse dependency check in debian unstable, and the only applications that use gnome-menus are: gnome-panel and gnome-control-center both of which also depend on gnome-vfs. Even if there is a counter example, gnome-panel and gnome-control-center are going to account for 99% of gnome-menu's usage currently. 

So your users are already depending on gnome-vfs anyways, and the environment gnome-menus is being used it will be using gnome-vfs as well. So I can't see how  depending on gnome-vfs is going to add to bloat.

To make things even worse in gnome 2.14 FAM will no longer be used by default on Linux. So you are going to force every desktop machine to have gamin loaded just for watching the handful of paths that gnome-menus watches. So in gnome 2.14 your effort to reduce bloat is going to do just the opposite.

Finally, Ubuntu and Suse ship with my attached patch for the reasons I have been stressing. 

Could you please reconsider applying this patch?
Comment 18 William Jon McCann 2006-01-26 18:28:24 UTC
Mark, please don't make gnome-menus depend on gnome-vfs.
Comment 19 Mark McLoughlin 2006-01-29 18:05:46 UTC
Just committed this to HEAD:

---
2006-01-29  Mark McLoughlin  <mark@skynet.ie>

        Begin adding inotify support - bug #314854

        * libmenu/menu-monitor-backend.h: define a generic
        backend interface for file monitor implementations

        * libmenu/menu-monitor.c: split out all the FAM
        stuff and use the generic backend interface

        * libmenu/menu-monitor-fam.c: both the FAM and "null"
        implementations

        * libmenu/Makefile.am: build menu-monitor-fam.c

        * libmenu/menu-monitor-inotify.c,
          libmenu/inotify-syscalls.h:
          libmenu/inotify.h: first cut at the inotify
        implementation; not finished yet and not built
        either.
---

menu-monitor-inotify.c needs more work - see the FIXMEs.

To build it, just modify the Makefile to built menu-monitor-inotify.c instead of menu-monitor-fam.c.

When menu-monitor-inotify.c is ready, we can add some code to make it try inotify first and then fall back to FAM.
Comment 20 John McCutchan 2006-01-29 22:09:18 UTC
After a quick review of your code there are a couple problems,

1) It will fail if it runs in to symbolic links
2) Your read function is going to trick the kernel into thinking this is an interactive application. The kernel is going to schedule apps using gnome-menus  way more than it should and the in kernel event compression will not be able to take place

Why not a optional gnome-vfs backend instead?
Comment 21 John McCutchan 2006-01-30 21:40:20 UTC
Created attachment 58418 [details] [review]
gnome-menus-configure-gnomevfs.patch
Comment 22 John McCutchan 2006-01-30 21:41:05 UTC
Created attachment 58419 [details]
menu-monitor-gnomevfs.c
Comment 23 John McCutchan 2006-01-30 21:42:15 UTC
The patch still needs some integration work, mainly in configure/makefile space. 
Comment 24 John McCutchan 2006-06-12 19:11:02 UTC
Hey Mark, why did you reject my patch?
Comment 25 John McCutchan 2006-09-07 05:11:46 UTC
Mark? Anyone else?
Comment 26 Mark McLoughlin 2006-11-01 18:03:26 UTC
John: as I said, I don't think it's sane to add a gnome-vfs dependancy purely for the sake of file monitoring. Especially now, given alexl's work on gvfs. The way to avoid this kind of duplication is to get file monitoring support in glib.

Anyway, inotify support should be fairly usable on HEAD now. Appreciate any testing, bug reports, patches etc.

2006-11-01  Mark McLoughlin  <mark@skynet.ie>

        Flesh out the inotify support. Not enabled by default until
        it gets a tad more testing. Closes bug #314854

        * configure.in: add --enable-inotify
        
        * libmenu/Makefile.am: build menu-monitor-inotify.c if inotify
        is enabled.
        
        * libmenu/menu-monitor-inotify.c: implement lots more of this.
        See TODO list at the top of the file.

Comment 27 John McCutchan 2006-11-02 04:06:58 UTC
Mark, my patch implemented the dependency on gnome-vfs in a similar fashion as the inotify dependency; Optional, specified at compile time. The future of gnome-vfs is irrelevant, a gvfs backend could easily be added once gvfs is ready to be used.

This bug is a farce anyways, since almost every major distribution (suse,debian,ubuntu,fedora?) patches gnome-menus to depend on gnome-vfs. If that doesn't tell you something, then I don't know what will. 

As for your inotify backend. It has at least one fairly serious bug on top of those I listed originally (all still unfixed). Watching a file's inode with inotify will not give you expected results. You need to watch the file's parent directory's inode instead (and aggregate the events with the inotify event name field).

I suggest you take a look at the inotify code in gamin/gnome-vfs. It handles every issue I've raised and only depends on glib (the version in gamin that is).