GNOME Bugzilla – Bug 633014
GFileMonitor doesn't monitor root directory "/" (with test case)
Last modified: 2018-05-24 12:50:00 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; }
-- 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.