Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gamin/ChangeLog,v
retrieving revision 1.271
diff -u -r1.271 ChangeLog
--- ChangeLog	24 Nov 2005 16:16:08 -0000	1.271
+++ ChangeLog	28 Dec 2005 21:25:41 -0000
@@ -1,3 +1,9 @@
+Wed Dec 28 16:02:01 EST 2005 William Lachance <wrlach@gmail.com>
+	* server/gam_inotify.c Don't even start to watch symbolic
+	  links using inotify: just add them immediately to our list
+	  of links to poll. should fix #323064.
+	* tests/scenario/12.tst tests/result/12 test for the above.
+	
 Thu Nov 24 17:15:49 CET 2005 Daniel Veillard <veillard@redhat.com>
 
 	* configure.in server/gam_inotify.c: inotify.h may be found
Index: server/gam_inotify.c
===================================================================
RCS file: /cvs/gnome/gamin/server/gam_inotify.c,v
retrieving revision 1.49
diff -u -r1.49 gam_inotify.c
--- server/gam_inotify.c	24 Nov 2005 16:16:09 -0000	1.49
+++ server/gam_inotify.c	28 Dec 2005 21:25:42 -0000
@@ -825,32 +825,33 @@
 		return TRUE;
 	}
 
-	wd = gam_inotify_add_watch (path, GAM_INOTIFY_MASK, &err);
-	if (wd < 0) {
-		GAM_DEBUG (DEBUG_INFO, "inotify: could not add watch for %s\n", path);
-		if (err == EACCES) {
-			GAM_DEBUG (DEBUG_INFO, "inotify: adding %s to missing list PERM\n", path);
-		} else {
-			GAM_DEBUG (DEBUG_INFO, "inotify: adding %s to missing list MISSING\n", path);
-		}
-		data = gam_inotify_data_new (path, err == EACCES ? GAM_INOTIFY_WD_PERM : GAM_INOTIFY_WD_MISSING, FALSE);
-		gam_inotify_add_missing (path, err == EACCES ? TRUE : FALSE);
-	} else if (gam_inotify_is_link (path)) {
-		/* The file turned out to be a link, cancel the watch, and add it to the links list */
-		gam_inotify_rm_watch (path, wd);
+	if (gam_inotify_is_link (path)) {
+		/* The file turned out to be a link: add it to the links list */
 		GAM_DEBUG (DEBUG_INFO, "inotify: could not add watch for %s\n", path);
 		GAM_DEBUG (DEBUG_INFO, "inotify: adding %s to links list\n", path);
 		data = gam_inotify_data_new (path, GAM_INOTIFY_WD_LINK, FALSE);
 		gam_inotify_add_link (path);
 	} else {
-		struct stat sbuf;
-		memset(&sbuf, 0, sizeof (struct stat));
-		lstat (path, &sbuf);
-		/* Just in case,
-		 * Clear this path off the missing list */
-		gam_inotify_rm_missing (path);
-		data = gam_inotify_data_new (path, wd, sbuf.st_mode & S_IFDIR);
-		g_hash_table_insert(wd_hash, GINT_TO_POINTER(data->wd), data);
+		wd = gam_inotify_add_watch (path, GAM_INOTIFY_MASK, &err);
+		if (wd < 0) {
+			GAM_DEBUG (DEBUG_INFO, "inotify: could not add watch for %s\n", path);
+			if (err == EACCES) {
+				GAM_DEBUG (DEBUG_INFO, "inotify: adding %s to missing list PERM\n", path);
+			} else {
+				GAM_DEBUG (DEBUG_INFO, "inotify: adding %s to missing list MISSING\n", path);
+			}
+			data = gam_inotify_data_new (path, err == EACCES ? GAM_INOTIFY_WD_PERM : GAM_INOTIFY_WD_MISSING, FALSE);
+			gam_inotify_add_missing (path, err == EACCES ? TRUE : FALSE);
+		} else {
+			struct stat sbuf;
+			memset(&sbuf, 0, sizeof (struct stat));
+			lstat (path, &sbuf);
+			/* Just in case,
+			 * Clear this path off the missing list */
+			gam_inotify_rm_missing (path);
+			data = gam_inotify_data_new (path, wd, sbuf.st_mode & S_IFDIR);
+			g_hash_table_insert(wd_hash, GINT_TO_POINTER(data->wd), data);
+		}
 	}
 
 #ifdef GAMIN_DEBUG_API
Index: tests/scenario/12.tst
===================================================================
RCS file: tests/scenario/12.tst
diff -N tests/scenario/12.tst
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/scenario/12.tst	28 Dec 2005 21:25:42 -0000
@@ -0,0 +1,11 @@
+mkdir /tmp/test_gamin
+link /tmp/test_gamin_SHOULD_NOT_EXIST/bar /tmp/test_gamin/foo
+connect test
+monfile /tmp/test_gamin/foo
+expect 2
+wait
+rmfile /tmp/test_gamin/foo
+wait
+expect 1
+disconnect
+rmdir /tmp/test_gamin
Index: tests/result/12
===================================================================
RCS file: tests/result/12
diff -N tests/result/12
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/result/12	28 Dec 2005 21:25:42 -0000
@@ -0,0 +1,10 @@
+mkdir /tmp/test_gamin
+link /tmp/test_gamin/foo to /tmp/test_gamin_SHOULD_NOT_EXIST/bar
+connected to test
+monfile /tmp/test_gamin/foo 0
+1: /tmp/test_gamin/foo Exists: NULL
+1: /tmp/test_gamin/foo EndExist: NULL
+rmfile /tmp/test_gamin/foo
+1: /tmp/test_gamin/foo Deleted: NULL
+disconnected
+rmdir /tmp/test_gamin
