- Backport crasher fixes from upstream svn trunk

This commit is contained in:
Deji Akingunola 2007-12-15 03:53:53 +00:00
parent 5c79ad122a
commit 64e1629c63
2 changed files with 174 additions and 6 deletions

View File

@ -0,0 +1,167 @@
#Fix crasher where index name is null during merging and fixed invalid log file
--- src/trackerd/trackerd.c 2007/12/11 02:57:07 1070
+++ src/trackerd/trackerd.c 2007/12/11 18:25:27 1074
@@ -2486,12 +2486,6 @@
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 +2499,18 @@
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");
+
+ tracker->dbus_con = tracker_dbus_init ();
+
+ add_local_dbus_connection_monitoring (tracker->dbus_con);
+
+
g_free (tmp_dir);
/* remove an existing one */
@@ -2636,9 +2642,7 @@
ioprio ();
#endif
- /* reset log file */
- tracker_unlink (tracker->log_file);
-
+
/* deal with config options with defaults, config file and option params */
set_defaults ();
--- 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);
+ }
}
}

View File

@ -1,11 +1,12 @@
Summary: An object database, tag/metadata database, search tool and indexer
Name: tracker
Version: 0.6.4
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.gnome.org/~jamiemcc/tracker/
Source0: http://www.gnome.org/~jamiemcc/tracker/%{name}-%{version}.tar.bz2
Patch0: tracker-post_0.6.4_fixes.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gmime-devel, poppler-devel, gettext
BuildRequires: gnome-desktop-devel, gamin-devel, libnotify-devel
@ -50,6 +51,8 @@ GNOME libraries
%prep
%setup -q
%patch0 -p0 -b .fix
%define deskbar_applet_ver %(pkg-config --modversion deskbar-applet)
%if "%deskbar_applet_ver" >= "2.19.4"
%define deskbar_applet_dir %(pkg-config --variable modulesdir deskbar-applet)
@ -72,10 +75,6 @@ make %{?_smp_mflags}
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install
# Add an autostart for trackerd (for KDE)
#mkdir -p %{buildroot}%{_datadir}/autostart
#cp -pr trackerd.desktop %{buildroot}%{_datadir}/autostart/
desktop-file-install --delete-original \
--vendor="fedora" \
--dir=%{buildroot}%{_datadir}/applications \
@ -134,10 +133,12 @@ fi
%{deskbar_applet_dir}/tracker*.py*
%{_datadir}/icons/*/*/apps/tracker.*
%{_datadir}/applications/*.desktop
#%{_datadir}/autostart/*.desktop
%{_sysconfdir}/xdg/autostart/tracker-applet.desktop
%changelog
* Fri Dec 14 2007 Deji Akingunola <dakingun@gmail.com> - 0.6.4-2
- Backport crasher fixes from upstream svn trunk
* Mon Dec 11 2007 Deji Akingunola <dakingun@gmail.com> - 0.6.4-1
- Version 0.6.4