From 52eec75c46f7978c7c26619e0c91e2555fbb9dc3 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Thu, 3 Nov 2011 13:18:02 +0100 Subject: [PATCH] fixed creating of bacula MySQL tables (#724894) --- bacula-5.0.3-maxvalue.patch | 78 +++++++++++++++++++++++++++++++++++++ bacula.spec | 6 +++ 2 files changed, 84 insertions(+) create mode 100644 bacula-5.0.3-maxvalue.patch diff --git a/bacula-5.0.3-maxvalue.patch b/bacula-5.0.3-maxvalue.patch new file mode 100644 index 0000000..f671749 --- /dev/null +++ b/bacula-5.0.3-maxvalue.patch @@ -0,0 +1,78 @@ +diff -up ./src/cats/make_mysql_tables.in.old ./src/cats/make_mysql_tables.in +--- ./src/cats/make_mysql_tables.in.old 2011-11-03 12:57:05.237131261 +0100 ++++ ./src/cats/make_mysql_tables.in 2011-11-03 12:57:16.639988706 +0100 +@@ -324,8 +324,8 @@ CREATE TABLE UnsavedFiles ( + + CREATE TABLE Counters ( + Counter TINYBLOB NOT NULL, +- MinValue INTEGER DEFAULT 0, +- MaxValue INTEGER DEFAULT 0, ++ \`MinValue\` INTEGER DEFAULT 0, ++ \`MaxValue\` INTEGER DEFAULT 0, + CurrentValue INTEGER DEFAULT 0, + WrapCounter TINYBLOB NOT NULL, + PRIMARY KEY (Counter(128)) +diff -up ./src/cats/sql_create.c.old ./src/cats/sql_create.c +--- ./src/cats/sql_create.c.old 2011-11-03 12:57:05.238131249 +0100 ++++ ./src/cats/sql_create.c 2011-11-03 12:57:16.641988682 +0100 +@@ -627,7 +627,7 @@ int db_create_counter_record(JCR *jcr, B + } + + /* Must create it */ +- Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,MinValue,MaxValue,CurrentValue," ++ Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,\"MinValue\",\"MaxValue\",CurrentValue," + "WrapCounter) VALUES ('%s','%d','%d','%d','%s')", + cr->Counter, cr->MinValue, cr->MaxValue, cr->CurrentValue, + cr->WrapCounter); +diff -up ./src/cats/sql_get.c.old ./src/cats/sql_get.c +--- ./src/cats/sql_get.c.old 2011-11-03 12:57:05.239131237 +0100 ++++ ./src/cats/sql_get.c 2011-11-03 12:57:16.645988630 +0100 +@@ -730,7 +730,7 @@ int db_get_counter_record(JCR *jcr, B_DB + SQL_ROW row; + + db_lock(mdb); +- Mmsg(mdb->cmd, "SELECT MinValue,MaxValue,CurrentValue,WrapCounter " ++ Mmsg(mdb->cmd, "SELECT \"MinValue\",\"MaxValue\",CurrentValue,WrapCounter " + "FROM Counters WHERE Counter='%s'", cr->Counter); + + if (QUERY_DB(jcr, mdb, mdb->cmd)) { +diff -up ./src/cats/sql_update.c.old ./src/cats/sql_update.c +--- ./src/cats/sql_update.c.old 2011-11-03 12:57:05.240131225 +0100 ++++ ./src/cats/sql_update.c 2011-11-03 12:57:16.646988618 +0100 +@@ -243,7 +243,7 @@ int db_update_counter_record(JCR *jcr, B + db_lock(mdb); + + Mmsg(mdb->cmd, +-"UPDATE Counters SET MinValue=%d,MaxValue=%d,CurrentValue=%d," ++"UPDATE Counters SET \"MinValue\"=%d,\"MaxValue\"=%d,CurrentValue=%d," + "WrapCounter='%s' WHERE Counter='%s'", + cr->MinValue, cr->MaxValue, cr->CurrentValue, + cr->WrapCounter, cr->Counter); +diff -up ./src/win32/cats/make_mysql_tables.sql.old ./src/win32/cats/make_mysql_tables.sql +--- ./src/win32/cats/make_mysql_tables.sql.old 2011-11-03 13:09:26.311866553 +0100 ++++ ./src/win32/cats/make_mysql_tables.sql 2011-11-03 13:11:13.281529248 +0100 +@@ -306,8 +306,8 @@ CREATE TABLE UnsavedFiles ( + + CREATE TABLE Counters ( + Counter TINYBLOB NOT NULL, +- MinValue INTEGER DEFAULT 0, +- MaxValue INTEGER DEFAULT 0, ++ `MinValue` INTEGER DEFAULT 0, ++ `MaxValue` INTEGER DEFAULT 0, + CurrentValue INTEGER DEFAULT 0, + WrapCounter TINYBLOB NOT NULL, + PRIMARY KEY (Counter(128)) +diff -up ./updatedb/update_mysql_tables_5_to_6.old ./updatedb/update_mysql_tables_5_to_6 +--- ./updatedb/update_mysql_tables_5_to_6.old 2011-11-03 13:09:37.497726710 +0100 ++++ ./updatedb/update_mysql_tables_5_to_6 2011-11-03 13:11:13.282529236 +0100 +@@ -79,8 +79,8 @@ DROP TABLE Counters; + + CREATE TABLE Counters ( + Counter TINYBLOB NOT NULL, +- MinValue INTEGER, +- MaxValue INTEGER, ++ \`MinValue\` INTEGER DEFAULT 0, ++ \`MaxValue\` INTEGER DEFAULT 0, + CurrentValue INTEGER, + WrapCounter TINYBLOB NOT NULL, + PRIMARY KEY (Counter(128)) diff --git a/bacula.spec b/bacula.spec index c13fe97..a7aadaf 100644 --- a/bacula.spec +++ b/bacula.spec @@ -52,6 +52,7 @@ Patch19: bacula-5.0.3-log-path.patch Patch20: bacula-5.0.3-sqlite-priv.patch Patch21: bacula-5.0.3-tray-dir.patch Patch22: bacula-5.0.3-mysql55.patch +Patch23: bacula-5.0.3-maxvalue.patch URL: http://www.bacula.org BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -380,6 +381,10 @@ pushd bacula-%{version} %patch20 -p0 -b .priv %patch21 -p2 -b .tray-dir %patch22 -p0 -b .mysql55 +#quoting MaxValue in sql scripts +%patch23 -p1 -b .maxvalue + + # Remove execution permissions from files we're packaging as docs later on find examples -type f | xargs chmod -x @@ -1071,6 +1076,7 @@ fi %changelog * Fri Oct 9 2011 Lukáš Nykrýn - 5.0.3-12 - fixed restart option in service files (#745529) +- fixed creating of bacula MySQL tables (#724894) * Fri Sep 9 2011 Tom Callaway - 5.0.3-11 - add missing scriptlets