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 633014 - GFileMonitor doesn't monitor root directory "/" (with test case)
GFileMonitor doesn't monitor root directory "/" (with test case)
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
2.26.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-10-24 08:19 UTC by Hong Jen Yee
Modified: 2018-05-24 12:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A simple test case demonstrating the bug. (740 bytes, text/x-csrc)
2010-10-24 08:19 UTC, Hong Jen Yee
Details

Description Hong Jen Yee 2010-10-24 08:19:12 UTC
Created attachment 173108 [details]
A simple test case demonstrating the bug.

I found that g_file_monitor_directory is not able to monitor "/".

I'm using glib 2.26 on Ubuntu 10.10.
uname -a output: Linux thinkpad 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:24:00 UTC 2010 i686 GNU/Linux

In the attachment is a simple test case demonstrating this bug.
Just pass "/" as argv[1] to this test program, and do some changes inside /.
Then you'll see nothing happens. No notification for any event is sent.
If you pass your home directory or others, it works correctly.

The test case (also included in attachment):

#include <gtk/gtk.h>
#include <gio/gio.h>

static void on_changed(GFileMonitor     *monitor,
    GFile            *file,
    GFile            *other_file,
    GFileMonitorEvent event_type,
    gpointer          user_data)
{
    char* name = g_file_get_parse_name(file);
    g_debug("changed: %s", name);
    g_free(name);
}

int main(int argc, char** argv)
{
    gtk_init(&argc, &argv);
    if(argc > 1)
    {
        GFile *gf = g_file_new_for_path(argv[1]);
        GFileMonitor* mon = g_file_monitor_directory(gf, 0, NULL, NULL);
        g_signal_connect(mon, "changed", G_CALLBACK(on_changed), NULL);
        g_object_unref(gf);
        gtk_main();
        g_file_monitor_cancel(mon);
        g_object_unref(mon);
    }
    return 0;
}
Comment 1 GNOME Infrastructure Team 2018-05-24 12:50:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/362.