SOURCES: tracker-assorted_fixes.patch (NEW) - backport assorted fi...

megabajt megabajt at pld-linux.org
Sat Feb 9 13:49:46 CET 2008


Author: megabajt                     Date: Sat Feb  9 12:49:46 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- backport assorted fixes from GNOME SVN

---- Files affected:
SOURCES:
   tracker-assorted_fixes.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/tracker-assorted_fixes.patch
diff -u /dev/null SOURCES/tracker-assorted_fixes.patch:1.1
--- /dev/null	Sat Feb  9 13:49:46 2008
+++ SOURCES/tracker-assorted_fixes.patch	Sat Feb  9 13:49:41 2008
@@ -0,0 +1,248 @@
+--- src/trackerd/tracker-indexer.c	2007/12/10 23:37:31	1068
++++ src/trackerd/tracker-indexer.c	2007/12/11 21:16:02	1076
+@@ -215,7 +215,7 @@
+ 	}
+ 
+ 	if (!word_index) {
+-		tracker_log ("%s index was not closed properly and caused error %s- attempting repair", name, dperrmsg (dpecode));
++		tracker_error ("%s index was not closed properly and caused error %s- attempting repair", name, dperrmsg (dpecode));
+ 		if (dprepair (name)) {
+ 			word_index = dpopen (name, DP_OWRITER | DP_OCREAT | DP_ONOLCK, tracker->min_index_bucket_count);
+ 		} else {
+@@ -228,6 +228,16 @@
+ }
+ 
+ 
++static inline char *
++get_index_file (const char *name)
++{
++	char *word_dir;
++
++	word_dir = g_build_filename (tracker->data_dir, name, NULL);
++
++	return word_dir;
++}
++
+ Indexer *
+ tracker_indexer_open (const gchar *name)
+ {
+@@ -237,7 +247,7 @@
+ 
+ 	if (!name) return NULL;
+ 
+-	word_dir = g_build_filename (tracker->data_dir, name, NULL);
++	word_dir = get_index_file (name);
+ 
+ 	word_index = open_index (word_dir);
+ 	
+@@ -504,7 +514,7 @@
+ }
+ 
+ static void
+-move_index (Indexer *src_index, Indexer *dest_index)
++move_index (Indexer *src_index, Indexer *dest_index, const char *fname)
+ {
+ 
+ 	if (!src_index || !dest_index) {
+@@ -515,8 +525,6 @@
+ 	/* remove existing main index */
+ 	g_mutex_lock (dest_index->word_mutex);
+ 
+-	char *fname = dpname (dest_index->word_index);
+-
+ 	dpclose (dest_index->word_index);
+ 
+ 	dpremove (fname);
+@@ -526,7 +534,9 @@
+ 	tracker_indexer_close (src_index);
+ 		
+ 	/* rename and reopen final index as main index */
+-			
++		
++	tracker_log ("renaming %s to %s", final_name, fname);
++	
+ 	rename (final_name, fname);
+ 
+ 	dest_index->word_index = open_index (fname);	
+@@ -535,7 +545,6 @@
+ 		tracker_error ("index creation failure for %s from %s", fname, final_name);
+ 	}
+ 
+-	g_free (fname);
+ 	g_free (final_name);		
+ 
+ 	g_mutex_unlock (dest_index->word_mutex);
+@@ -556,7 +565,7 @@
+ 	if (type == INDEX_TYPE_FILES) {
+ 
+ 		g_return_if_fail (tracker->file_index);
+-
++		
+ 		prefix = "file-index.tmp.";
+ 
+ 		index_list = g_slist_prepend (index_list, tracker->file_index);
+@@ -571,7 +580,7 @@
+ 		prefix = "email-index.tmp.";
+ 
+ 		g_return_if_fail (tracker->email_index);
+-
++		
+ 		index_list = g_slist_prepend (index_list, tracker->email_index);
+ 
+ 		char *tmp = g_build_filename (tracker->data_dir, "email-index-final", NULL);
+@@ -748,6 +757,9 @@
+ 			g_free (str);
+ 		}
+ 
++
++		
++
+ 		/* dont free last entry as that is the main index */
+ 		if (lst->next) {
+ 
+@@ -757,7 +769,17 @@
+ 
+ 
+ 		} else {
+-			move_index (final_index, index);
++			if (type == INDEX_TYPE_FILES) {
++
++				char *fname = get_index_file ("file-index.db");
++				move_index (final_index, tracker->file_index, fname);	
++				g_free (fname);
++
++			} else {
++				char *fname = get_index_file ("email-index.db");
++				move_index (final_index, tracker->email_index, fname);
++				g_free (fname);
++			}
+ 		}		
+ 	}
+ 	
+--- src/trackerd/tracker-utils.c	2007/12/11 18:29:27	1075
++++ src/trackerd/tracker-utils.c	2007/12/13 23:55:10	1079
+@@ -3491,11 +3491,13 @@
+ 	/* logging is thread safe */
+ 	static size_t   log_size = 0;
+ 
+-	if (! message)
++	if (!message)
+ 		return;
+ 
+ 	g_print ("%s\n", message);
+ 
++	if (!tracker->log_file) return;
++
+ 	/* ensure file logging is thread safe */
+ 	g_mutex_lock (tracker->log_access_mutex);
+ 
+--- src/trackerd/trackerd.c	2007/12/11 02:57:07	1070
++++ src/trackerd/trackerd.c	2007/12/13 23:55:10	1079
+@@ -618,19 +618,13 @@
+ static void
+ signal_handler (gint signo)
+ {
+-	if (!tracker->is_running) {
+-		return;
+-	}
+-
+ 	static gboolean in_loop = FALSE;
+ 
+-  	/* avoid re-entrant signals handler calls */
+-	if (in_loop && signo != SIGSEGV) {
+-		return;
++  	/* die if we get re-entrant signals handler calls */
++	if (in_loop) {
++		exit (EXIT_FAILURE);
+ 	}
+ 
+-  	in_loop = TRUE;
+-
+   	switch (signo) {
+ 
+   		case SIGSEGV:
+@@ -646,6 +640,8 @@
+ 		case SIGTERM:
+ 		case SIGINT:
+ 
++		  	in_loop = TRUE;
++
+ 			tracker->is_running = FALSE;
+ 			tracker_end_watching ();
+ 
+@@ -660,8 +656,7 @@
+ 			if (tracker->log_file && g_strsignal (signo)) {
+ 	   			tracker_log ("Received signal %s ", g_strsignal (signo));
+ 			}
+-			in_loop = FALSE;
+-    			break;
++			break;
+   	}
+ }
+ 
+@@ -2422,6 +2417,14 @@
+ 	if (!g_thread_supported ())
+ 		g_thread_init (NULL);
+ 
++	dbus_g_thread_init ();
++
++	tracker = g_new0 (Tracker, 1);
++
++	tracker->dbus_con = tracker_dbus_init ();
++	
++	add_local_dbus_connection_monitoring (tracker->dbus_con);
++
+ 	setlocale (LC_ALL, "");
+ 
+ 	bindtextdomain (GETTEXT_PACKAGE, TRACKER_LOCALEDIR);
+@@ -2478,20 +2481,14 @@
+ 	sigaction (SIGINT,  &act, NULL);
+ #endif
+ 
+-	dbus_g_thread_init ();
++	
+ 
+-	tracker = g_new0 (Tracker, 1);
++	
+ 
+ 	tracker->status = STATUS_INIT;
+ 
+  	tracker->is_running = FALSE;
+ 
+-	tracker->log_file = g_build_filename (tracker->root_dir, "tracker.log", NULL);
+-
+-	tracker->dbus_con = tracker_dbus_init ();
+-	
+-	add_local_dbus_connection_monitoring (tracker->dbus_con);
+-
+ 	/* Make a temporary directory for Tracker into g_get_tmp_dir() directory */
+ 	gchar *tmp_dir;
+ 
+@@ -2505,6 +2502,16 @@
+ 	tracker->config_dir = g_strdup (g_get_user_config_dir ());
+ 	tracker->user_data_dir = g_build_filename (tracker->root_dir, "data", NULL);
+ 
++	tracker->log_file = g_build_filename (tracker->root_dir, "tracker.log", NULL);
++
++	/* reset log file */
++	tracker_unlink (tracker->log_file);
++
++	tracker_log ("starting log");
++
++	
++
++
+ 	g_free (tmp_dir);
+ 
+ 	/* remove an existing one */
+@@ -2636,9 +2643,7 @@
+ 	ioprio ();
+ #endif
+ 
+-	/* reset log file */
+-	tracker_unlink (tracker->log_file);
+-
++	
+ 	/* deal with config options with defaults, config file and option params */
+ 	set_defaults ();
+ 
================================================================


More information about the pld-cvs-commit mailing list