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 313624 - Double entries in menu caused by on disk monitoring
Double entries in menu caused by on disk monitoring
Status: RESOLVED FIXED
Product: gnome-menus
Classification: Core
Component: libgnome-menu
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-menus dummy account
gnome-menus dummy account
Depends on:
Blocks:
 
 
Reported: 2005-08-16 12:07 UTC by Frederic Crozat
Modified: 2005-08-18 12:58 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
testcase (543 bytes, application/x-compressed-tar)
2005-08-16 12:08 UTC, Frederic Crozat
  Details
patch fixing the issue (2.09 KB, patch)
2005-08-16 12:09 UTC, Frederic Crozat
none Details | Review
fix infinite loop (650 bytes, patch)
2005-08-18 09:11 UTC, Frederic Crozat
none Details | Review

Description Frederic Crozat 2005-08-16 12:07:12 UTC
Distribution/Version: Mandriva cooker

monitoring code in gnome-menus is having some difficulties when topdir
applications directory is deleted and re-created, resulting in double entries in
menu.

Testcase attached :
1/stop gnome-panel (gnome-session-remove gnome-panel)
1/untar testcase in $HOME : it will create .local and .config directories
containing relevant files
2/start gnome-panel manually
3/open menu in gnome-panel (to ensure it is loaded) => you should see one
gnomemeeting entry
4/in shell, rm -fr ~/.local ~/.config
5/untar testcase again
6/open menu in gnome-panel => you should see two gnomemeeting entries.

Patch attached to fix this issue (I'm not sure it is 100% clean, because we need
to monitor parent of topdir applications menu but only for applications
directory deletion or creation, nothing else.
Comment 1 Frederic Crozat 2005-08-16 12:08:33 UTC
Created attachment 50782 [details]
testcase
Comment 2 Frederic Crozat 2005-08-16 12:09:04 UTC
Created attachment 50783 [details] [review]
patch fixing the issue
Comment 3 Mark McLoughlin 2005-08-18 08:12:31 UTC
Thanks, fix was pretty straightforward, but I've also fixed up another issue
with that code. Not sure if the fixes interact, they probably don't, but best to
test all of it together:

2005-08-18  Mark McLoughlin  <mark@skynet.ie>

        Fixes "duplicate entry" issue in bug #313624

        * libmenu/entry-directories.c:
        (handle_cached_dir_changed): Look up the CachedDir
        for the parent of whatever path we're being notified
        about - we could be getting notified about ourself
        being created/deleted.


Please do give this a hammering, we're very close to release now.
Comment 4 Frederic Crozat 2005-08-18 08:49:46 UTC
hmm, I'm having some problems with CVS snapshot for 10mins ago (it contains all
your fixes) when doing rm -f ~/.config ~/.local which contains a full tree =>
gnome-panel goes into infinite loop :(
Comment 5 Frederic Crozat 2005-08-18 09:11:16 UTC
Created attachment 50897 [details] [review]
fix infinite loop

this patch fixes the infinite loop introduced by previous commits. It is
usually best to increment iterator :)

With this patch, my testcase are ok, no regression seen nor infinite loop.
Comment 6 Frederic Crozat 2005-08-18 11:40:38 UTC
reopening, I'm seeing the problem (which was not fixed with my initial patch)
with a slightly different testcase).
Comment 7 Mark McLoughlin 2005-08-18 12:58:51 UTC
Thanks, committed the patch for the infinite loop:

2005-08-18  Mark McLoughlin  <mark@skynet.ie>

        Patch from Federic Crozat <fcrozat@mandriva.com>

        * libmenu/entry-directories.c:
        (cached_dir_remove_reference): Fix infinite loop.


If you're seeing any slightly different issues, please open a new bug - things
get confusing otherwise.