GFileMonitor doesn't monitor root directory "/" (with test case)
Submitted by Hong Jen Yee
Link to original bug (#633014)
Description
Created attachment 173108 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 (closed)-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; }
Attachment 173108, "A simple test case demonstrating the bug.":
test.c
Version: 2.26.x