mcrha pushed to evolution-data-server (f21). "Add patch for RH bug #1183719 ("FOREIGN KEY constraint failed" trying to delete contact)"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Apr 14 09:49:19 UTC 2015


>From 08a8c50d4ae834b70717e7555a75c1a871cf71c3 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha at redhat.com>
Date: Tue, 14 Apr 2015 11:49:03 +0200
Subject: Add patch for RH bug #1183719 ("FOREIGN KEY constraint failed" trying
 to delete contact)


diff --git a/evolution-data-server-3.12.11-book-sqlite-foreign-key-fix.patch b/evolution-data-server-3.12.11-book-sqlite-foreign-key-fix.patch
new file mode 100644
index 0000000..e155f7d
--- /dev/null
+++ b/evolution-data-server-3.12.11-book-sqlite-foreign-key-fix.patch
@@ -0,0 +1,96 @@
+diff --git a/addressbook/libedata-book/e-book-sqlite.c b/addressbook/libedata-book/e-book-sqlite.c
+index e3770fe..64449db 100644
+--- a/addressbook/libedata-book/e-book-sqlite.c
++++ b/addressbook/libedata-book/e-book-sqlite.c
+@@ -246,7 +246,7 @@ ebsql_init_debug (void)
+ 		} \
+ 	} G_STMT_END
+ 
+-#define FOLDER_VERSION                8
++#define FOLDER_VERSION                9
+ #define INSERT_MULTI_STMT_BYTES       128
+ #define COLUMN_DEFINITION_BYTES       32
+ #define GENERATED_QUERY_BYTES         1024
+@@ -2075,7 +2075,7 @@ format_multivalues (EBookSqlite *ebsql)
+ 		}
+ 	}
+ 
+-	return g_string_free (string, FALSE);
++	return g_string_free (string, string->len == 0);
+ }
+ 
+ /* Called with the lock held and inside a transaction */
+@@ -2109,6 +2109,23 @@ ebsql_add_folder (EBookSqlite *ebsql,
+ 	return success;
+ }
+ 
++static gboolean
++ebsql_email_list_exists (EBookSqlite *ebsql)
++{
++	gint n_tables = 0;
++	gboolean success;
++
++	success = ebsql_exec_printf (
++		ebsql, "SELECT count(*) FROM sqlite_master WHERE type='table' AND name='%q_email_list';",
++		get_count_cb, &n_tables, NULL, NULL,
++		ebsql->priv->folderid);
++
++	if (!success)
++		return FALSE;
++
++	return n_tables == 1;
++}
++
+ /* Called with the lock held and inside a transaction */
+ static gboolean
+ ebsql_introspect_summary (EBookSqlite *ebsql,
+@@ -2225,6 +2242,19 @@ ebsql_introspect_summary (EBookSqlite *ebsql,
+ 	if (!success)
+ 		goto introspect_summary_finish;
+ 
++	if (!multivalues || !*multivalues) {
++		g_free (multivalues);
++		multivalues = NULL;
++
++		/* The migration from a previous version didn't store this default multivalue
++		   reference, thus the next backend open (not the immediate one after migration),
++		   didn't know about this table, which has a FOREIGN KEY constraint, thus an item
++		   delete caused a 'FOREIGN KEY constraint failed' error.
++		*/
++		if (ebsql_email_list_exists (ebsql))
++			multivalues = g_strdup ("email;prefix");
++	}
++
+ 	if (multivalues) {
+ 		gchar **fields = g_strsplit (multivalues, ":", 0);
+ 
+@@ -2524,6 +2554,20 @@ ebsql_init_aux_tables (EBookSqlite *ebsql,
+ 				field->aux_table));
+ 	}
+ 
++	if (success) {
++		gchar *multivalues;
++
++		multivalues = format_multivalues (ebsql);
++
++		success = ebsql_exec_printf (
++			ebsql,
++			"UPDATE folders SET multivalues=%Q WHERE folder_id=%Q",
++			NULL, NULL, NULL, error,
++			multivalues, ebsql->priv->folderid);
++
++		g_free (multivalues);
++	}
++
+ 	EBSQL_NOTE (
+ 		SCHEMA,
+ 		g_printerr (
+@@ -2770,7 +2814,7 @@ ebsql_init_locale (EBookSqlite *ebsql,
+ 	/* Check if we need to relocalize */
+ 	if (success) {
+ 		/* Need to relocalize the whole thing if the schema has been upgraded to version 7 */
+-		if (previous_schema >= 1 && previous_schema < 7)
++		if (previous_schema >= 1 && previous_schema < 9)
+ 			relocalize_needed = TRUE;
+ 
+ 		/* We may need to relocalize for a country code change */
diff --git a/evolution-data-server.spec b/evolution-data-server.spec
index cb1a23f..dbf3e33 100644
--- a/evolution-data-server.spec
+++ b/evolution-data-server.spec
@@ -32,7 +32,7 @@
 
 Name: evolution-data-server
 Version: 3.12.11
-Release: 1%{?dist}
+Release: 2%{?dist}
 Group: System Environment/Libraries
 Summary: Backend data server for Evolution
 License: LGPLv2+
@@ -53,6 +53,9 @@ Obsoletes: compat-evolution-data-server310-libcamel < 3.12
 # RH bug #243296
 Patch01: evolution-data-server-1.11.5-fix-64bit-acinclude.patch
 
+# RH bug ##1183719
+Patch02: evolution-data-server-3.12.11-book-sqlite-foreign-key-fix.patch
+
 ### Dependencies ###
 
 Requires: dconf
@@ -140,6 +143,7 @@ This package contains developer documentation for %{name}.
 %setup -q
 
 %patch01 -p1 -b .fix-64bit-acinclude
+%patch02 -p1 -b .book-sqlite-foreign-key-fix
 
 %build
 %if %{ldap_support}
@@ -382,6 +386,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
 %endif
 
 %changelog
+* Tue Apr 14 2015 Milan Crha <mcrha at redhat.com> - 3.12.11-2
+- Add patch for RH bug #1183719 ("FOREIGN KEY constraint failed" trying to delete contact)
+
 * Mon Feb 09 2015 Milan Crha <mcrha at redhat.com> - 3.12.11-1
 - Update to 3.12.11
 - Remove patch for GNOME bug #736006 (fixed upstream)
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/evolution-data-server.git/commit/?h=f21&id=08a8c50d4ae834b70717e7555a75c1a871cf71c3


More information about the scm-commits mailing list